Discussion:
Alerts for devices left in "Maintenance" prod state
mberry
2013-02-08 20:21:55 UTC
Permalink
mberry [http://community.zenoss.org/people/mberry] created the discussion

"Alerts for devices left in "Maintenance" prod state"

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

--------------------------------------------------------------
Hi,

Is it possible to set an alert for a device that was left in Production state: Maintenance?

Scenario:

(Note: There is no Maintenance Window setup or this is a one off emergency Maintenance activity)

1) A administrator manually changes the Production State to "Maintenance" on a device.
2) Maintenance is completed but the admin neglects to set the Production State back to "Production" from "Maintenance"

Is it possible to trigger an email or pager alerting rule to notify that this device is still in the "Maintenance" Production State after a period of time has elapsed using the "Delay (secs)" field within an alerting rule?

If so, how do you build the Alerting rule?

Please advise and thanks in advance!
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
joanypony
2013-02-11 12:46:37 UTC
Permalink
joanypony [http://community.zenoss.org/people/joanypony] created the discussion

"Re: Alerts for devices left in "Maintenance" prod state"

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

--------------------------------------------------------------
Hi,

This isn't exactly what you asked for, but we've found it useful. I have a script that emails me a list of any devices in non-production modes. The email is sent just before home time so we don't accidently leave production machines muted all evening. We don't use maintenance windows but we have about 20 different adminstrators in different timezones, so this has helped keep it in order.

#!/ask/zenoss/python/bin/python
# Joan - this will list all devices in non production states. 


import Globals, sys
import transaction


from Products.ZenUtils.ZenScriptBase import ZenScriptBase
dmd = None
try:
    dmd = ZenScriptBase(connect=True).dmd
except Exception, e:
    print "Connection to zenoss dmd failed: %s\n" % e
    sys.exit(1)


print ""
print "Maintenance:"
print ""
for dev in dmd.Devices.getSubDevices_recursive():
        if dev.productionState == 300:
                print dev.id


print ""
print "Pre-production:"
print ""
for dev in dmd.Devices.getSubDevices_recursive():
        if dev.productionState == 500:
                print dev.id


print ""
print "Decommissioned:"
print ""
for dev in dmd.Devices.getSubDevices_recursive():
        if dev.productionState == -1:
                print dev.id


print ""
print "Test:"
print ""
for dev in dmd.Devices.getSubDevices_recursive():
        if dev.productionState == 400:
                print dev.id


trans = transaction.get()
trans.commit()

Then in my cron I have something like this -

#crontab to email list of devices in non production state to Operations
00 17 * * * /zenoss/scripts/list-nonstandard-states.py | mail -s " Zenoss Devices in Non Production States" mailto:***@mywork.com ***@mywork.com

Hope that helps.

Joan
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jmp242
2013-02-11 17:36:39 UTC
Permalink
jmp242 [http://community.zenoss.org/people/jmp242] created the discussion

"Re: Alerts for devices left in "Maintenance" prod state"

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

--------------------------------------------------------------
!As you can create custom prod states, you might want to generalize to

for dev in dmd.Devices.getSubDevices_recursive():

        if dev.productionState  != 1000:

                print dev.id


--
James Pulver
ZCA Member
LEPP Computer Group
Cornell University
--------------------------------------------------------------

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

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