Downtime broken

My validate & daily are clean and up to date. My problem, quite simply, is that all my devices show less than 5 minute down times, no matter how long they have been down. Uptime is fine! Availability graphs are dead.

Usually, I try to look into the problem a bit myself, but I’m not even sure where to start looking on this one. Hints appreciated.

I’m not much good at PHP, but I’ll put in an honest effort.

117 if (! $device['status'] && ! $device['last_polled']) {
118     $uptime = __('Never polled');
119     $uptime_text = 'Uptime';
120 } else {
121     $uptime = (\LibreNMS\Util\Time::formatInterval($device['status'] ? $device['uptime'] : time() - strtotime($device['last_polled'])));
122     $uptime_text = ($device['status'] ? 'Uptime' : 'Downtime');
123 }
124 
125 if ($uptime) {
126     echo "<div class='row'><div class='col-sm-4'>$uptime_text</div><div class='col-sm-8'>$uptime</div></div>";
127 }
128 

Ok, so time() - strtotime($device[‘last_polled’].

+----------+--------+---------------------+
| uptime   | status | last_polled         |
+----------+--------+---------------------+
| 85976339 |      0 | 2023-10-06 13:40:50 |
+----------+--------+---------------------+
1 row in set (0.000 sec)

MariaDB [librenms]> select uptime,status,last_polled from devices where device_id = '1059';
+----------+--------+---------------------+
| uptime   | status | last_polled         |
+----------+--------+---------------------+
| 85976339 |      0 | 2023-10-06 13:50:52 |
+----------+--------+---------------------+
1 row in set (0.000 sec)

Wait, what?! Why’s my last_polled incrementing when status is 0? If last_polled keeps changing, how’s time - last_polled supposed to mean anything? Therein, I suppose, lies my problem. What updates this? Hints appreciated.

Fix is already merged Calculate downtime from device_outages table by murrant · Pull Request #15397 · librenms/librenms · GitHub

1 Like

Thanks much, Tony! Appreciate the work you guys do, & this beer’s on me!
-helpdeskdan

P.S.
Thought maybe my availability graphs that broke on Wed were related to this, but I suppose that will warrant a new thread.

Aware of that already, and I can reproduce it, no need for a thread. :slight_smile:

1 Like

Thanks, Tony!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.