Quantcast
Channel: Zenoss Community: Message List
Viewing all articles
Browse latest Browse all 1097

Re: Using command data source to determine device state

$
0
0

Here is what I built for now... it works...but it feels like I am doing it the hard way.  (Updated from initial post to fix an error)

 

 

cState='Error Reading Generator State'
cValue='9'
evt.severity=4  
GenEvent=getattr(evt,'message')  
# Default normal message text is: "threshold of ControlState restored: current value 0.00"
if (GenEvent.find("restored") >=0):   cValue='0'
# Default error message text is: "threshold of ControlState exceeded: current value 2.00"
elif (GenEvent.find("exceeded") >=0):   #delimit everything with periods   tempMsg1=GenEvent.replace(' ','.')   tempMsg2=tempMsg1.split('.')   #grab the 2 from the message text string   cValue=tempMsg2[6]  
if cValue == '0':   cState='Stopped'
if cValue ==  '1':   cState='Start Pending'
if cValue == '2':   cState='Warm-up at Idle'
if cValue == '3':   cState='Running'
if cValue == '4':   cState='Cool down at Rated'
if cValue == '5':   cState='Cool down at Idle'
if cValue == '9':   cState='Error Reading Data'

evt.summary='Generator State = %s' % (cState)

Viewing all articles
Browse latest Browse all 1097

Trending Articles