Skip to content

Commit 8a5a1b7

Browse files
authored
Stop missing icmp-ping.rrd files from stopping alerts (librenms#19904)
1 parent dd575be commit 8a5a1b7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

LibreNMS/Alert/RunAlerts.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,12 @@ public function describeAlert($alert)
128128
$obj['status'] = $device->status;
129129
$obj['status_reason'] = $device->status_reason;
130130
if (ConnectivityHelper::pingIsAllowed($device)) {
131-
$last_ping = Rrd::lastUpdate(Rrd::name($device->hostname, 'icmp-perf'));
131+
try {
132+
$last_ping = Rrd::lastUpdate(Rrd::name($device->hostname, 'icmp-perf'));
133+
} catch (\Exception $e) {
134+
Log::error("Error getting last ping for device {$device->hostname}: {$e->getMessage()}");
135+
$last_ping = null;
136+
}
132137
if ($last_ping) {
133138
$obj['ping_timestamp'] = $last_ping->timestamp;
134139
$obj['ping_loss'] = Number::calculatePercent($last_ping->get('xmt') - $last_ping->get('rcv'), $last_ping->get('xmt'));

0 commit comments

Comments
 (0)