![]() |
![]() |
Subject: | zenpacklib dump_templates |
Author: | Jane Curry |
Posted: | 2015-11-24 08:27 |
zenpacklib dump_templates doesn't always find templates in a ZenPack. Completely failing to find any in zenpacklib-created ZenPacks. Is this broken or working as designed. Typically I just get output with:
$ ./zenpacklib.py dump_templates ZenPacks.community.LogMatch
name: ZenPacks.community.LogMatch
Cheers,
Jane
Email: jane.curry@skills-1st.co.uk Web: https://www.skills-1st.co.uk
Subject: | The trick with this is that |
Author: | Jane Curry |
Posted: | 2015-12-15 15:47 |
The trick with this is that templates are only dumped if that ZenPack contains the Zenoss device class definition that the template is defined for.
I have had some success with temprarily adding a device class to a ZenPack through the GUI, run zenpacklib.py dump_templates, redirecting stdout to a file, and then remove the device class from the ZenPack via the GUI.
Cheeers,
Jane
Email: jane.curry@skills-1st.co.uk Web: https://www.skills-1st.co.uk
Subject: | Yeah, I really wish it would |
Author: | Jay Stanley |
Posted: | 2015-12-17 07:57 |
Yeah, I really wish it would grab templates from the objects.xml
Subject: | I've seen a few other people |
Author: | Chet Luther |
Posted: | 2016-01-20 14:00 |
I've seen a few other people encounter this recently too. Here's the JIRA issue for it. So far it hasn't been fixed.
https://jira.zenoss.com/browse/ZEN-18824
Jane's recommendation to temporarily add the device class to the ZenPack is your best bet for now.
Subject: | Thanks Chet! |
Author: | Jane Curry |
Posted: | 2016-01-20 15:49 |
Thanks Chet!
Found another glitch today with dump_templates. I had a local copy of the Device template on a device in the device class that I wanted to export templates for. I just got
"AttributeError: 'NoneType' object has no attribute 'getOrganizerName' "
Looking at the zenpack_templatespecs method around line 6378 (zenpacklib 1.0.3) which now has my temporary hack in it:
templates = collections.defaultdict(dict)
for deviceclass in [x for x in zenpack.packables() if x.meta_type == 'DeviceClass']:
for template in deviceclass.getAllRRDTemplates():
# Next 2 lines by JC to get around having a local Device template for DirFile class
# which results in template.deviceClass() of None so the rest fails
if template.id == 'Device':
continue
dc_name = template.deviceClass().getOrganizerName()
templates[dc_name][template.id] = RRDTemplateSpecParams.fromObject(template)
return templates
The failure is with a template whose template.id == 'Device'. Not sure if the issue is because this is the root level of the class tree or whether the issue is because there is a local copy of the Device template on a device instance of my selected device class
Debugged this by running these few commands in zendmd. The "dirty fix" does at least circumnavigate the issue for me.
Cheers,
Jane
Email: jane.curry@skills-1st.co.uk Web: https://www.skills-1st.co.uk
Subject: | Thanks for pointing that |
Author: | Chet Luther |
Posted: | 2016-01-21 10:29 |
Thanks for pointing that glitch out. Locally-overridden templates seems like such an obvious case. I'm sure we only missed it because we don't tend to be running dump_templates from real systems that might have locally-overridden templates.
I have a fix for the dumping of monitoring templates that are implicitly and explicitly associated with a ZenPack nearly ready to go. It also fixes the issue with locally-overridden templates. I've updated ZEN-18824 to describe both problems in more detail.
https://jira.zenoss.com/browse/ZEN-18824
The fixes will likely be in zenpacklib 1.0.8 which I'll try to release today. I'll update this topic when I do.
Subject: | zenpacklib 1.0.8 has been |
Author: | Chet Luther |
Posted: | 2016-01-21 11:18 |
zenpacklib 1.0.8 has been released. All of the dump_templates issues should be fixed.
http://zenpacklib.zenoss.com/
< |
Previous Troubles with visualisation of fields and graphs |
Next Cisco UCS Zenpack mirror? |
> |