Nov 24, 2011 11:20 AM
SNMP Polling on specific time.
-
Like (0)
Hi All,
I am wondering how to control by time frame of polling the snmp traffic from the devices. I am sure it is possible not sure about the correct way to do it.
I want to poll the snmp data during the specific time and during the rest, there should not be any SNMP activity.
Is there a way to control on device basis too??
Thanks in advance.
You probably will need to be more specific. Zenoss polls via SNMP every 60 seconds. The only time it stops polling a device is when it's marked decomissioned. You could, I suppose, either script going into and out of that state (as without polling you won't get much data to alert on anyway), or you could use command datasources or the like...
--
James Pulver
ZCA Member
LEPP Computer Group
Cornell University
Hi James,
Thanks for the reply.
Thing is I saw decomissioned option from the forum but was wondering whether is there any other way to pull it off smoothly and automatedly. I want to shutdown zenoss from polling any snmp data from certain devices during certain hours of the day. Not just stopping zenoss from creating alerts and events. For example from 9am to 5pm I dont want zenoss to poll any snmp data from specific say 10 devices. By 5 pm zenoss should start monitoring and polling snmp info. I am sure some people would be doing this in their setup.
You mentioned about scripting decomission action. Do you have it by any chance? as I am not good with scripting as such.
To add on. Is there a way for zenoss to stop polling snmp from all devices temporarily due to some critical reason or so. I know that I can just go to command prompt and shutdown zenoss. But I was wondering whether I can shutdown polling feature instead of shutting down entire zenoss for temporarily by either shutting down certain deamon or so?
Thanks once again.
Regards.
If you set a device to decomissioned, it's not monitored at all that I'm aware of. I don't have a script to do this however. You can also turn off zenmodeler and zenperfsnmp and any zenpack daemons (if you have them) that use SNMP to disable polling. I expect you may be able to do this with an event command, but I don't know how you'd turn them back on automatically if you're now not polling anything...
Generally, people use templates to set polling options, (i.e. SNMP, WMI, SSH, ping etc) once... I don't actually know people who want Zenoss to regularily stop and then start monitoring specific devices, this is a new request to me...
--
James Pulver
ZCA Member
LEPP Computer Group
Cornell University
You could write a python script and cron it to move devices in and out of a decomissioned state. You don't even have to use the decomm state, you can create your own. In settings you'll see a list of State conversions such as the following:
Production:1000
Pre-Production:500
Test:400
Maintenance:300
Decommissioned:-1
Standby:-2
Spare:-3
In this example list I've added two new states that behave like decommissioned states called Standby and Spare.
Be aware that if you only collect data during certain periods then your averages for those devices in any reports will be off, since it will be missing half the data but will average the data out over the whole period.
Here's an example of what you would use for a script:
#!/usr/bin/env python
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
from transaction import commit
dmd = ZenScriptBase(connect=True, noopts=True).dmd
d = dmd.Devices.findDevice('yourdevice')
for d in dmd.Devices.getSubDevices():
if d.getDeviceName() == "yourdevice" or d.getDeviceName() == "anotherdevice":
d.setProdState('-2')
Where -2 is the ID of the Production State that you created. The script needs to be executed as the zenoss user.
Hi James,
Thanks for the information and reply.
Hi Ryan,
Thanks for the reply. Nice to see the script... As I am not good with scriptting, Is there any walk through or steps which I can refer to? How to set cron with this script?
How to create state as you mentioned earlier? I see in the script you mentioned that 'yourdevice', how to specify a list of ip addresses or devices? I am sure these questions might be lame for you. :S
Thanks in Advance.
At this point, I have to recommend RTFM(s). It's going to be pretty necessary for you to understand basic Linux things like Cron to get very far with modifying / configuring Zenoss. Some tips about what you should know are in our New Users FAQ:
https://zcaportal.org/wiki/bin/view/ZCA/ZCAFAQ#What_should_I_know_before_using_Zenoss_63
Also, not to be a shill, but if you or others have more budget than time or interest in learning Zenoss and Linux, you may want to consider either an Enterprise Subscription or a Community Consulting engagement - the ZCA can help here as well.
--
James Pulver
ZCA Member
LEPP Computer Group
Cornell University
Hi James and Ryan,
Thanks a lot for the help guys.
Regards,
Spawn
Is there a reason that a Maintenance Window wouldn't work for this?
You could create a "Systems" or "Groups" organizer, add the maintenance window to the organizer, and then make the subset of devices a member of that organizer. This is what I have done for situations like this and it works pretty well. The "Decommissioned" state is one of the available options.
Hope this helps,
Joseph
In my experience the use of maintenance windows is unreliable in terms of returning devices to their previous state once the window ends. I've had lots of problems with them in the past so I've stopped using them. Perhaps it's been resolved in more recent versions.
Simple maintenance windows work fine - i.e. you have one computer go into maintenance and then come out. Overlapping ones don't work. It only stores state for one window per device.
--
James Pulver
ZCA Member
LEPP Computer Group
Cornell University
Yeh, I was having issues with even single maintenance windows in the past. I guess that was fixed.
Exactly. i saw the decomission one in the maintainence window but in the cases like to periodic stop collecting certain number of devices to be stopped and when to set it up on different time schedules for different devices depends on requirement. first it will be hard to create maintainence window manually too... Thts y i was interested in script.
The script ran well and no snmp traffic was seen as soon as the state got changed to decomission. Should test with multiple devices and multiple window scenario
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||