Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.65k stars 406 forks source link

Ping only device Down #4742

Closed dschultzca closed 2 years ago

dschultzca commented 2 years ago

If I set a device to be monitored with Ping only, its status becomes Down even though the device is reponding. Cacti 1.2.14 on Windows

Device Setup

image

Device Status

image

Debug Log

image

What am I missing? Thanks

xmacan commented 2 years ago

chmod +s /path/to/spine

dschultzca commented 2 years ago

How does that help on Windows?

image

xmacan commented 2 years ago

ups... sorry. I overlooked that it is on windows. It is typical linux spine problem

TheWitness commented 2 years ago

Install the full Cygwin if you have not already and make sure you change the permission on spine

cd /usr/local/spine/bin/
chmod +s spine

Should behave like any other Linux variant.

dschultzca commented 2 years ago

I have no Cygwin installation. I used the Cacti installer for Windows https://forums.cacti.net/viewtopic.php?t=14946
Are you saying I need to switch to a Cygwin compiled version of spine?

TheWitness commented 2 years ago

The guy who does the packaging does that for you. If you install cygwin, it's a simple thing, you can change the permissions.

dschultzca commented 2 years ago

To try and solve this I copied the chmod.exe file from another computer onto the server running Cacti and updated the perrmissions. I now have: -rwsr-sr-x+ 1 Administrators None 659144 Nov 4 2020 spine.exe

If I run spine.exe against my host I see a very curious message in the results indicating I should use a different dectection method such as SNMP.
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] Device[45] PING Result: PING: Device is Unknown or is IPV6. Please use the SNMP ping options only.

C:\Spine>spine -R -H 45 -V 10
...
SPINE: Version 1.2.15 starting
2022-04-29 13:45:02 - SPINE: Poller[1] PID[534] SPINE: Initializing Net-SNMP API
2022-04-29 13:45:02 - SPINE: Poller[1] PID[534] DEBUG: Issues with SNMP Header Version information, assuming old version of Net-SNMP.
2022-04-29 13:45:02 - SPINE: Poller[1] PID[534] SPINE: Initializing PHP Script Server(s)
2022-04-29 13:45:02 - SPINE: Poller[1] PID[534] DEBUG: SS[0] PHP Script Server Routine Starting
2022-04-29 13:45:02 - SPINE: Poller[1] PID[534] DEBUG: SS[0] PHP Script Server About to FORK Child Process
2022-04-29 13:45:02 - SPINE: Poller[1] PID[534] DEBUG: SS[0] PHP Script Server Child FORK Success
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEBUG: SS[0] Confirmed PHP Script Server running using readfd[8], writefd[7]
...
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEVDBG: SQL:SELECT id, hostname, snmp_community, snmp_version, snmp_username, snmp_password, snmp_auth_protocol, snmp_priv_passphrase, snmp_priv_protocol, snmp_context, snmp_engine_id, snmp_port, snmp_timeout, max_oids, availability_method, ping_method, ping_port, ping_timeout, ping_retries, status, status_event_count, status_fail_date, status_rec_date, status_last_error, min_time, max_time, cur_time, avg_time, total_polls, failed_polls, availability, snmp_sysUpTimeInstance, snmp_sysDescr, snmp_sysObjectID, snmp_sysContact, snmp_sysName, snmp_sysLocation FROM host WHERE id=45 AND deleted = ''
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] Device[0] HT[1] Total Time: 0.016 Seconds
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEVDBG: SQL:UPDATE host SET polling_time=1651239903.272 - 1651239903.257 WHERE id=0
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] Device[0] HT[1] DEBUG: HOST COMPLETE: About to Exit Device Polling Thread Function
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEBUG: The Value of Active Threads is 1 for Device ID 0
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] POLLER: Active Threads is 1, Pending is 1
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] Device[45] IPv6 address fd00:0:fe00::b7:fd81 (apktest01)
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] Device[45] PING Result: PING: Device is Unknown or is IPV6.  Please use the SNMP ping options only.
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEVDBG: SQL:UPDATE host SET status='1', status_event_count='4', status_fail_date='2022-04-29 13:30:00', status_rec_date='0000-00-00 00:00:00', status_last_error='PING: Device is Unknown or is IPV6.  Please use the SNMP ping options only.', min_time='0.000000', max_time='0.000000', cur_time='0.000000', avg_time='0.000000', total_polls='545', failed_polls='21', availability='96.1468' WHERE id='45'
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEVDBG: SQL:SELECT snmp_port, count(snmp_port) FROM poller_item WHERE host_id=45 AND rrd_next_step <=0 AND poller_id=1 GROUP BY snmp_port
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEVDBG: SQL:SELECT action, hostname, snmp_community, snmp_version, snmp_username, snmp_password, rrd_name, rrd_path, arg1, arg2, arg3, local_data_id, rrd_num, snmp_port, snmp_timeout, snmp_auth_protocol, snmp_priv_passphrase, snmp_priv_protocol, snmp_context, snmp_engine_id  FROM poller_item WHERE host_id=45 AND rrd_next_step <=0 AND poller_id=1 ORDER by snmp_port
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] Device[45] HT[1] NOTE: There are '1' Polling Items for this Device
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEVDBG: SQL:UPDATE poller_item SET rrd_next_step=IF((rrd_next_step-300)>=0, (rrd_next_step-300), (rrd_step-300)) WHERE host_id=45 AND poller_id=1
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] Device[45] HT[1] Total Time: 0.031 Seconds
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEVDBG: SQL:UPDATE host SET polling_time=1651239903.288 - 1651239903.257 WHERE id=45
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] Device[45] HT[1] DEBUG: HOST COMPLETE: About to Exit Device Polling Thread Function
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEBUG: The Value of Active Threads is 0 for Device ID 45
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] POLLER: Active Threads is 0, Pending is 0
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] SPINE: The Final Value of Threads is 0
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEVDBG: SQL:REPLACE INTO settings (name,value) VALUES ('date',NOW())
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEVDBG: SQL:UPDATE poller_time SET end_time=NOW() WHERE poller_id=1 AND pid=534
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEBUG: Thread Cleanup Complete
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEBUG: SS[0] Script Server Shutdown Started
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEBUG: PHP Script Server Pipes Closed
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEBUG: Allocated Variable Memory Freed
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEBUG: MYSQL Free & Close Completed
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] DEBUG: Net-SNMP Close Completed
2022-04-29 13:45:03 - SPINE: Poller[1] PID[534] Time: 1.1232 s, Threads: 2, Devices: 2

BTW: I have a custom built Windows version of Net-SNMP which has be patched to properly resolve hostnames to IPv6 addresses. My network is made up of ~600 IPv6 only hosts.

What can I try next?

TheWitness commented 2 years ago

Yea, right now spine is ICMP ping is not supported. It's been open for a while under spine. We would be glad to receive a contribution. I would use SNMP if it's available. If not, try TCP ping. It will essentially attempt to connect ot a well known port like AD, and if it can, then it will assume the host is up. Just pick a good port, even if it's a bad port, I think TCP ping will detect that (on Linux for sure), and proceed. The only issue might be on Windows. So, just pick a port that you know is always open.

TheWitness commented 2 years ago

Marking related to https://github.com/Cacti/spine/issues/127 and closing. Continue to comment if you like.

dschultzca commented 2 years ago

Just a note on the proposed solution of setting the setuid bit under Windows/Cygwin.

cd /usr/local/spine/bin/
chmod +s spine

In the code for ping.c, if I'm reaing this correctly there's a preprocessor macro that excludes the code that checks for the setuid bit when the OS is CYGWIN. Is that correct?

dschultzca commented 2 years ago

BTW, trying to use TCP as a dection method still fails as the check for the IPv6 address marks the host down with no attempt to try to connect to the port. Same message as ping only.
PING Result: PING: Device is Unknown or is IPV6. Please use the SNMP ping options only.

TheWitness commented 2 years ago

That might be true re setuid. Patches are always welcome.