SNMP Query returns csv string data, how to parse for graph?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Ethernull
Posts: 17
Joined: Sat Aug 04, 2007 8:32 pm

SNMP Query returns csv string data, how to parse for graph?

Post by Ethernull »

Hello,

My snmp walk for associated clients to an AP returns the following data items:

00:05:9e:84:06:15,1106192,1130009,24,no,300,42(-64 dbm)

Representing: MAC,Rxbits,Txbits,mod_speed,power_saving_mode,timeout,SNR(rssi in dbm)

I would like 2 graphs, one with the Rx/Tx bits and one with the SNR/RSSI. Both would have comments with the MAC listed.

This is an SNMP Query (XML)

Any help?

Should I be using a script instead?

Regards,

Ethernull
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I'm not sure, that I understand the output correctly. Please post the whole snmpwalk command (without community string, of course) and the output.
If different output field shows up as different OIDs, it's an SNMP Data Query.
Else, it's a Script Data Query (or a quite complicated VALUE/REGEXP SNMP Data Query). Find help at http://docs.cacti.net/node/225
Reinhard
Ethernull
Posts: 17
Joined: Sat Aug 04, 2007 8:32 pm

Post by Ethernull »

The entire string above is the output value of a single oid, so it sounds like I should use a script query.

Is there an example of walking an snmp oid in a script that I can get started with?

Thanks again, the support here is top notch.

Regards,

Ethernull
Ethernull
Posts: 17
Joined: Sat Aug 04, 2007 8:32 pm

Post by Ethernull »

Here is the output of the script, whuch I modified from your tutorial.

thunderbird@gunsight1:/var/www/web1/web/scripts$ php -q dlb_7000_clients.php 192.168.29.4 index
PHP Warning: Module 'json' already loaded in Unknown on line 0
00:00:13:92:0D:7F:4F,22867,25822,1,NO,300,18(-83:DBM)
00:00:13:92:0B:C9:32,258078,199080,54,NO,300,36(-68:DBM)
00:00:05:9E:84:06:15,157520,124861,24,NO,300,42(-64:DBM)
00:00:0C:41:BD:9A:8C,578,513,11,NO,192,13(-86:DBM)

I need to split each of these into an array inside the script so that each row has the proper output fields.

I think I can figure that part out. The challenge will be graphing the in/out bits and having the graphs stay consistent for each device, because the row order is likely to change periodically, and I dont want to have cacti always take the in/out bits from row 1 and put it on the same graph because that device order may change after a reboot or timeout.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

And what would be the trigger announcing that the sequence of variables in the snmp output has changed?
Reinhard
Ethernull
Posts: 17
Joined: Sat Aug 04, 2007 8:32 pm

Post by Ethernull »

Good question. I would almost need to rerun the query each time it runs to know for sure. Maybe I should have a section in the script where I list my known clients by mac address and then parse the snmp output. Then I can assign each client to the right place in the array programatically prior to outputing the results to Cacti.

THe script would need to run each time cati polls though.

What do you think?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Sounds ugly. But for a final decision, this would require a much deeper insight. You may for sure run an asynchronous script preparing data in some intermediate location (file, database table) and then direct cacti to that intermediate location for fetching data.
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests