ZenPacks and JSON API

Expand all | Collapse all

COMMAND data source testing failing

  • 1.  COMMAND data source testing failing

    Posted 09-11-2018 01:47 AM

    We have created a sample COMMAND data source with below attributes:

    Name: test
    Enabled: True
    Event Class: /Cmd/Fail
    Parser: Auto
    Severity: Warning
    Cycle Time (seconds): 300
    Use SSH: False (Unchecked)
    Event Key:
    Command Template: /usr/bin/env echo TEST

    When I am testing this command data source by Clicking on Test button, it is failing with below error.

    Preparing Command...
    Executing command
    /usr/bin/env [args omitted]
    against lxvcw1oc201
    Exception while performing command: <br />
    <pre>Traceback (most recent call last):
    File "/opt/zenoss/Products/ZenUI3/browser/command.py", line 149, in stream
    File "/opt/zenoss/Products/ZenModel/BasicDataSource.py", line 242, in testDataSourceAgainstDevice
    remoteCollector = device.getPerformanceServer().id != 'localhost'
    AttributeError: 'NoneType' object has no attribute 'id'
    Please help me in solving the issue. Thanks in advance.

    Bharat Kumar K

  • 2.  RE: COMMAND data source testing failing

    Posted 09-11-2018 03:43 AM
    I have set up the same template and it works for me - no errors.  I am on Zenoss 4.2.5 SUP 743.

    Bear in mind that a template expects to provide performance data - ie numbers - and your test script doesn't.  Different versions of Zenoss may respond differently to this scenario.  For example, if there is a datapoint in your performance  template then it probably will fail.

    Try running zencommand standalone in debug against your test device, for example:

    zencommand run -v 10 -d zen42.class.example.org > /tmp/fred 2>&1

    and then inspect /tmp/fred, looking for the name of your template.

    If you want a little test script that runs a COMMAND and generates numbers, I use the following:

    [zenoss@zen42 local]$ cat test.sh

    # Nagios return codes

    # Nagios format echos information and status followed by pipe |
    # followed by <var name>=<value> tuples
    # Note that Zenoss datapoints must match these var names exactly
    echo "This is a test - status OK | timevar=74s sizevar=9B percentvar=10% countervar=123c"
    exit $exitstatus

    Make sure that your template has datapoints for timevar, sizevar percentvar and countervar.


    Jane Curry
    Skills 1st United Kingdom