TECHZEN Zenoss User Community ARCHIVE  

Example of zenpacklib

Subject: Example of zenpacklib
Author: [Not Specified]
Posted: 2016-02-17 09:17

Can anyone point me to a ZenPack that uses zenpacklib and has multiple relations. I would like to see the zenpack.yaml and modelers files to see the syntax since the doc only show 1 relation and I need to figure out syntax for multiple relations.

Thanks

Manuel



Subject: In http://zenpacklib.zenoss
Author: [Not Specified]
Posted: 2016-02-18 15:46

In http://zenpacklib.zenoss.com/en/latest/yaml-classes-and-relationships.html, there are examples of one-to-many (1:M or 1:MC) and many-to-many (M:M) relationships.



Subject: Sorry for the lack of
Author: Chet Luther
Posted: 2016-02-18 16:12

Sorry for the lack of indentation and formatting on the code snippets. I can't figure out how to get them formatted properly.

First some background. Setting the relname and modname properties on the modeler plugin class, then using the self.relMap() and self.objectMap() methods within your modeler plugin are shortcuts that only work when a modeler plugin is modeling a single relationship. So you won't see relname or modname being set on the class, or the self.relMap() and self.objectMap() methods being called for modeler plugins that model more than one relationship.

The first thing to understand is what the allowable return values for a modeler plugin's process() method are.

You'll need to import ObjectMap and RelationshipMap to use them in your modeler plugin. The imports are as follows.

from Products.DataCollector.plugins.DataMaps import ObjectMap, RelationshipsMap

Here's an example in the ZenPacks.zenoss.Microsoft.Windows ZenPack..

https://github.com/zenoss/ZenPacks.zenoss.Microsoft.Windows/blob/develop/ZenPacks/zenoss/Microsoft/Windows/modeler/plugins/zenoss/winrm/WinMSSQL.py#L495



Subject: There are examples of what I
Author: Jane Curry
Posted: 2016-03-17 08:18

There are examples of what I think you want in the new Zenoss Developers Guide that I am writing, including ZenPack samples. It is not yet publicly available but contact me offline for a copy.

Cheers,

Jane

Email: jane.curry@skills-1st.co.uk    Web: https://www.skills-1st.co.uk



< Previous
Updating zProperties in zenpack.yaml not Propagating
  Next
How should I publish a zenpack?
>