Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ZenPack Development with Jane Curry

848 views

Published on

Live from GalaxZ 16 is ZenMaster Jane Curry as she discusses ZenPack development and the Zenoss Community.

Published in: Technology
  • Be the first to comment

ZenPack Development with Jane Curry

  1. 1. ZENPACK DEVELOPMENT FROM A ZENMASTER jane.curry@skills-1st.co.uk ZENMISTRESS
  2. 2. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16
  3. 3. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16  400+ pages (lots of screenshots)  Architecture  Zenoss core code  Stuff for rookies  Stuff for the initiated  Stuff for seasoned ZenPackers  Stuff for gurus  All code samples on GitHub ZENPACK DEVELOPERS' GUIDE
  4. 4. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16  Create a Simple ZenPack through GUI (Zenoss 4) or “zenpack create” CLI (Zenoss 5) − ZenPack will be in development mode ie. you can add stuff through the GUI  LOTS of “Add to ZenPack” menus − templates, event classes, MIBs, device classes, processes* , IP services* , Windows services* , commands − NOT device instances, triggers, notifcations  Don't forget to “Export ZenPack” − Creates egg file − Writes objects/objects.xml  Install ZenPack in development mode for testing; install egg version in production  “zenpack --remove” deletes all objects in the ZenPack − including instances of such objects ROOKIE HELP
  5. 5. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16  eggs are magic!  unzip ZenPacks.community.LogMatch-1.0.2-py2.7.egg − ZenPacks  community −LogMatch  objects  objects.xml  modeler/plugins  Exporting the ZenPack from the GUI creates the egg ROOKIE HELP
  6. 6. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16  Several examples for creating new Zenoss device class and new components  zenpacklib is your friend and can create: − Object class for device, object class for components, attributes for each, relationships for each, new zProperties, performance templates − No Python code; no JavaScript  Actually, there is - but it is auto-generated and held in memory − zenpacklib does not create modeler plugins  Must be written in Python under modeler/plugins  Start from someone else's code and modify  Must understand exactly what zenpacklib auto-generates − Define relationship names explicitly (don't let them default) HELP FOR THE INITIATED
  7. 7. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16  Name relationships explicitly in zenpack.yaml UserGroupDevice: relationships: userGroups: # down to UserGroup component label: userGroups UserGroup: relationships: userGroupDevice: # back to the containing device label: userGroupDevice users: # down to User sub-component label: users User: relationships: primaryUserGroup: # back to the containing primary UserGroup label: primaryUserGroup HELP FOR THE INITIATED
  8. 8. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16
  9. 9. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16  You MUST have a test environment − understand the minimum daemon recycle requirements − subset of daemons active  Complex sample ZenPacks using SNMP, COMMAND and Python  Example to convert a COMMAND ZenPack to use PythonCollector − Twisted  Example to convert from traditional coded ZenPack to zenpacklib  Several examples of creating new datasources  Sample to include event classes, triggers and notifications in ZenPack  ZenPacks.community.MenuExamples  Use try...except Python construct to trap errors and report back “nicely”  Testing, debugging, “Where do things go wrong?” sections HELP FOR SEASONED ZENPACKERS
  10. 10. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16  Searching for something in Zenoss core code cd $ZENHOME/Products grep xyzzy `find . -name “*.py”`  zendmd and ZMI are your friends! d = find('zen42.class.example.org') for k, v in d.__dict__.items(): print k, v _lastChange 1462446603.82 local attribute test1 <RRDTemplate at test1> local template cSite Taplow ) custom properties cRigHost [] ) HELP FOR SEASONED ZENPACKERS
  11. 11. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16
  12. 12. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16  Dev Guide has whole sections for gurus, plus comments in-line − Zenoss architecture − Zenoss base code  Object classes under $ZENHOME/Products/ZenModel and their inheritance  Relationship diagrams  Details of core modeler plugin classes and datasource classes  Monkey patching  zenpacklib example of renderer and object methods  Python Twisted library − code must be non-blocking; must return Twisted Deferred  Python datasource plugins - what happens in collectors vs zenhub? − judicious config_key methods  Understanding detailed logs GURU HELP
  13. 13. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16  Taken 5 years to get this far!  Needs help from YOU!  Samples on GitHub − https://github.com/ZenossDevGuide − Samples deliberately have very minimal setup requirements  Sometimes rather contorted; some definitely not production strength  All have README.rst  Some ZenPack repositories have multiple branches − Sample “lead reviewers” required  Especially anyone with Zenoss 5 experience  Dev Guide “lead reviewers” required for sections  Open discussion on ZenPack Dev forum - http://www.zenoss.org/forums/zenpack-development  Come and chat in the Community Area in Griffin Hall ZENPACK DEVELOPERS' GUIDE - NEXT STEPS
  14. 14. © 2016 All Rights Reservedjane.curry@skills-1st.co.uk #GALAXZ16

×