Hi! All
i already posted this issue on list and trying since last 3 days to fix it
but i could not.
my already open post link is
http://sourceforge.net/mailarchive/forum.php?thread_name=CAFcNWF-BqJ8AUEc_b20JFoSOt2_HM4ZBtE_LYow5uzN_kz%3DUwQ%40mail.gmail.com&forum_name=net-snmp-users
let me explain it here briefly.!
-------------------------------------------
I have my own TEST-ENTERPRISE-MIB, and my purpose is to just display string
against snmpget request.
using mib2c i generated .c and .h files against my MIB.
i changed few lines in teststr.c file. colored lines in below are my own
lines to display string against snmpget request.
----------------------
*/**
* * Note: this file originally auto-generated by mib2c using*
* * $*
* */*
*
*
*#include <net-snmp/net-snmp-config.h>*
*#include <net-snmp/net-snmp-includes.h>*
*#include <net-snmp/agent/net-snmp-agent-includes.h>*
*#include "teststr.h"*
*
*
*/** Initializes the teststr module */*
*void*
*init_teststr(void)*
*{*
* const oid teststr_oid[] = { 1,3,6,1,4,1,100,1,1 };*
*
*
* DEBUGMSGTL(("teststr", "Initializing\n"));*
*
*
* netsnmp_register_scalar(*
* netsnmp_create_handler_registration("teststr", handle_teststr,*
* teststr_oid, OID_LENGTH(teststr_oid),*
* HANDLER_CAN_RONLY*
* ));*
*}*
*
*
*int*
*handle_teststr(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.
*/*
* *
*
*
*
*
*//**************************************MY
LINES**********************//////////*
*
*
* int i;*
* char test[] = "test123";*
* char *ptest[sizeof(test)];*
* for (i = 0; i < sizeof(test); i++)*
* ptest[i]= &test[i];*
* printf("Value is %s....",*ptest);*
*
*
*
*
*
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
*
* //snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,*
* // /* XXX: a pointer to the scalar's data
*/,*
* // /* XXX: the length of the data in
bytes */);*
*
*
* *
* switch(reqinfo->mode) {*
*
*
* case MODE_GET:*
*
*
*///////////////////*********************************MY
LINE*******************////////////////////////////*
* snmp_set_var_typed_value(requests->requestvb,
ASN_OCTET_STR,ptest[0],strlen(ptest[0]));*
*
*
*
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
*
* break;*
*
*
*
*
* default:*
* /* we should never get here, so this is a really bad error */*
* snmp_log(LOG_ERR, "unknown mode (%d) in handle_teststr\n",
reqinfo->mode );*
* return SNMP_ERR_GENERR;*
* }*
*
*
* return SNMP_ERR_NOERROR;*
*}*
----------------
after changing in code, i recompile the source code of net-snmp
.snmptranslate shows following result
*
*
*snmptranslate TEST-ENTERPRISE-MIB::teststr*
*
*
*TEST-ENTERPRISE-MIB::teststr*
*----------------------------------------------------------*
*
*
*snmptranslate -Of 1.3.6.1.4.1.100.1.1*
.iso.org.dod.internet.private.enterprises.test.testsystem.teststr
---------------------------------------------
but when i run snmpget i got follwing error
snmpget -v 1 localhost -c public teststr.0
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: TEST-ENTERPRISE-MIB::teststr.0
-------------------------------------------------------------
But snmpget works fine for sysName.0 and for other objects .....
any one guide me what is wrong? what i should do fix this error? i am tring
last few days but still no success.
Thanks and Regards
*
*
*
*
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users