snmpget output parser

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Post Reply
user
Posts: 3
Joined: Mon Aug 01, 2005 6:52 pm

snmpget output parser

Post by user »

Hello.
I've some managed switch which have Counter64 type of IF-MIB::ifInOctets.* instead of Counter32 and snmpget work like this:

Code: Select all

# snmpget -v 2c -c public 192.168.200.2 .1.3.6.1.2.1.2.2.1.10.5
IF-MIB::ifInOctets.5 = Wrong Type (should be Counter32): Counter64: 5600637353944
It appends "Wrong Type (should be Counter32): ", which I think is becoming a parse error in Cacti and it shows "U" during updates in logs.
Can You take this case into account in the future versions of Cacti?
PS. My version of Cacti is 0.8.6f (last at this moment), if this matters.
PPS. Switch have nothing at IF-MIB::ifHCInOctets.*, i.e. where really Counter64 should be, as I know.
user
Posts: 3
Joined: Mon Aug 01, 2005 6:52 pm

patch

Post by user »

Here is a patch, attached. As I understand, function strip_quotes only cut nonnumeric data at the end of the output. This adds cutting beginning stuff.
Attachments
cacti-strip_quotes.patch
patch
(392 Bytes) Downloaded 289 times
user
Posts: 3
Joined: Mon Aug 01, 2005 6:52 pm

my bad

Post by user »

Hmm... things are more complex, that I thought. My patch brokes data inputs returning several values.
So, I can only suggest this workarond-like patch. I hope it will not brake something else. :)
Attachments
cacti-strip_quotes.patch
patch
(411 Bytes) Downloaded 313 times
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

When I looked at you initial patch, I thought to myself, "this is going to break other stuff". And it did, you beat me to posting.. :)

Your second patch is a much better approach. And btw, I have this problem with some IBM agents, but I didn't think of parsing it out, I called IBM and told them to fix the MIB. 8)
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
paulbeard206
Cacti User
Posts: 150
Joined: Sat Jul 30, 2005 2:15 pm

would using the Ov flags work?

Post by paulbeard206 »

It might trim off all that extraneous text: I don't have a 64 bit device to test it but have used that combination before.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Fixing this in the poller will cause a 5-10% performance penalty during polling. I would rather see the vendor fix it.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Ok, you said 5% to 10%, that is a problem, 1% to 2%, would not be such a problem.

Thanks,
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

I could do it and then you could test? :) Would you like cmd.php or cactid? ;)

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
jrichardson
Cacti User
Posts: 66
Joined: Tue Mar 22, 2005 10:11 am

Post by jrichardson »

What is the fix for this?

I've got a cisco 6509 and when I try to poll the 64bit counters, I also get the "Wrong Type (should be Counter32):" text.

I'm running 0.8.6c.
jrichardson
Cacti User
Posts: 66
Joined: Tue Mar 22, 2005 10:11 am

Post by jrichardson »

What is the state of this patch?

I've got 0.8.6f-r1 installed on a gentoo box and it's got:

Code: Select all

function strip_quotes($result) {
        /* first strip all single and double quotes from the string */
        $result = strtr($result,"'","");
        $result = strtr($result,'"','');

        /* clean off ugly non-numeric data */
        if ((!is_numeric($result)) && ($result != "U")) {
                $len = strlen($result);
                for($a=$len-1; $a>=0; $a--){
                        $p = ord($result[$a]);
                        if (($p > 47) && ($p < 58)) {
                                $result = substr($result,0,$a+1);
                                break;
                        }
                }
        }

        return($result);
}
but on a 0.8.6c box it's simply:

Code: Select all

function strip_quotes($result) {
        /* first strip all single and double quotes from the string */
        $result = strtr($result,"'","");
        $result = strtr($result,'"','');

        return($result);
}

en3my
Posts: 2
Joined: Thu Nov 17, 2005 6:07 am

Post by en3my »

'lo there...

Same problem here with some rubytech switches...

As i understand, the patch (cacti-strip_quotes.patch (c) user) works if i use cmd.php as a poller only... what about cactid?
I could do it and then you could test? Would you like cmd.php or cactid?
Gimme a cactid fix ;)

Thanks.

PS: while i was writing this msg, TheWitness has got an avatar =P
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

The current Cactid does this as well. We are planning another release soon to correct some issues though.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
en3my
Posts: 2
Joined: Thu Nov 17, 2005 6:07 am

Post by en3my »

Mmm? ... I've upgraded to the latest cacti/cactid yesterday... :/

CACTID 0.8.6f Copyright 2002-2005 by The Cacti Group

Cacti 0.8.6g + all the patches from cacti.net

===

cacti.log(i have a "generic oid template" data source what tries to fetch the value using single oid, .1.3.6.1.2.1.2.2.1.10.26):
...
11/17/2005 01:19:10 PM - CACTID: Poller[0] Host[52] DS[830] WARNING: Result from SNMP not valid. Partial Result: Wrong Type (should b...
..

... and the output of "snmpwalk -v 2c -c xxx qqq.www.www.eee .1.3.6.1.2.1.2.2.1.10.26":
IF-MIB::ifInOctets.26 = Wrong Type (should be Counter32): Counter64: 1067884768808

PS: Thanks for superfast reply!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest