Cron job for fast-ping (ping.php) don't work correct

Hi,

Trying to get the extention Fast-ping (sub-minute) to work.

When I’m simulate a device down (disconnect it from the network), I expect to see an notification in web-gui in ~30 seconds. This is not working :frowning:

I have followed the instruction:

$config[‘ping_rrd_step’] = 30;
$config[‘fping_options’][‘retries’] = 2;
$config[‘fping_options’][‘timeout’] = 500;
$config[‘fping_options’][‘interval’] = 500;

cron.d/librenms (note I have >> /tmp/ping instead of /dev/null, this is for debugging only)

          • librenms /opt/librenms/ping.php >> /tmp/ping 2>&1
          • librenms sleep 30 && /opt/librenms/ping.php >> /tmp/ping 2>&1
          • librenms sleep 15 && /opt/librenms/alerts.php >> /tmp/ping 2>&1
          • librenms sleep 45 && /opt/librenms/alerts.php >> /tmp/ping 2>&1

This is the ouput from /tmp/ping during 3minutes…

Pinged 7 devices in 0.01s
Pinged 7 devices in 0.01s
Pinged 7 devices in 0.02s
Pinged 7 devices in 0.01s
Pinged 7 devices in 0.01s
Pinged 7 devices in 0.01s

No detection that the device (one of the 7) is unreachable…

An ALERT is triggered after by “/opt/librenms/cronic /opt/librenms/poller-wrapper.py 16” in cron, but it runs every 5minutes…

But when I trigger the /opt/librenms/ping.php script (not through cron) it works…

Device is disconnected from network
[xxx@LTC9 ~]$ sudo -u librenms /opt/librenms/ping.php
Device 10.69.192.22 changed status to down, running alerts
Rule #2 (Devices up/down (ICMP)):
Status: ALERT
Pinged 7 devices in 2.54s

Devices is reconnected to network again…
[xxx@LTC9 ~]$ sudo -u librenms /opt/librenms/ping.php
Device 10.69.192.22 changed status to up, running alerts
Rule #2 (Devices up/down (ICMP)):
Status: OK
Pinged 7 devices in 0.16s

Devices is reconnected to network again… (running the script one more time)
[xxx@LTC9 ~]$ sudo -u librenms /opt/librenms/ping.php
Pinged 7 devices in 0.16s

Version 1.45-8-g7a422e9 - Tue Oct 30 2018 22:50:30 GMT+0100
DB Schema #270
Web Server nginx/1.12.2
PHP 7.2.10
MySQL 5.5.60-MariaDB
RRDtool 1.4.8

Thanks in advance !

I solved my problem with adding following to my cron config (/etc/cron.d/librenms)

SHELL=/bin/bash
PATH=/opt/librenms:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin