Discussion:
Using command data source to determine device state
nelliott
2013-05-02 15:12:10 UTC
Permalink
nelliott [http://community.zenoss.org/people/nelliott] created the discussion

"Using command data source to determine device state"

To view the discussion, visit: http://community.zenoss.org/message/73064#73064

--------------------------------------------------------------
[Zenoss 3.1.0]  I'm using a command data source to monitor my emergency standby generator via modbus using this script: https://github.com/tallakt/modbus-cli https://github.com/tallakt/modbus-cli and it works great for collecting battery voltage and coolant temperature, this stuff graphs very nicely.

I also want to monitor and alarm on the generator operation state and control status.  The modbus polling script will return a simple integer for operation state like:

"40011    0"

I add a little formatting manipulation to the command string syntax so I get a nagios-type result into Zenoss:

"GenControl | ControlState=0"

The states are:

0 = Stopped
1 = Start Pending
2 = Warm-up at Idle
3 = Running
4 = Cool down at Rated
5 = Cool down at Idle

Now, I could just set a threshold max of 0, and get a threshold alarm for all other activity, but that is lame...  I would like to translate these to generate alerts such as  "Generator Running".  I suspect I can use some event transform juju to make this happen by translating the event summary of "threshold of ControlState not met: current value 1.00"... but it seems like a messy solution, and I wonder if I am missing a better option??

Thank you
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73064#73064]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
nelliott
2013-05-02 16:40:57 UTC
Permalink
nelliott [http://community.zenoss.org/people/nelliott] created the discussion

"Re: Using command data source to determine device state"

To view the discussion, visit: http://community.zenoss.org/message/73066#73066

--------------------------------------------------------------
Here is what I built for now... it works...but it feels like I am doing it the hard way.


GenEvent=getattr(evt,'message')
# Default message text is: "threshold of ControlState exceeded: current value 2.00"
if (GenEvent.find("threshold of ControlState") >=0):
   #delimit everything with periods
   tempMsg1=GenEvent.replace(' ','.')
   tempMsg2=tempMsg1.split('.')
   #grab the 2 from the message text string
   cValue=tempMsg2[6]

cState='Error Reading Generator State'
evt.severity=4

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'

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

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73066#73066]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...