ZenPacks and JSON API

Expand all | Collapse all

Creating ZenPack. Question from novice

  • 1.  Creating ZenPack. Question from novice

    Posted 08-04-2018 10:36 PM
    Hello

    I'm trying to create ZenPack using this manual https://www.skills-1st.co.uk/papers/jane/zenpacks/zenpacks.pdf
    I'm working now with Zenoss 4.2.4 (Python 2.7.2) and manual written based on a stack­built Zenoss Core 2.4.1
    But I thought, that principles stay the same.
    I red all manual, and try to create self. I create ZenPack using GUI. Then configured Device Class, create device, create modeling template. Device class and modeling template export to ZenPack. Files of ZenPack copied from github. Restart zenoss. But still not working. Looking for error in all log, but nothing. What I'm doing wrong?
    May be I need to configure datasources in template. But I need specific processing of SNMP tree.

    ------------------------------
    Eduard
    ------------------------------


  • 2.  RE: Creating ZenPack. Question from novice

    Posted 08-06-2018 05:43 AM
    Hi Eduard,
    You need to give us more detail of what you are trying to do here.  What is your new ZenPack trying to monitor?  What data are you trying to get from the modeler?  What performance data are you trying to gather?

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------



  • 3.  RE: Creating ZenPack. Question from novice

    Posted 08-06-2018 06:12 AM
    Hi Jane,
    New ZenPack is only a copy of considered in your manual. Not even changed. But I can describe features of Ze
    nPack. Zenpack query network controller for list of wifi device around. And for each device get som scalar like noise and strength.
    But now my problem that I can't just run the demo ZenPack from manual.



    ------------------------------
    Eduard
    ------------------------------



  • 4.  RE: Creating ZenPack. Question from novice

    Posted 08-07-2018 03:04 AM
    Which ZenPack from the ZenPack Developers' Guide are you using?

    You say "I create ZenPack using GUI. Then configured Device Class, create device, create modeling template. ", so this is a ZenPack with Python code in it, not just stuff you can add from a GUI.

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------



  • 5.  RE: Creating ZenPack. Question from novice

    Posted 08-08-2018 02:21 AM
    Yes, ZenPack with Python code in it. Code was copied from here: jcurry/ZenPacks.skills1st.bridge
    What you mean "Which ZenPack from the ZenPack Developers' Guide are you using?
    I used manual https://www.skills-1st.co.uk/papers/jane/zenpacks/zenpacks.pdf ​and there described only one ZenPack.

    ------------------------------
    Eduard
    ------------------------------



  • 6.  RE: Creating ZenPack. Question from novice

    Posted 08-09-2018 04:03 AM
    Aahhh.  That is a very old paper that i wrote about my very first ZenPack.  If you are looking for ZenPack examples, you would do much better going to the ZenPack Developers' Guide which has lots of sample ZenPacks -  https://github.com/ZenossDevGuide/DevGuide .  That's what i thought you were talking about.

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------



  • 7.  RE: Creating ZenPack. Question from novice

    Posted 08-10-2018 12:53 AM
    Thank You!
    Is there manual for development ZenPack in Zenoss v. 4.2.3? Or which version I should use?

    ------------------------------
    Eduard
    ------------------------------



  • 8.  RE: Creating ZenPack. Question from novice

    Posted 08-10-2018 04:37 AM
    The ZenPack Developers' Guide referenced in the previous append, is your best bet.  It was largely written against Zenoss 4.2.5 with some specific comments for Zenoss 5 / 6.  There shouldn't be any huge differences with regard to ZenPacks, between 4.2.5 and 4.2.3.

    What you may not have access to is the zenpacklib method of creating ZenPacks - not sure what version of Zenoss supports that.

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------



  • 9.  RE: Creating ZenPack. Question from novice

    Posted 28 days ago
    Difference between 4.2.3 and 4.2.5 exactly in access to zenpacklib. And also zenpack.yaml is not working. In tutorial on page Device Modeling - ZenPack SDK 2.1.1 documentation described a class definition with attribute temp_sensor_count:
    name: ZenPacks.training.NetBotz
    
    classes:
      NetBotzDevice:
        base: [zenpacklib.Device]
        label: NetBotz
        properties:
          temp_sensor_count:
            type: int
    
    device_classes:
      /NetBotz:
        zProperties:
          zPythonClass: ZenPacks.training.NetBotz.NetBotzDevice
          zSnmpMonitorIgnore: false
          zCollectorPlugins:
            - training.snmp.NetBotz
            - zenoss.snmp.NewDeviceMap
            - zenoss.snmp.DeviceMap
            - zenoss.snmp.InterfaceMap
    How I should define this class without zenpack.yaml?

    ------------------------------
    Eduard
    ------------------------------



  • 10.  RE: Creating ZenPack. Question from novice

    Posted 15 days ago
    Thanks a lot for help! This problem was solved.
    There were many obstacles. For example, it was necessary to install PyYAML. But PyYAML do not support old version of Python.

    Now in Zenoss modeling device with a lot of access points(components) that was generated dynamically based on table in SNMP. And perfomance data configured in monitoring template for component as datasource. But there is another problem.
    OIDs in table looks like:
    {path to parameter}.{decimal mac address dot delimited}.{some index(optionally)}
    For example: 1.3.6.1.4.1.14179.2.2.1.1.13.248.11.203.178.49.192.1
    248.11.203.178.49.192 is a MAC
    Datasource without index in the end collecting normally. But if parameter have index in the end of OID, default collector do not work.
    So what I should do?  Create datasource plugin, that extends basic SNMP collector?

    ------------------------------
    Eduard
    ------------------------------



  • 11.  RE: Creating ZenPack. Question from novice

    Posted 13 days ago
    So I am guessing that SNMP is using 248.11.203.178.49.192 as the index (or instance - both terms can be used), to distinguish between the different access points (or components in Zenoss terminology).  So the trick is, in your modeler when you collect the component data, you need to arrange for that index string ( 248.11.203.178.49.192 as an example) to be the snmpindex attribute of your component (see chapter 9.6.2 of the ZenPack Developers' Guide, especially around pages 156 - 158).  It is the snmpindex attribute that determines the SNMP instance that is used to collect performance data.

    I have a couple of ZenPacks that manipulate data to construct the snmpindex attribute - have a look at the Juniper ZenPack modeler at https://github.com/jcurry/ZenPacks.ZenSystems.Juniper/blob/master/ZenPacks/ZenSystems/Juniper/modeler/plugins/JuniperPICMap.py   and the bridgeMib ZenPack - https://github.com/jcurry/ZenPacks.skills1st.bridge/blob/master/ZenPacks/skills1st/bridge/modeler/plugins/BridgeInterfaceMib.py  .  Note that snmpindex should be a string attribute.

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------



  • 12.  RE: Creating ZenPack. Question from novice

    Posted 11 days ago
    Yes, I used snmpindex.  My code for "process" below​: 
    def process(self, device, results, log):
    AP = results[1].get('bsnAPEntry', {})
    log.info('Process Cisco Monitored AP')
    rm = self.relMap()
    for snmpindex, row in AP.items():
    name = row.get('bsnAPDot3MacAddress')
    log.info('MAC: %s, APName: %s, APip: %s', name, row.get('bsnAPName'), row.get('bsnApIpAddress'))
    if not name:
    log.warn('Skipping AP with no mac')
    continue
    rm.append(self.objectMap({
    'id': self.prepId(name),
    'title': row.get('bsnAPName'),
    'snmpindex': snmpindex.strip('.'),
    'AP_Mac': name,
    'APip': row.get('bsnApIpAddress'),
    }))
    ap_cnt = self.objectMap({
    'AP_count': len(AP.keys()),
    })
    return [rm, ap_cnt]
    So, the problem is that datasource(oids) like 1.3.6.1.4.1.14179.2.2.1.1.13.248.11.203.178.49.192.13.0 is not collecting.
    But oids like 1.3.6.1.4.1.14179.2.2.1.1.13.248.11.203.178.49.192.0 collecting.

    ------------------------------
    Eduard
    ------------------------------



  • 13.  RE: Creating ZenPack. Question from novice

    Posted 10 days ago
    In your example:

    So, the problem is that datasource(oids) like 1.3.6.1.4.1.14179.2.2.1.1.13.248.11.203.178.49.192.13.0 is not collecting.
    But oids like 1.3.6.1.4.1.14179.2.2.1.1.13.248.11.203.178.49.192.0 collecting.

    Presumably the first one is a table value and the second a scalar?  The .0 on the end is necessary for scalar values; however I would not expect to see a .0 on the end of an SNMP table value - they almost always start at .1.  So I guess my question is "Where is the .0 coming from"?

    Have you looked at zenperfsnmp.log in detail?  You might try running that in debug mode against your test device:

    zenperfsnmp run -v 10 -d zen42.class.example.org > /tmp/fred 2>&1                           (changing the device to match yours)
    and then inspect /tmp/fred.

    Cheers,
    Jane


    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------



  • 14.  RE: Creating ZenPack. Question from novice

    Posted 8 days ago
    In zenperfsnmp.log i have error like this:
    2018-09-16 19:24:31,462 WARNING zen.zenperfsnmp: Error reading value for ['M5_bldg1_5lvl_2'] (1.3.6.1.4.1.14179.2.2.15.1.21.180.222.49.196.184.160) on 192.168.0.183
    2018-09-16 19:24:31,462 ERROR zen.zenperfsnmp: SNMP get returned empty value: 192.168.0.183 1.3.6.1.4.1.14179.2.2.15.1.21.76.119.109.52.85.160
    In monitoring template I was configured SNMP datasource with OID: 1.3.6.1.4.1.14179.2.2.15.1.21
    So, zenperfsnmp get snmpindex.
    And what I want to collect:
    [root@test ~]# snmpwalk 192.168.0.183:1024 .1.3.6.1.4.1.14179.2.2.15.1.21 | grep 21.180.222.49.196.184.160
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.1 = INTEGER: -94
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.2 = INTEGER: -93
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.3 = INTEGER: -94
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.4 = INTEGER: -87
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.5 = INTEGER: -97
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.6 = INTEGER: -95
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.7 = INTEGER: -96
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.8 = INTEGER: -96
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.9 = INTEGER: -95
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.10 = INTEGER: -96
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.11 = INTEGER: -95
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.12 = INTEGER: -97
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.0.13 = INTEGER: -96
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.36 = INTEGER: -97
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.40 = INTEGER: -93
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.44 = INTEGER: -97
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.48 = INTEGER: -97
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.52 = INTEGER: -97
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.56 = INTEGER: -98
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.60 = INTEGER: -97
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.64 = INTEGER: -97
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.132 = INTEGER: -98
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.136 = INTEGER: -98
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.140 = INTEGER: -98
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.149 = INTEGER: -96
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.153 = INTEGER: -95
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.157 = INTEGER: -97
    RFC1155-SMI::enterprises.14179.2.2.15.1.21.180.222.49.196.184.160.1.161 = INTEGER: -96

    And this is for each component.
    ​​

    ------------------------------
    Eduard
    ------------------------------



  • 15.  RE: Creating ZenPack. Question from novice

    Posted 4 days ago
    Is it possible to collect tables like in example above?

    ------------------------------
    Eduard
    ------------------------------



  • 16.  RE: Creating ZenPack. Question from novice

    Posted 3 days ago
    Absolutely it is possible to collect tabular data but I think, looking at your snmpwalk data, that the index/instance that you need to construct for your snmpindex attribute, is a particularly complicated one.

    It looks like it is more than the MAC address - 180.222.49.196.184.160 - in your latest example; the index has 2 more digits on the end where (again in your example) the first instance has 0.1 on the end and the last has 1.161.  I suspect these are elements that further identify the specific component and you can probably work out where they come from with a very close inspection of the MIB.  Once you have that sorted out, you will need to do a bit more work in your modeler to construct the snmpindex attribute.

    If you really are a ZenPack novice, you have done really well to get this far and I am afraid you have picked a particularly hard MIB / device type to try to model.  You might have another look at the Juniper ZenPack - I have a feeling that had to do some hard work creating snmpindex values in some of the modeler plugins.

    Cheers,
    Jane

    ------------------------------
    Jane Curry
    Skills 1st United Kingdom
    jane.curry@skills-1st.co.uk
    ------------------------------