Why I always meet "No Such Object availab le on this agent at this OID"?
"lihj" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
I want to test a private mib named TEST-MIB.txt.And then I use the command "MIBS=+FOMSytem mib2c hVersion" .Later ,the hVersion.c and the hVersion.h were auto-generated.So,I interpolation some at the 'XXX'.I copy the two file to the mibgroup.And use "./configure prefix=/home/lihj/net-snmp --with-mib-modules="hVersion"",and "make", "make install" .If I use "snmptranslate -On -M +FOMSystem -IR hVersion",the screen displayed ".1.3.6.1.4.1.5651.1.1".I known it was right.But when i used "snmpget -v2c -c public localhost .1..1.3.6.1.4.1.5651.1.1.0".The result was "SNMPv2-SMI::enterprises.5651.1.1=No Such Object available on this agent at this OID".why? All the files are affixed! Please could you help me solve this problem!I hope I have provided sufficient information to illustrate what I am trying to do and really do hope you can help me!I look forward to your reply...
TEST-MIB.txt
(text/plain, 462 B)
FOMSystem DEFINITIONS ::= BEGIN
IMPORTS
enterprises
FROM SNMPv2-SMI;
taicom OBJECT IDENTIFIER ::={enterprises 5651}
fom OBJECT IDENTIFIER
::= { taicom 1 }
hVersion OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"System Hardware Version"
DEFVAL { 1 }
::= { fom 1 }
END
hVersion.c
(application/octet-stream, 2.4 KB)
/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.scalar.conf,v 1.9 2005/01/07 09:37:18 dts12 Exp $
*/
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "hVersion.h"
///////////////////////////by bestlihj/////////
/*
Global variables to store data we're interesting in serving:
static char * ;
static size_t ustSSSimpleString_len;
static time_t lastChanged=0;
/*
variable2 ustScalarSet_variables:
this variable defines function callbacks and type return information
for the ustScalarSet mib section
*/
/////////////////////////////////////////////////////
/** Initializes the hVersion module */
void
init_hVersion(void)
{
static oid hVersion_oid[] = { 1, 3, 6, 1, 4, 1, 5651, 1, 1 };
DEBUGMSGTL(("hVersion", "Initializing\n"));
netsnmp_register_scalar(netsnmp_create_handler_registration
("hVersion", handle_hVersion, hVersion_oid,
OID_LENGTH(hVersion_oid), HANDLER_CAN_RONLY));
}
int
handle_hVersion(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
{
/*
* We are never called for a GETNEXT if it's registered as a
* "instance", as it's "magically" handled for us.
*/
/*
* a instance handler also only hands us one request at a time, so
* we don't need to loop over a list of requests; we'll only get one.
*/
static long *long_ret; /* for everything else */
switch (reqinfo->mode) {
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *)
/* XXX: a pointer to the scalar's data */
long_ret,
sizeof(long_ret)
/*
* XXX: the length of the data in bytes
*/ );
break;
default:
/*
* we should never get here, so this is a really bad error
*/
snmp_log(LOG_ERR, "unknown mode (%d) in handle_hVersion\n",
reqinfo->mode);
return SNMP_ERR_GENERR;
};
return SNMP_ERR_NOERROR;
}
hVersion.h
(application/octet-stream, 332 B)
/* * Note: this file originally auto-generated by mib2c using * : mib2c.scalar.conf,v 1.9 2005/01/07 09:37:18 dts12 Exp $ */ #ifndef HVERSION_H #define HVERSION_H /* * function declarations */ void init_hVersion(void); Netsnmp_Node_Handler handle_hVersion; #endif /* HVERSION_H */