Next up in my small monitor app project is to learn how to get snmp data from
devices at constant intervals. I expanded the example application
(http://www.net-snmp.org/wiki/index.php/TUT:Simple_Application) into
something that can be described with a little pseudocode:
init_snmp( "foo" )
while {
for each device, do {
ss[device] <- snmp_open( session[device] )
pdu[device] <- snmp_pdu_create( SNMP_MSG_GET )
read_objid( oid[device], temp_oid, len )
snmp_add_null_var( pdu[device], temp_oid, len )
}
for each device, do {
status = snmp_synch_response ( ss[device], pdu[device], response )
if (status == OK) {
do stuff with response
}
snmp_free_pdu( response )
response <- NULL
free( ss[device] )
ss[device] <- NULL
}
for each device, do {
snmp_close ( ss[device] )
}
sleep (n_seconds)
}
It seems to work OK, but then again when I left it running on a server it had
quietly exited after maybe 20 minutes. Although I armed it with debugging
printfs I didn't see any specific error in the log, it had simply quit. But
my most important question at this point is if this whole approach is
appropriate for my needs or if I need to study some helpful manual.
Thanks,
Juuso
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders