snmpwalk commandline options for custom data query?

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

Moderators: Developers, Moderators

Post Reply
anoebis
Posts: 4
Joined: Wed Sep 12, 2012 8:49 am

snmpwalk commandline options for custom data query?

Post by anoebis »

Hello all,

I have created a custom data query to get information for Squid into Cacti and this works fine in a small setup (3 clients connected to Squid). However, when using the same query in a large setup (~1000 clients), it only returns 3 or 4 clients. I already found the root cause for this by running snmpwalk manually. Apparently, snmpwalk does not like the fact that the indexes returned by Squid (i.e. the IP addresses of the connected clients) are not increasing. This causes snmpwalk to show partial output:

Code: Select all

$ snmpwalk -v 2c -m /usr/share/squid3/mib.txt -c public localhost:3401 1.3.6.1.4.1.3495 | grep -i cacheClientHttp.*Kb
Error: OID not increasing: SQUID-MIB::cacheClientAddressType.192.168.10.4
 >= SQUID-MIB::cacheClientAddressType.127.0.0.1
No problem here, as it can easily be solved by adding the -Cc-option to snmpwalk:

Code: Select all

$ snmpwalk -v 2c -m /usr/share/squid3/mib.txt -c public localhost:3401 1.3.6.1.4.1.3495 -Cc | grep -i cacheClientHttp.*Kb
SQUID-MIB::cacheClientHttpKb.192.168.10.1 = Counter32: 13100
SQUID-MIB::cacheClientHttpKb.192.168.10.4 = Counter32: 2545
SQUID-MIB::cacheClientHttpKb.127.0.0.1 = Counter32: 13080
SQUID-MIB::cacheClientHTTPHitKb.192.168.10.1 = Counter32: 0
SQUID-MIB::cacheClientHTTPHitKb.192.168.10.4 = Counter32: 0
SQUID-MIB::cacheClientHTTPHitKb.127.0.0.1 = Counter32: 0
So now my question is: how can I tell Cacti to use the -Cc-option when running snmpwalk? Because without this option, my custom data query is rather useless...
Soup
Cacti User
Posts: 66
Joined: Tue Aug 07, 2012 10:02 am

Re: snmpwalk commandline options for custom data query?

Post by Soup »

Can you post again without the grep?

I don't have a solution, just curious about the problem.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: snmpwalk commandline options for custom data query?

Post by gandalf »

You can do so by editing lib/snmp.php. Search for the snmp* commands and you will know what to do ...
This won't change things for spine, unfortunately ... so only cmd.php will work then
R.
anoebis
Posts: 4
Joined: Wed Sep 12, 2012 8:49 am

Re: snmpwalk commandline options for custom data query?

Post by anoebis »

@Soup: below is the full output, with numerical OID's:

Code: Select all

# snmpwalk -v 2c -c public localhost:3401 1.3.6.1.4.1.3495
iso.3.6.1.4.1.3495.1.1.1.0 = INTEGER: 175336
iso.3.6.1.4.1.3495.1.1.2.0 = INTEGER: 940720
iso.3.6.1.4.1.3495.1.1.3.0 = Timeticks: (131978910) 15 days, 6:36:29.10
iso.3.6.1.4.1.3495.1.2.1.0 = STRING: "<email address>"
iso.3.6.1.4.1.3495.1.2.2.0 = STRING: "squid"
iso.3.6.1.4.1.3495.1.2.3.0 = STRING: "3.1.6"
iso.3.6.1.4.1.3495.1.2.4.0 = STRING: "ALL,1"
iso.3.6.1.4.1.3495.1.2.5.1.0 = INTEGER: 256
iso.3.6.1.4.1.3495.1.2.5.2.0 = INTEGER: 1024
iso.3.6.1.4.1.3495.1.2.5.3.0 = INTEGER: 95
iso.3.6.1.4.1.3495.1.2.5.4.0 = INTEGER: 90
iso.3.6.1.4.1.3495.1.2.6.0 = STRING: "<hostname>"
iso.3.6.1.4.1.3495.1.3.1.1.0 = Counter32: 10425
iso.3.6.1.4.1.3495.1.3.1.2.0 = Counter32: 275010
iso.3.6.1.4.1.3495.1.3.1.3.0 = INTEGER: 201308
iso.3.6.1.4.1.3495.1.3.1.4.0 = INTEGER: 915
iso.3.6.1.4.1.3495.1.3.1.5.0 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.1.6.0 = INTEGER: 308384
iso.3.6.1.4.1.3495.1.3.1.7.0 = Gauge32: 61949
iso.3.6.1.4.1.3495.1.3.1.8.0 = Timeticks: (0) 0:00:00.00
iso.3.6.1.4.1.3495.1.3.1.9.0 = Gauge32: 0
iso.3.6.1.4.1.3495.1.3.1.10.0 = Gauge32: 1005
iso.3.6.1.4.1.3495.1.3.1.11.0 = Gauge32: 100
iso.3.6.1.4.1.3495.1.3.1.12.0 = Gauge32: 19
iso.3.6.1.4.1.3495.1.3.1.13.0 = Gauge32: 41
iso.3.6.1.4.1.3495.1.3.2.1.1.0 = Counter32: 9385
iso.3.6.1.4.1.3495.1.3.2.1.2.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.3.2.1.3.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.3.2.1.4.0 = Counter32: 54694
iso.3.6.1.4.1.3495.1.3.2.1.5.0 = Counter32: 491845
iso.3.6.1.4.1.3495.1.3.2.1.6.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.3.2.1.7.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.3.2.1.8.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.3.2.1.9.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.3.2.1.10.0 = INTEGER: 42976
iso.3.6.1.4.1.3495.1.3.2.1.11.0 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.1.12.0 = Counter32: 432006
iso.3.6.1.4.1.3495.1.3.2.1.13.0 = Counter32: 39156
iso.3.6.1.4.1.3495.1.3.2.1.14.0 = Gauge32: 940720
iso.3.6.1.4.1.3495.1.3.2.1.15.0 = Gauge32: 3
iso.3.6.1.4.1.3495.1.3.2.2.1.1.1 = INTEGER: 1
iso.3.6.1.4.1.3495.1.3.2.2.1.1.5 = INTEGER: 5
iso.3.6.1.4.1.3495.1.3.2.2.1.1.60 = INTEGER: 60
iso.3.6.1.4.1.3495.1.3.2.2.1.2.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.2.5 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.2.60 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.3.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.3.5 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.3.60 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.4.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.4.5 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.4.60 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.5.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.5.5 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.5.60 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.6.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.6.5 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.6.60 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.7.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.7.5 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.7.60 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.8.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.8.5 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.8.60 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.9.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.9.5 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.9.60 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.10.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.10.5 = INTEGER: 100
iso.3.6.1.4.1.3495.1.3.2.2.1.10.60 = INTEGER: 100
iso.3.6.1.4.1.3495.1.3.2.2.1.11.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.11.5 = INTEGER: 0
iso.3.6.1.4.1.3495.1.3.2.2.1.11.60 = INTEGER: 0
iso.3.6.1.4.1.3495.1.4.1.1.0 = Gauge32: 920
iso.3.6.1.4.1.3495.1.4.1.2.0 = Counter32: 134153
iso.3.6.1.4.1.3495.1.4.1.3.0 = Counter32: 79298
iso.3.6.1.4.1.3495.1.4.1.4.0 = Gauge32: 0
iso.3.6.1.4.1.3495.1.4.1.5.0 = Counter32: 86
iso.3.6.1.4.1.3495.1.4.1.6.0 = Counter32: 18432
iso.3.6.1.4.1.3495.1.4.1.7.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.4.1.8.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.4.2.1.0 = Gauge32: 3
iso.3.6.1.4.1.3495.1.4.2.2.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.4.2.3.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.4.2.4.0 = Gauge32: 0
iso.3.6.1.4.1.3495.1.4.2.5.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.4.2.6.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.4.2.7.0 = Counter32: 0
iso.3.6.1.4.1.3495.1.4.3.1.0 = Counter32: 10052
iso.3.6.1.4.1.3495.1.4.3.2.0 = Counter32: 10052
iso.3.6.1.4.1.3495.1.4.3.3.0 = Counter32: 3
iso.3.6.1.4.1.3495.1.5.1.3.1.1 = INTEGER: 1
iso.3.6.1.4.1.3495.1.5.1.3.2.1 = STRING: "localhost"
iso.3.6.1.4.1.3495.1.5.1.3.3.1 = INTEGER: 1
iso.3.6.1.4.1.3495.1.5.1.3.4.1 = STRING: "127.0.0.1"
iso.3.6.1.4.1.3495.1.5.1.3.5.1 = INTEGER: 8118
iso.3.6.1.4.1.3495.1.5.1.3.6.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.5.1.3.7.1 = INTEGER: 2
iso.3.6.1.4.1.3495.1.5.1.3.8.1 = INTEGER: 1
iso.3.6.1.4.1.3495.1.5.1.3.9.1 = Counter32: 0
iso.3.6.1.4.1.3495.1.5.1.3.10.1 = Counter32: 0
iso.3.6.1.4.1.3495.1.5.1.3.11.1 = Counter32: 24256
iso.3.6.1.4.1.3495.1.5.1.3.12.1 = INTEGER: 0
iso.3.6.1.4.1.3495.1.5.1.3.13.1 = Counter32: 0
iso.3.6.1.4.1.3495.1.5.1.3.14.1 = Counter32: 23290
iso.3.6.1.4.1.3495.1.5.1.3.15.1 = Counter32: 19843
iso.3.6.1.4.1.3495.1.5.2.2.1.192.168.10.1 = INTEGER: 1
iso.3.6.1.4.1.3495.1.5.2.2.1.192.168.10.4 = INTEGER: 1
iso.3.6.1.4.1.3495.1.5.2.2.1.127.0.0.1 = INTEGER: 1
Error: OID not increasing: iso.3.6.1.4.1.3495.1.5.2.2.1.192.168.10.4
 >= iso.3.6.1.4.1.3495.1.5.2.2.1.127.0.0.1
@gandalf: thanks for the suggestion, I will look into it. Right now I'm not using spine (yet), though I might consider doing so in the future (once I've added a lot more hosts to my Cacti-installation).

Is this some kind of bug that might be fixed in a future version of Cacti (e.g. by adding the possibility to enable snmpwalks -Cc-option in Cacti's preferences)?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: snmpwalk commandline options for custom data query?

Post by gandalf »

anoebis wrote:@gandalf: thanks for the suggestion, I will look into it. Right now I'm not using spine (yet), though I might consider doing so in the future (once I've added a lot more hosts to my Cacti-installation).
Well, in fact that's some C constant that has to be added, if I remember correctly. So no rocket sience here. But that has to be changed, that's for sure.
Is this some kind of bug that might be fixed in a future version of Cacti (e.g. by adding the possibility to enable snmpwalks -Cc-option in Cacti's preferences)?
I'm not sure if that mantis ticket has been entered already. Then, you may add your +1; else create it. That will definitively increase the chance to have it sooner or later
R.
anoebis
Posts: 4
Joined: Wed Sep 12, 2012 8:49 am

Re: snmpwalk commandline options for custom data query?

Post by anoebis »

Apparently, the bug has already been reported a couple of months ago (#0002225: Make -Cc SNMP option configurable (system wide or per device). I'll add my comments to that bug.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: snmpwalk commandline options for custom data query?

Post by gandalf »

Yep, saw it. Perhaps I'll include that in 089
R.
pezarza
Posts: 4
Joined: Sat Oct 26, 2013 6:24 am

Re: snmpwalk commandline options for custom data query?

Post by pezarza »

I have the same problem

I changed /var/www/html/lib/snmp.php with -Cc, but doesn´t work
if (read_config_option("snmp_version") == "ucd-snmp") {
/* escape the command to be executed and vulnerable parameters
* numeric parameters are not subject to command injection
* snmp_auth is treated seperately, see above */
$temp_array = exec_into_array(cacti_escapeshellcmd(read_config_option("path_snmpwalk")) . " -v$version -t $timeout -r $retries " . cacti_escapeshellarg($hostname) . ":$port $snmp_auth " . cacti_escapeshellarg($oid));
}else {
if (file_exists($path_snmpbulkwalk) && ($version > 1) && ($max_oids > 1)) {
$temp_array = exec_into_array(cacti_escapeshellcmd($path_snmpbulkwalk) . " -O Qn $snmp_auth -v $version -t $timeout -Cc -r $retries -Cr$max_oids " . cacti_escapeshellarg($hostname) . ":$port " . cacti_escapeshellarg($oid));
}else{
$temp_array = exec_into_array(cacti_escapeshellcmd(read_config_option("path_snmpwalk")) . " -O Qn $snmp_auth -v $version -t $timeout -Cc -r $retries " . cacti_escapeshellarg($hostname) . ":$port " . cacti_escapeshellarg($oid));
}
}
this is my conf:
cacti.jpg
cacti.jpg (137.96 KiB) Viewed 1719 times
please... any help?

thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests