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

How To create a ZenPack of all of your Custom Zenoss Device Templates

VERSION 1 
Created on: Feb 28, 2010 9:29 PM by linuxdynasty - Last Modified:  Apr 29, 2010 5:14 PM by Matt Ray

Recently I had to prepare for a Zenoss upgrade. During my prep work I had to create a zenpack of all of our Templates. For those of you who use Zenoss, you know how many templates you can start to accumulate in a short amount of time. You can have Templates attached to single Devices, to SubClasses, and to Classes. Now if you have a few devices this is not a big deal. But if you have a couple hundred to a couple of thousand devices, this could be a real hassle.

 

Now you can take a ton of your time and review Class by Class and Device by Device until you finally finish. You will eventually get it all in a Zenpack....... Well lucky for you guys I created a Python Script that runs as the Zenoss user and create a Zenpack for you. All you have to do is pick a name for the ZenPack and optionally the Device Class you want to scan. The script will scan the Device Class that you specified ( or by default scan the entire /Device Class and its Sub Classes). It will then create the ZenPack with all the locally attached Device Templates. I am thinking of also adding the Events class as part of the next release of this script.

 

Update 1.0.1, I added the --unique option. If you decide to use this option, This Zenpack will only add, The Device Templates that are not already part of an existing ZenPack. I also added the --verbose option, so that you can see which Device Templates are being added or being dismissed.


Any updates will be maintained on my site http://linuxdynasty.org

http://www.linuxdynasty.org/howto-backup-all-of-your-zenoss-templates-the-easy-way.html

 

Example.....

python createZenPack.py -p "ZenPacks.Allen.Test1" -a "Allen Sanabria" -v "0.9" -r "/Server/Linux/"

 

INFO:zen.HookReportLoader:loading reports from:/opt/zenoss/ZenPacks/ZenPacks.Allen.Test1/ZenPacks/Allen/Test1/reports

Created ZenPack ZenPacks.Allen.Test1Scanning for locally attached Templates

Scanning for locally attached Templates

 

Objects Attached to Zenpack ZenPacks.Allen.Test1
/zport/dmd/Devices/Server/Linux/foo1.com/foo
/zport/dmd/Devices/Server/Linux/DNS/bind
/zport/dmd/Devices/Server/Linux/Apache/http

Another Example, with the unique option and verbose option.

python createZenPack.py -p "ZenPacks.Allen.Test1" -a "Allen Sanabria" -v "0.9" -u -V 

-INFO:zen.HookReportLoader:loading reports from:/opt/zenoss/ZenPacks/ZenPacks.Allen.Test1/ZenPacks/Allen/Test1/reports
Created ZenPack ZenPacks.Allen.Test1
Scanning for locally attached Templates
Scanning for locally attached Templates
Objects Attached to Zenpack ZenPacks.Allen.Test1
I'm not UNIQUE /zport/dmd/Devices/Server/rrdTemplates/LDAPServer
I'm in ZenPacks.zenoss.LDAPMonitor
I'm not UNIQUE /zport/dmd/Devices/Server/rrdTemplates/Apache
I'm in ZenPacks.zenoss.ApacheMonitor
I'm UNIQUE /zport/dmd/Devices/Server/Linux/foo1.com/foo


Another Example...

python createZenPack.py --list
HPTemperatureSensors
ZenPacks.Allen.Test1
ZenPacks.Allen.Full
ZenPacks.Allen.Tomcat

Help OutPut...

python createZenPack.py -h
usage: createZenPack.py  --packname=ZenPackName --author=name --version=1.0

options:
-h, --help            show this help message and exit
-p ZPACKNAME,         --packname=ZPACKNAME
                       The name of the ZenPack that you want to create
-a AUTHOR,            --author=AUTHOR
                       Who is creating The ZenPack?
-v VERSION,           --version=VERSION
                       What Release is this?
-r ROOT,              --root=ROOT 
                       What Device Class You want the Search to begin at?
-l,                   --list
                       List all the ZenPacks
Attachments:
Note: binary attachments ending in .zip will need to be unzipped before use.
Comments (0)

More Like This

  • Retrieving data ...