Wrong Type (should be INTEGER): Gauge32: 0

Mike.Perler____radisys.com Mike.Perler____radisys.com
Wed Aug 15 23:54:14 CEST 2001


Nick,

In SNMP, Unsigned32 and Gauge32 are the same type. What you need to do is 
use SnmpInt32 instead of SnmpUInt32 for Integer32 objects in your MIB (and 
also sNMP_SYNTAX_INT32 for the MibLeaf constructor argument).

Mike





"Nick Woods" <nwoods at pivia.com>
08/15/2001 05:21 PM

 
        To:     "Agent++ (E-mail)" <agentpp-dl____fock.de>
        cc: 
        Subject:        RE: Wrong Type (should be INTEGER): Gauge32: 0


Just a follow up to this message.  It looks like the main problem that I
had was a signed unsigned mismatch.  It still seems to think that the
values are Gauge32 objects but when my Mib file has them specified as
Unsigned32 instead of Integer32 the complaints go away.  Any idea why it
still seems to think that the object is a Gauge32 or is that nothing at
all?

Nick

-----Original Message-----
From: Nick Woods 
Sent: Wednesday, August 15, 2001 1:31 PM
To: Agent++ (E-mail)
Subject: Wrong Type (should be INTEGER): Gauge32: 0


I've written an application using Agent++ for monitoring purposes.
Everything works great, and I am able to retrieve all of the values for
my application successfully and correctly.  However, when I use the Net
SNMP tools like snmpwalk I get the error message "Wrong Type (should be
INTEGER): Gauge32: <and the value here>" for each of my values.  The mib
file that I am specifying for snmpwalk to use has all of these values
specified as Integer32 which is where it is getting the information that
these values should be integers.  What I don't understand however and am
curious to know is why it seems to think that the values as being sent
from my application are of type Gauge32.

I have a class that is derived from MibLeaf and when constructed
executes the MibLeaf constructor with arguments similar to the
following:

MibLeaf("1.3.6.1.4.1.7620.2.2.1.0", READONLY, sNMP_SYNTAX_UINT32)

I have also overriden the update value to do something similar to the
simplified version that follows:

void MySNMPDynamicMibLeaf::updateValue()
{
                 switch ( get_syntax() )
                 {
                                 // All unique switchable values appear in 
this switch
                                 // statement.  Some have the same value 
and so are not
                                 // duplicated
                                 case sNMP_SYNTAX_INT32: // INT, UINT32
                                 case sNMP_SYNTAX_CNTR32:
                                 case sNMP_SYNTAX_GAUGE32:
                                 case sNMP_SYNTAX_TIMETICKS:
                                 {
                                                 *((SnmpUInt32*)value) = 
SnmpUInt32( 12345 );
                                                 break;
                                 }

                                 case sNMP_SYNTAX_CNTR64:
                                 {
                                                 *((Counter64*)value) = 
Counter64( 678910 );
                                                 break;
                                 }

                                 case sNMP_SYNTAX_OCTETS:
                                 case sNMP_SYNTAX_BITS:
                                 case sNMP_SYNTAX_OPAQUE:
                                 {
                                                 *((OctetStr*)value) = 
OctetStr( "New String" );
                                                 break;
                                 }
 
                                 case sNMP_SYNTAX_IPADDR:
                                 {
                                                 *((IpAddress*)value) = 
IpAddress( "1.2.3.4" );
                                                 break;
                                 }

                                 case sNMP_SYNTAX_OID:
                                 {
                                                 PvString sTmpPvStr;
                                                 m_pCallback->getString( 
sTmpPvStr );
                                                 *((Oid*)value) = Oid( 
"1.2.3.4.5.0" );
                                                 break;
                                 }
 
                                 default:
                                                 break;
                 }
}

So in the case that I retrieve my value I would expect it to simply give
me the value of the integer 12345 and not complain about it being a
Gauge32 but it seems to.  Is there something else I need to do with
respect to typing?  Is there a problem with snmpwalk that you know of?
Any help would be much appreciated as I don't want this to keep
confusing people and making them think that something is wrong.  It
doesn't seem to complain about my octet strings, just the integers.

Thanks,

Nick







More information about the AGENTPP mailing list