The code appears to be ok, but the string isn't registered:
$ snmpget -v2c -c public localhost 1.3.6.1.4.1.10.1.2
SNMPv2-SMI::enterprises.10.1.2 = No Such Instance currently exists at this OID
Here is the code (pretty the same of your code):
netsnmp_handler_registration *reg = netsnmp_create_handler_registration( "notificationEmail", NULL, notificationEmail_oid, OID_LENGTH(notificationEmail_oid), HANDLER_CAN_RWRITE);
netsnmp_watcher_info *winfo = netsnmp_create_watcher_info( notificationEmail, 255,//strlen(notificationEmail), ASN_OCTET_STR, WATCHER_FIXED_SIZE);
The snmptranslate says that my MIB is ok.
Dave Shield wrote:
But I need to register a string. Searching the documentation I haven't found a function looking like netsnmp_register_string_instance and I coudn't find an example explaining how to register a string using the generic netsnmp_register_instance
Have a look at "netsnmp_register_watched_scalar" Not only does this cope with string values as well as integer ones, it also handles scalar objects correctly (which netsnmp_register_instance doesn't - in particular requests for an invalid instance)
I'm afraid there aren't any examples using it (yet!), but it'd be something like:
netsnmp_handler_registration *reg = netsnmp_create_handler_registration( "myStringObject", NULL, myStringObjectOID, OID_LENGTH(myStringObjectOID), HANDLER_CAN_RONLY); netsnmp_watcher_info *winfo = netsnmp_create_watcher_info( myStringObject, strlen(myStringObject), ASN_OCTET_STR, WATCHER_FIXED_SIZE); netsnmp_register_watched_scalar( reg, winfo );
Dave
--
Nao ha fatos, so interpretacoes.
-- Friedrich Nietzsche Pessimista e a pessoa que foi obrigada a ouvir muitos otimistas.
-- Don Marquis
O que e assaltar um banco comparado com fundar um banco?
-- Bertold Brecht
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
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
