Archived community.zenoss.org | full text search
Skip navigation
Currently Being Moderated

LinuxDynasty's Zenoss Template Manager

VERSION 3  Click to view document history
Created on: Mar 4, 2010 11:59 PM by linuxdynasty - Last Modified:  Apr 29, 2010 5:14 PM by Matt Ray

I've seen a few people in the Zenoss community forums asking for an easier way to add multiple Datapoints into Zenoss, instead of adding 1 by 1. Well, I've decided to try and build such a tool today. Now even though the tool is not complete (IN MY EYES). It is already has been helpful to me! As of right now the script can List Templates in a Organizer ( aka /Devices/Server/Linux ) or in a Device ( zenoss1.linuxdynasty ).

It can also create a Template, with a Command DataSource, with Multiple DataPoints. This means you can now automate the creation of Templates and DataSources and DataPoints. So if you are using a tool like Puppet, Cfengine, Bcfg2, or Chef, this process can be automated. I will be adding more features in the next few weeks.

Upcoming Features such as....

  • Deleteing Templates, DataSources, and DataPoints
  • Moving Templates
  • Adding Thresholds
  • Adding Graphs

 

The tool is called Zenoss_Template_Manager.py. (Future updates will be maintained on http://linuxdynasty.org)

 

Here are some examples....

Examples: python Zenoss_Template_Manager.py -d "zenoss.linuxdynasty" -c '/opt/zenoss/libexec/snmp_branch.py -c public -d localhost -p 161 -o 1.3.6.1.2.1.2.2.1 --ival="1" --label="ifIndex,ifDescr,ifType,ifMtu,ifSpeed,ifPhysAddress,ifAdminStatus,ifOperStatus,ifLastChange,ifInOctets,ifInUcastPkts,ifInNUcastPkts,InDiscards,ifInErrors,ifInUnknownProtos,ifOutOctets,ifOutUcastPkts,ifOutNUcastPkts,ifOutDiscards,ifOutErrors,ifOutQLen,ifSpecific"' --template=TESTER4LIFE2 -p "ifSpeed,G" -p "ifInOctets,C" -p "ifInUcastPkts,C" -p "ifInNUcastPkts,C" -p "ifInDiscards,C" -p "ifInErrors,C" -p "ifOutOctets,C" -p "ifOutUcastPkts
,C" -p "ifOutNUcastPkts,C" -p "ifOutDiscards,C" -p "ifOutErrors,C" --dsource="WoW2"


Another Example With The Verbose Option..

 
python Zenoss_Template_Manager.py -o "/Devices/Server/Linux" -c '/opt/zenoss/libexec/snmp_branch.py -c public
-d localhost -p 161 -o 1.3.6.1.2.1.2.2.1 --ival="1 --label="ifIndex,ifDescr,ifType,ifMtu,ifSpeed,ifPhysAddress,ifAdminStatus,ifOperStatus,ifLastChange,ifInOctets,ifInUcastPkts,ifInNUcast
Pkts,InDiscards,ifInErrors,ifInUnknownProtos,ifOutOctets,ifOutUcastPkts,ifOutNUcastPkts,ifOutDiscards,ifOutErrors,ifOutQLen,ifSpecific"'
--template=TESTER4LIFE2 -p "ifSpeed,G" -p "ifInOctets,C" -p "ifInUcastPkts,C" -p "ifInNUcastPkts,C" -p "ifInDiscards,C" -p "ifInErrors,C" -p
"ifOutOctets,C" -p "ifOutUcastPkts,C" -p "ifOutNUcastPkts,C" -p "ifOutDiscards,C" -p "ifOutErrors,C" --dsource="WoW2" -V

Template TESTER4LIFE2 already existed
WoW2 DataSource already exists
Parser = Auto
Command /opt/zenoss/libexec/snmp_branch.py -c public -d localhost -p 161 -o 1.3.6.1.2.1.2.2.1 --ival="1" --label="ifIndex,ifDescr,ifType,ifMtu,ifSpeed,ifPhysAddress,ifAdminStatus,ifOperStatus,ifLastChange,ifInOctets,ifInUcastPkts,
ifInNUcastPkts,InDiscards,ifInErrors,ifInUnknownProtos,ifOutOctets,ifOutUcastPkts,ifOutNUcastPkts,ifOutDiscards,ifOutErrors,
ifOutQLen,ifSpecific" has been added to DataSource
ifSpeed DataPoint added and type = GAUGE
ifInOctets DataPoint added and type = COUNTER
ifInUcastPkts DataPoint added and type = COUNTER
ifInNUcastPkts DataPoint added and type = COUNTER
ifInDiscards DataPoint added and type = COUNTER
ifInErrors DataPoint added and type = COUNTER
ifOutOctets DataPoint added and type = COUNTER
ifOutUcastPkts DataPoint added and type = COUNTER
ifOutNUcastPkts DataPoint added and type = COUNTER
ifOutDiscards DataPoint added and type = COUNTER
ifOutErrors DataPoint added and type = COUNTER

Here is the help output

options:
  -h, --help            show this help message and exit
  -d DEVICE, --device=DEVICE
                        The device, you want your template attached to.
  -o ORGANIZER, --organizer=ORGANIZER
                        The Organizer you want your template attached to.
  -s DSOURCE, --dsource=DSOURCE
                        Name of the DataSource you want to create or use.
  -V, --verbose         Print output
  -p DPOINTS, --dpoints=DPOINTS
                        for every -p you pass you pass either
                        DataPoint Name and Type C|G|D|A
                        Example.. -p "ifOutDiscards, C", -p "ifInDiscards, C"
  -t TEMPLATE, --template=TEMPLATE
                        The name of template you want to create or use.
  -c COMMAND, --command=COMMAND
                        The Nagios Command you want to add to this template
  -P PARSER, --parser=PARSER
                        Which Parser you want to use
                        Example.. -P "Nagios" The default is Auto
  -l LIST, --list=LIST  List either the DataSources, Templates, or DataPoints
                        Example.. --list="templates", or --list="datasources"
                        or                      --list="datapoints"
Attachments:
Note: binary attachments ending in .zip will need to be unzipped before use.
Comments (1)