<s> from twisted . internet . protocol import Protocol <EOL> from pymon . agents . local import LocalAgentClient <EOL> from pymon . clients import ClientMixin <EOL> from pymon . utils . pingparser import OutputParser <EOL> from pymon . utils . logger import log <EOL> class LocalAgentPingClient ( LocalAgentClient , ClientMixin ) : <EOL> def connectionMade ( self ) : <EOL> LocalAgentClient . connectionMade ( self ) <EOL> ClientMixin . setup ( self ) <EOL> def processRules ( self , checkData , ** kwds ) : <EOL> """<STR_LIT>""" <EOL> status = self . rules . check ( checkData ) <EOL> if self . rules . messaging . isSend ( status ) : <EOL> self . rules . messaging . createMessages ( ** kwds ) <EOL> self . workflow . checkTransition ( status , self . factory . cfg , self . rules ) <EOL> def connectionLost ( self , reason ) : <EOL> log . debug ( self . factory . data ) <EOL> parse = OutputParser ( self . factory . data ) <EOL> loss = parse . getPingLoss ( ) <EOL> gain = parse . getPingGain ( ) <EOL> host = self . getHost ( ) <EOL> self . processRules ( gain , host = host , loss = loss , gain = gain ) <EOL> self . updateState ( ) <EOL> log . info ( '<STR_LIT>' + str ( self . factory . state . data ) + '<STR_LIT:\n>' ) <EOL> LocalAgentClient . connectionLost ( self , reason ) <EOL> ClientMixin . teardown ( self ) </s>
