Custom SNMP oid

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
arimus
Posts: 3
Joined: Wed May 17, 2006 12:48 pm

Custom SNMP oid

Post by arimus »

I wanted to graph different aspects of my db server. I made 3 scripts that find values for mysql (Threads Connected, Threads Cached, and Threads Running)

Cacti will find the values based on an snmp query. The problem is that SNMP returns my result as a string.

so i ask:
1. How can i get snmp (or my script that snmp runs) to return the value as an INTEGER?

2. What is the best way to graph this in cacti? I'm trying to just copy the Load Average template, and then just change the data sources that it uses. The graph says "nan", but I believe that is because snmp is returning a STRING value.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Custom SNMP oid

Post by gandalf »

arimus wrote:I wanted to graph different aspects of my db server. I made 3 scripts that find values for mysql (Threads Connected, Threads Cached, and Threads Running)
You surely found the already existing MySQL Templates?
Cacti will find the values based on an snmp query. The problem is that SNMP returns my result as a string.
Cacti accepts numeric "strings"
2. What is the best way to graph this in cacti? I'm trying to just copy the Load Average template, and then just change the data sources that it uses. The graph says "nan", but I believe that is because snmp is returning a STRING value.
You may create a copy of the "SNMP - Generic OID" Data Template and fill in your own OID (Recommendation: rename the data source from snmp_oid to sth more descriptive). Apply this procedure to each of your OIDs. Then build a Graph Template referring to those data sources. As a start, refer to the second to last link of my signature
Reinhard
arimus
Posts: 3
Joined: Wed May 17, 2006 12:48 pm

Post by arimus »

You surely found the already existing MySQL Templates?
Well, I following the Additional Scripts from cacti's page. I found a few php scripts but, I had already written the same thing in "sh". It's just getting it to work via SNMP that i was having trouble with. And unfortunately I think the answer to that is create custom MIB's for MySQL.
refer to the second to last link of my signature
:D You don't appear to have a signature at this moment.[/url]


The other thing im not sure of is how to graph the data sources. when to use gprint/gauge/counter ect. I read up on this a few years ago and it got me more confused then I was when i started. I guess i'll have to read up again

... unless of course some one has graph templates for MySQL??
arimus
Posts: 3
Joined: Wed May 17, 2006 12:48 pm

Post by arimus »

Cacti accepts numeric "strings"
What am i doing wrong then.

I created a datatemplete. For data source type i wasn't sure, so i tried counter, and also absolute.

at the bottom, i have my oid .1.3.6.1.4.1.5000.101.101.1
(which remember i pretty much copied all this from the ucd/net load average.


I tried to graph it but on the graph it says "Connected: 0" (which before it said 'nan')

It works in the cmd line (just as a string rather then int)

Code: Select all

# snmpwalk -v1 -c **** 192.168.1.4 .1.3.6.1.4.1.5000.101.101.1
SNMPv2-SMI::enterprises.5000.101.101.1 = STRING: "1"

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

Post by gandalf »

MySQL Host template: http://forums.cacti.net/viewtopic.php?t=11010

COUNTER may be compared to the mileage of a car (continuously increasing), whereas GAUGE may be compared to the speed (showing the actual data when querying), You may consult http://www.rrdtool.org for more precise description
Reinhard
rsilva
Posts: 2
Joined: Thu Jul 21, 2011 8:08 pm
Location: Brazil

Re: Custom SNMP oid

Post by rsilva »

I'm having the same problem, but i'm trying to graph a a Windows mount poit partition.

I use a script to retrieve the total,used and free space (ech one with one OID) , that works fine with snmpwalk (returns in a string too).
I tried to use SNMP - Generic OID datasource and graph template, but it doesn't work. I created a custom datasource template with SNMP Get for each OID, but in both graph it shows the value -1.#J.

I can't find a template that get Windows mout point values.
Someone knows how I can graph it?

Thanks in advance.
- Rafael -
\|/
.|
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest