Fri Apr 28, 2023 6:39 pm
Hello,
We created a solution that works for us as a workaround to the counters being 32bit. This involved using a script and while I would not recommend making this available to devices where SNMP has not been restricted, the script is below. This will produce an uptime that is accurate to 5 seconds. This generates a number that is in seconds, so a basic snmp script to convert it to years, months, weeks, days, hours, minutes and seconds can be easily written and report and/or alert on uptimes. The example is from one of our RB3011 units, but this works on all units that are running at least 6.34 routerOS and switchOS. We have this running on CRS units, CCR units and RB units.
Hope this is useful. It certainly has been for us.
The SNMP OID is 1.3.6.1.4.1.14988.1.1.18.1.1.2.2
# model = RouterBOARD 3011UiAS
# serial number = 8EEB08F6B003
/system script
add dont-require-permissions=no name=seconds owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
":global a (\$a+5); :put \$a;"
add dont-require-permissions=no name=uptime_data owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
":global a; :put \$a;"
/system scheduler
add comment="Runs the seconds script that updates the variable \"a\" by 5 seconds" interval=5s name=Uptime_run on-event=seconds policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-time=startup