Device dependancy and fast ping not working

Hello!

I have been unable to get Fast ping working(1min)(No alert, only from 5m poller) and I think it is connected with the inability for the script(PingCheck.php) to empty tier 1 and procede down the tree.

The result is a huge number of ‘Leftover devices, this shouldn’t happen:’ (running ./ping.php -vd) and a few ‘devices left in tier’.

Dependancies
Tier 0 (36):
Tier 1 (9):
Tier 2 (179)
Tier 3 (187):
Tier 4 (70):
Tier 5 (35):
Tier 6 (22):
Tier 7 (4):

For testing added echo “Not empty tier $this->current_tier\n”; (line197 PingCheck.php) and I keep getting ‘Not empty tier 1’ messages never advancing.

Anyone?

By the way, How long does it take for dependancies to update after a change?

Tried removing dependancies from a switch that I can test with but the tiers dont update (./ping.php -v)


My alert is macros.device_down = 1 AND devices.status_reason = “icmp” with:

Max: 1
Delay: 90
Interval: 0


====================================

Component Version
LibreNMS 1.70.1-31-ged41e6eed
DB Schema 2020_10_12_095504_mempools_add_oids (191)
PHP 7.4.3
Python 3.8.5
MySQL 10.3.25-MariaDB-0ubuntu0.20.04.1
RRDTool 1.7.2
SNMP NET-SNMP 5.8

====================================

[OK] Composer Version: 2.0.8
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] Your local git contains modified files, this could prevent automatic updates.
[FIX]:
You can fix this with ./scripts/github-remove
Modified Files:
app/Jobs/PingCheck.php

When I put the test switch on a different dependancy the switch immediate changed tier and the parent switch left tier 0 (standalone) for correct tier 1 but when I deleted the dependancy both switches stayed in there new tiers instead of both going to tier 0.

Sounds like a bug.

I’d love an answer to this. It’s something I have spent hours and hours trying to get working properly. I know nothing about PHP but I have been able to make vast improvements to the script although it’s still not working fully as it should, sometimes my dependencies work fine sometimes it skips a few.

A quick note, even with dependencies set you will still see all the outage alerts in Libre, it only affects what is pushed out of a transport.

The problem to me looks like a MYSQL speed problem. Fping loads a list of IPs and starts scanning one by one. It scans the first one, and runs a load of MySQL stuff on it, (the record data function) this takes time. In the process of running the MySQL stuff, doing moves to the next device in the list, but because record data function is still running it can’t run on the next IP, so any devices pinged during the record data happening get skipped. This confuses the hell out of the script and you end up with a bunch of missed devices.

To improve things, I moved part of the script so that alert rules only get run if the status has changed. This helped a bit. To improve further I changed the going delay, so it waits 100ms (to give MySQL a chance to so it’s thing) before pinging the next device. Downside, instead of taking 4s to ping all my devices it takes 45s.

It still goes wrong sometimes even after that. I don’t know why some of the MYSQL queries take a huge amount of time. No matter how much tuning I try (based off info from Google because my knowledge onbotbis very limited), I can’t get it to work faster.

There is either a big flaw in the ping script, or a big flaw in the MySQL database. Either way, I can’t seem to find any support to help resolve the problem.

Thanks for your response. My knowledge about PHP is close to nothing too. It is however good to know somebody else notice that something seems wrong. Lessen the probability that I simply misconfigured.

When I have some time over I will try decipher the script. Definitive want this feature working. Do you have a fork on github with your changes so that I can compare?

Anyone else With impression good or bad of fping (with or without using dependancy) are welcome to give them and the number of devices pinged.