HowTo add Multiple DataPoints to Zenoss using the Zenoss API

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.

Any question or help about this script, please post them here http://www.linuxdynasty.org/forums/Scripting/scripting/ZenossTemplateManager
UPDATES!!!!!!

  • Update 1.0.6, Fixed an issue where if youdo not pass the -G option for graph it will fail.
  • Update 1.0.5, Now have the ability to add multiple graphs with multiple datapoints
  • Update 1.0.4, Now have the ability to create thresholds, bind templates to class or device, set severities on thresholds and
    datasources, attach datapoints to thresholds.
  • Update 1.0.3, I broke down the templateManager function into 3 smaller functions. You also can now list templates and datasources for either device or organizer, and list datapoints for a device. I also added more verbosity with the -V option.
  • Update 1.0.2, You now do not have to pass a command with the script. So i f you already have a command in the DataSource, it wll not get overwritten.. Thank you Eangel, for telling me about this issue..

Upcoming Features such as….

  • Deleteing Templates, DataSources, and DataPoints
  • Copying Templates
  • Adding Graphs

The tool is called Zenoss_Template_Manager.py. You can download it here..
Download

Here are some examples….

If you already have the command in place for that DataSource, then run the script with out the -c option…

Examples:

Another Example With The Verbose Option..

I also added the ability to list templates, datasources, and datapoints…
Examples Below…

 

Example of creating a Threshold..

Now here is an example of Adding Graphs..

Remember, when adding DataPoints to your graphs, you are adding the name of the DataSource_Datapoint. You can see what the names of the DataPoints you have available by using the –list=”datapoints” option with the –template=TEMPLATE_NAME option

here is an example of adding graphs with a template and a datasource and multiple datapoints..

To see the Help output, just run it like this python Zenoss_Template_Manager.py -h

This entry was posted in Zenoss and tagged , , . Bookmark the permalink.

Leave a Reply