-
Notifications
You must be signed in to change notification settings - Fork 2
Watcher
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.
static int my_int = 42;
netsnmp_register_read_only_int_scalar("myVariable",
my_oid,
OID_LENGTH(my_oid),
&my_int, NULL);
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.