How to parse SNMP output fields?

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

Moderators: Developers, Moderators

Post Reply
mazaj
Posts: 13
Joined: Wed Mar 23, 2005 6:01 am

How to parse SNMP output fields?

Post by mazaj »

Hello all.

I have created an snmp oid on remote site that gives me information about Memory usage.

# snmpget -c public -v 1 192.168.1.11 .1.3.6.1.4.1.2021.51.101.1
UCD-SNMP-MIB::ucdavis.51.101.1 = STRING: "Total:4086512 Used:3887820"

Notice I want to have 2 values in 1 (like Load Averages work output: 1min:0.09 5min:0.09 10min:0.08 )

After this I created a Data Input Method with 2 output fields (almost like Load Averages).
Image

Then I want to create Data Template for this, but i don't see Output Field drop down menu in Data Source Item Section.

Image

but in Load Averages all ok.

Image

How can i combine 2 values via SNMP into 1 graph? Plz help! I'm stuck.

--mazaj
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

Hi

it would be easier to have a script which returns 2 values on 2 lines, like this :

Code: Select all

$ snmpget -c public -v 1 192.168.1.11 .1.3.6.1.4.1.2021.51.101
4086512
3887820
Then you can get the first value with the OID .1.3.6.1.4.1.2021.51.101.1, and the second value with .1.3.6.1.4.1.2021.51.101.2
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
mazaj
Posts: 13
Joined: Wed Mar 23, 2005 6:01 am

Post by mazaj »

1) ok... but how do I create a graph for these 2 oids?? how will data template look ??

2) Maybe someone still know how to do parsing in SNMP ? maybe this is a bug ?
User avatar
fmangeant
Cacti Guru User
Posts: 2345
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

Post by fmangeant »

mazaj wrote:1) ok... but how do I create a graph for these 2 oids?? how will data template look ??
Take a look at the "Interface - Traffic" data template, it polls 2 OIDs.
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]
mazaj
Posts: 13
Joined: Wed Mar 23, 2005 6:01 am

Post by mazaj »

My SNMP oids are not indexed :(
Although I didn't managed to parse multiple values in SNMP, i created a script that pulls those two values via SNMP. For Cacti this is Script query.

Output looks like

Code: Select all

# /bin/sh /usr/hosting/belly/html/cacti/scripts/custom_linux_memory.sh 1 public 192.168.1.11
Total:4086512 Used:1782464
So I managed two use 1 SNMP query for multiple values via script.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest