Thomas Andrews wrote:

> Thanks Dave. I'm now using the example at 
> http://net-snmp.sourceforge.net/dev/agent/watched_8c-example.html
> 
> Unfortunately compiling that code gives me this error:
> 
>    undefined reference to `netsnmp_init_watcher_info6'

Okay, I figured out that netsnmp_init_watcher_info6() is not available 
in any version of snmpd for debian, so I cobbled the following together:

void init_watched_string(void)
{
     static char my_string[256] = "bla bla bla";

     oid my_registration_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 2, 1, 3 };
     netsnmp_handler_registration *reginfo;
     static netsnmp_watcher_info *watcher_info;

     reginfo = netsnmp_create_handler_registration("my example string",
             my_handler,
             my_registration_oid,
             OID_LENGTH(my_registration_oid),
             HANDLER_CAN_RWRITE);
     watcher_info = netsnmp_create_watcher_info( &my_string,
             strlen(my_string), ASN_OCTET_STR, WATCHER_MAX_SIZE);
     netsnmp_register_watched_scalar(reginfo, watcher_info);
}

I can now get my_string using a GET but I get this warning when I do so:

   NET-SNMP-EXAMPLES-MIB::netSnmpExampleString = Wrong Type (should be
   INTEGER): STRING: "bla bla bla"

What am I doing wrong here? Does netsnmp_register_watched_scalar() only 
work with INTEGERs ??

This is the command I use for the GET:

   snmpget -v1 -c private localhost netSnmpExampleString

Many thanks,
Thomas

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
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

Reply via email to