Skip to content
Bill Fenner edited this page Aug 30, 2018 · 1 revision

The watcher does what it's named: it watches variables and any time an incoming request is made for the OID assigned to it, it returns the current value of the variable. It is the absolute simplest way to tie a memory address to an OID with a single line of code.

Example Usage

   static int my_int = 42;    netsnmp_register_read_only_int_scalar("myVariable",                                          my_oid,                                          OID_LENGTH(my_oid),                                          &my_int, NULL);

Types Supported

There are a number of scalar convenience functions that can be watched.

 netsnmp_register_ulong_scalar( /* ... */ );  netsnmp_register_read_only_ulong_scalar( /* ... */ );  netsnmp_register_long_scalar( /* ... */ );  netsnmp_register_read_only_long_scalar( /* ... */ );  netsnmp_register_int_scalar( /* ... */ );  netsnmp_register_read_only_int_scalar( /* ... */ );  netsnmp_register_read_only_counter32_scalar( /* ... */ );

The read_only variants should be use if you don't want to support SET operations to the value.

Clone this wiki locally