cacti icon indicating copy to clipboard operation
cacti copied to clipboard

Change logging message around remote agent timeout

Open bmfmancini opened this issue 1 year ago • 2 comments

When the remote agent times out it's not always due to the remote poller being down it could be a slow link

However the logging message shows the following

Warning: file_get_contents(http:// blah. Blah. Blah/cacti/remote_agent.php?action=ping&host_id=5): Failed to open stream: HTTP request failed! in /var/www/html/cacti/lib/functions.php on line 6114
ERROR: Failed to connect to remote collector.

Instead we should capture a timeout scenario VS the poller offline maybe check the heartbeat status of the poller??

In the above case the link had high latency so the remote agent timeout had to be adjusted

bmfmancini avatar Oct 14 '24 21:10 bmfmancini

@bmfmancini, any updates?

TheWitness avatar Oct 21 '24 14:10 TheWitness

Not yet I will test it soon

On Mon, Oct 21, 2024, 10:35 TheWitness @.***> wrote:

@bmfmancini https://github.com/bmfmancini, any updates?

— Reply to this email directly, view it on GitHub https://github.com/Cacti/cacti/issues/5862#issuecomment-2426868448, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGEXTDQADGSUUA4H3E2OJLZ4UGJJAVCNFSM6AAAAABP5X7OSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRWHA3DQNBUHA . You are receiving this because you were mentioned.Message ID: @.***>

bmfmancini avatar Oct 21 '24 15:10 bmfmancini

@bmfmancini. bump!

TheWitness avatar Nov 09 '24 19:11 TheWitness

Just tested it on 1.3 pulled down this morning

2024-11-09 15:02:58 - PHP ERROR Backtrace: (CactiShutdownHandler())
2024-11-09 15:02:58 - ERROR PHP ERROR: Uncaught ErrorException: file_get_contents(http://192.168.2.3/cacti/remote_agent.php?action=ping&host_id=2): Failed to open stream: Connection refused in /var/www/html/cacti/lib/functions.php:6682 Stack trace: #0 [internal function]: {closure}() #1 /var/www/html/cacti/lib/functions.php(6682): file_get_contents() #2 /var/www/html/cacti/lib/api_device.php(1651): call_remote_data_collector() #3 /var/www/html/cacti/host.php(157): api_device_ping_device() #4 {main} thrown in file: /var/www/html/cacti/lib/functions.php on line: 6682
2024-11-09 15:02:58 - SQL Backtrace: (/host.php[76]:form_save(), /host.php[311]:api_device_save(), /lib/api_device.php[1299]:db_execute_prepared()) 

bmfmancini avatar Nov 09 '24 20:11 bmfmancini

Stupid thingy. I have to create a custom error handler then.

TheWitness avatar Nov 09 '24 20:11 TheWitness

@bmfmancini, should work properly now.

TheWitness avatar Nov 10 '24 20:11 TheWitness