Discussion:
Multiple values in Data Point from one OID
Yasha Zislin
2011-10-25 17:56:53 UTC
Permalink
Yasha Zislin [http://community.zenoss.org/people/yzislin] created the discussion

"Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62121#62121

--------------------------------------------------------------
Hi,

I am retreiving a single OID information from a device, which returns a list of entries like this.
1.2.3 = 111
1.3.3 = 112
1.4.3 = 111

Values are integers. I wan to have a sum of all values in the list be in one data point which later I can graph.
I read that something like this can be accomplished with RPN formula. I am just not sure how.

Please help

Thanks.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62121#62121]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
dpetzel
2011-10-25 18:40:20 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62124#62124

--------------------------------------------------------------
Sounds like you might be after http://community.zenoss.org/docs/DOC-10224 http://community.zenoss.org/docs/DOC-10224
You could potentially accomplish this via an alias and RPN chapter 6.2.6 in the admin guide.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62124#62124]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Yasha Zislin
2011-10-25 18:46:40 UTC
Permalink
Yasha Zislin [http://community.zenoss.org/people/yzislin] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62125#62125

--------------------------------------------------------------
How do I get that Zenpack installed?

Also, what If I dont know how long the list is?

Thanks.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62125#62125]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
dpetzel
2011-10-25 19:09:53 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62157#62157

--------------------------------------------------------------
See chapter 13 in the admin guide for how to install a ZenPack. I'm not sure what options you have if you don't know how large the list is
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62157#62157]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Yasha Zislin
2011-10-26 14:34:56 UTC
Permalink
Yasha Zislin [http://community.zenoss.org/people/yzislin] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62187#62187

--------------------------------------------------------------
Thanks for the info dpetzel. I got the zenpack installed and I've tried adding a datasource.
One problem though.
It looks like I cannot use SNMP OIDs in the formula type of datapoint. Is that correct?
If so, this would work for me.

Thanks again.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62187#62187]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
dpetzel
2011-10-26 23:02:58 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62193#62193

--------------------------------------------------------------
I don't use this pack personally, but I think you're approaching it wrong. You need to define data sources and data points for the OIDs Think of it as a one-to-one mapping of datapoint to OID. Then using the ZenPack you can add the datapoints. I believe this anchored link should bring you to the appropriate spot in the thread which breaks this down in pretty good detail.
http://community.zenoss.org/docs/DOC-10224#comment-3947 http://community.zenoss.org/docs/DOC-10224#comment-3947

Again the trick is to first get your individual OIDs collected via datapoints. From there you can use the pack to do the adding you want.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62193#62193]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Yasha Zislin
2011-10-27 13:54:04 UTC
Permalink
Yasha Zislin [http://community.zenoss.org/people/yzislin] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62232#62232

--------------------------------------------------------------
I understand what you are saying.
It is just weird that there is not a simpler way of doing it.
I have about 10 entries which contain 7 list items. That means that I have to create 70 datapoints and then 10 datapoints which will sum up the list items.

So datapoints just simply dont understand list of items (ie array)?

Thanks.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62232#62232]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
dpetzel
2011-10-27 13:59:59 UTC
Permalink
dpetzel [http://community.zenoss.org/people/dpetzel] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62222#62222

--------------------------------------------------------------
Its not up to the datapoint to understand the list. The data source potentially....but I'm not 100% sure. I'm not saying it can't be done, but I personally am not aware of an alternative way to accomplish what your asking about without writing code and/or scripts

One (not simple) option is to write your own custom command data sources. IE a script to SNMPGET your values, and return only the aggregate value you want in Nagios/Cacti format
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62222#62222]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Yasha Zislin
2011-10-27 20:04:07 UTC
Permalink
Yasha Zislin [http://community.zenoss.org/people/yzislin] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62266#62266

--------------------------------------------------------------
I see. I guess I will create all these datasources and one for the sum of the others.
I got to the point where I am creating Formula data type but my screen shot looks different from the documentation of that screen shot.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62266#62266]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Dave Heller
2011-10-28 04:09:42 UTC
Permalink
Dave Heller [http://community.zenoss.org/people/daveh] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62256#62256

--------------------------------------------------------------
To do this with a command data source, as suggested above, something like this work.  If the values you want to sum are contiguous from an snmpwalk perspective you can probably do it with a one-liner; that is, the code contained entirely in the "Command Template" field of the COMMAND datasource.  Otherwise you may want to write a script and call the script from the Command Template. 

Assuming the data you want to present is device-level data (as opposed to component-level data), create a new Monitoring Template under the appropriate device class and bind it to the the device class (i.e. Toggle template binding).  Then create a new data COMMAND datasource with whatever name you choose, then create a datapoint of name "valueSum", for example.  Leave the Component field blank.  For Command Template add:

/usr/bin/snmpwalk -OqvU -${device/zSnmpVer} -c${device/zSnmpCommunity} ${device/manageIp} 1.3.6.1.4.1.1.1.1.1 | (sum=0; while read value; do sum=$$(( $$sum + $$value )); done; echo $$sum) | sed 's/^/Anything | valueSum=/'

This will snmpwalk your mib (adjust the OID accordingly), sum the resulting data and output it in "nagios standard" format.  Note the part after the bar '|' must match the name of your datapoint.  the part before the bar can be anything.  Note also the '$$' escapes for the shell variables.  If you moved it to a separate shell script you would not need those.

Add the datpoint to an existing graph or create a new graph and add it.

When you test the datasource with the test button you should get a result like:

    Preparing Command...
    Executing command /usr/bin/snmpwalk -OqvU -v2c -cpublic 10.10.10.10 1.3.6.1.4.1.1.1.1.1 | (sum=0; while read value; do sum=$(( $sum + $value )); done; echo $sum) | sed 's/^/Anything | valueSum=/' against mydevice.here.com
    Anything | valueSum=6000
    DONE in 1 seconds

If you want to test it at the command line, first check that the snmpwalk behaves as expected.  Note the -O option should restrict it to returning ONLY the integer values; no OID data, no units:

    [***@mybox ~]$ /usr/bin/snmpwalk -OqvU -v1 -cpublic 10.10.10.10 1.3.6.1.4.1.1.1.1.1
    1000
    2000
    3000

Then test the full command.  Note, no $$ escapes here:

    [***@mybox ~]$ /usr/bin/snmpwalk -OqvU -v1 -cpublic 10.10.10.10 1.3.6.1.4.1.1.1.1.1 | (sum=0; while read value; do sum=$(( $sum + $value )); done; echo $sum) | sed 's/^/Anything | valueSum=/'
    Anything | valueSum=6000

If that works, you should be able to get a successful test within your command data source. 

Finally, note you can alter the value of the resulting datapoint in the usual way, by editing the Graph datapoint.  Say this was millivolts and you wanted to convert to volts.  Add the RPN expression: "1000,/" to the graph datapoint.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62256#62256]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Yasha Zislin
2011-10-28 15:54:56 UTC
Permalink
Yasha Zislin [http://community.zenoss.org/people/yzislin] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62281#62281

--------------------------------------------------------------
Awesome. Thanks Dave.

This is exactly what I need.

I've tested it and it works like a charm.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62281#62281]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Dave Heller
2011-10-28 16:42:06 UTC
Permalink
Dave Heller [http://community.zenoss.org/people/daveh] created the discussion

"Re: Multiple values in Data Point from one OID"

To view the discussion, visit: http://community.zenoss.org/message/62292#62292

--------------------------------------------------------------
Glad to help. B-)
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/62292#62292]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...