Linux
banshee/linux-collection/linux/snmp/
uptime
Time since boot of a Linux host by SNMP, and a warning after a reboot.
by banshee1 installation2 versions
v2Latest
Published on October 28, 2026. One naming convention across collections; documentation completed.
// The time since boot of a Linux host, by SNMP, from hrSystemUptime (HOST-RESOURCES-MIB): the system's,
// not the SNMP agent's (sysUpTime), which restarts each time snmpd does. A reboot shows as a time since
// boot shorter than the "Recent reboot" threshold.
// hrSystemUptime counts hundredths of a second on 32 bits: it wraps every 497 days, which the watch takes
// for a reboot.
need('protocol:snmp');
output('uptime', 'number', array('label' => 'Time since boot', 'unit' => 'h'));
watch.below('rebooted', 'Recent reboot', 'uptime', array('warning' => 0.5));
value('uptime', number.round(snmp.get('1.3.6.1.2.1.25.1.1.0') / 360000, 2));