Examples
banshee/examples-collection/examples/protocols/
snmp-get
Example: snmp.get, one OID; the time since the SNMP agent started.
par banshee1 installation1 version
Publiée le 27 octobre 2026. First version in this collection.
// snmp.get: read one OID. An OID the agent does not have stops the collector, misconfigured.
// The collector reads how long the SNMP agent of a device has been running.
need('protocol:snmp');
output('uptime', 'number', array('label' => 'Time since the agent started', 'unit' => 'd'));
watch.below('restarted', 'Restarted recently', 'uptime', array('warning' => 1));
// sysUpTime.0 (SNMPv2-MIB), in hundredths of a second: 8 640 000 make a day.
$ticks = snmp.get('1.3.6.1.2.1.1.3.0');
value('uptime', number.round($ticks / 8640000, 2));