On Apr 26, 2008, at 7:19 PM, dr wrote:
I just thought of something:

Or, can I tell Zenoss to only try to hit /server-status/ if SNMP reports that the Apache process is running, and only try to hit MySQL if SNMP reports that MySQL is running?

This sounds like a good way to go. Try the following script within zendmd to accomplish this. If you're reading this on the web forum hit the reply button to see the proper indentation. Of course you can adapt this to your needs.

def addTemplateToDevice(device, template):
    if device.hasProperty('zDeviceTemplates'):
        if not template in device.zDeviceTemplates:
            device.zDeviceTemplates.append(template)
    else:
        device._setProperty('zDeviceTemplates', ['Device', template])

for device in dmd.Devices.Server.Linux.getSubDevices():
    if 80 in [ s.port for s in device.os.ipservices() ]:
        addTemplateToDevice(device, 'Apache')
    if 3306 in [ s.port for s in device.os.ipservices() ]:
        addTemplateToDevice(device, 'MySQL')

for device in dmd.Devices.Server.Windows.getSubDevices():
    if 80 in [ s.port for s in device.os.ipservices() ]:
        addTemplateToDevice(device, 'IIS')
    if 3306 in [ s.port for s in device.os.ipservices() ]:
        addTemplateToDevice(device, 'MySQL')

commit()
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to