Device dependancy and fast ping not working

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.