![]() |
![]() |
Subject: | zSnmpAuthPassword - Can specify via API or CLI? |
Author: | [Not Specified] |
Posted: | 2016-07-19 14:04 |
Is it possible in Zenoss Core 5 to specify the zSnmpAuthPassword property - or any of the SNMPv3-related properties - via an API call or by executing a Control Center CLI command
I've reviewedthe Zenoss Core Administration Guide and it appears that the only way to specify the values of an SNMP V3 property set for a particular device is by using the Zenoss console/GUI. I would like to put this question to the community to confirm this. The goal is to use automation to set the SNMP V3-related zProperties - rather than requiring a human being to manually specify.
I am new to Zenoss and I'm assisting a colleague from a design/use case level. Any information and ideas on this will be greatly appreciated. Thank you very much!
UPDATE: I did find 1 possible method here:http://zenpacklib.zenoss.com/en/latest/yaml-device-classes.html - using the ZenPack method. Any comments on this technique (or other ideas) will be appreciated. Thanks.
Subject: | I have a small Python program |
Author: | Jane Curry |
Posted: | 2016-07-27 09:38 |
I have a small Python program that sets the SNMP V2 zSnmpCommunity property. It would be trivial to modify that to change the SNMP V3 properties:
#!/usr/bin/env python
#
# Author: Jane Curry
# Date October 30th 2012
# Description: Sets local zSnmpCommunity property to new value
# Updates:
#
import sys
import Globals
import time
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
from transaction import commit
#of = open('/home/zenoss/zSnmpCommunityChange.out', 'w')
of = open('/z/zSnmpCommunityChange.out', 'w')
localtime = time.asctime( time.localtime(time.time()) )
of.write(localtime + "\n\n")
# Need noopts=True or it barfs with the script options
dmd = ZenScriptBase(connect=True, noopts=True).dmd
zSnmpCom = 'newCommunity'
for dev in dmd.Devices.getSubDevices():
# Test for devices in a particular IP range
#if dev.manageIp.startswith('10.73'):
# Test for a specific device - for testing
if dev.id == 'zenny1.class.example.org':
# do NOT use the following line ( dev.zSnmpCommunity = zSnmpCom ) to set a local property
# as it bypasses the aquisition chain and you end up with "half" a local property such
# that Configuration Properyties does not see the change, the deleteZenProperty method
# cannot find the property but the new community IS used by SNMP methods - Disaster!
#dev.zSnmpCommunity = zSnmpCom
dev.setZenProperty('zSnmpCommunity', zSnmpCom )
of.write('Device %s has zSnmpCommunity local property set to %s \n' % (dev.id, dev.zSnmpCommunity))
print 'Device %s has zSnmpCommunity local property set to %s \n' % (dev.id, dev.zSnmpCommunity)
commit()
of.close()
Email: jane.curry@skills-1st.co.uk Web: https://www.skills-1st.co.uk
Subject: | As-is, the script above |
Author: | Jane Curry |
Posted: | 2016-07-27 10:09 |
As-is, the script above cycles through all devices known to Zenoss but only changes the one that matches id of 'zenny1.class.example.org'; there is also a commented-out line that would include devices in a certain IP address range.
To run this in Zenoss 5, I have my environment set up as per http://zenpacklib.zenoss.com/en/latest/development-environment-5.html . My script is in /z/setSnmpCommunity.py , owned and executable by user zenoss. You need to run it in the zope container - with the above referenced environment, you simply type:
zope
cd /z
./setSnmpCommunity.py
You get output printed to the screen and to an output file (also under /z).
Cheers,
Jane
Email: jane.curry@skills-1st.co.uk Web: https://www.skills-1st.co.uk
< |
Previous No data in graphs ZenPacks.JanGaraj.ZabbixAgent for AWS ec2 instances? |
Next ZenPack MSSQL Error > WinRS: Failed collection [Failure instance: Traceback: <ty ... |
> |