From Net-SNMP Wiki
Jump to: navigation, search
Net-SNMP MIB Helper
Documentation: doxygen API
Code: agent/helpers/watcher.c
Other Helpers: Agent Helpers

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;
                                         &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.