Debug the smart ping in the cmc.log
- Increase the log to debug
Checkin the cmc.log (as site user)
grep -e <IP> -e <HOSTNAME> ~/var/log/cmc.log | grep -e "smartping timeout" -e "received p"
Livestatus query
With this command you can check the check interval, retry interval, smart ping timeout and the max check attempts of the host:
Please replace host_name = Myhost with the affected Checkmk Hosts
OMD[mysite]:~$ lq "GET hosts\nColumns: host_name check_interval retry_interval smartping_timeout max_check_attempts state state_type\nFilter: host_name = Myhost"
Debugging the smart ping via cli
OMD[workshop]:~/local/bin$ OMD[workshop]:~$ ~/lib/cmc/icmpreceiver |python3 ~/local/bin/dump.py |grep --line-buffered "127.0.0.1" |perl -pe 'use POSIX strftime; print strftime "[%Y-%m-%d %H:%M:%S] ", localtime' [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:24] 127.0.0.1 [2021-09-29 11:44:25] 127.0.0.1
or
~/lib/cmc/icmpreceiver |python3 ./dump.py |grep --line-buffered "127.0.0.1" |ts -i
if perl is not possible, you will find here : https://unix.stackexchange.com/questions/26728/prepending-a-timestamp-to-each-line-of-output-from-a-command
the content of ./dump.py
#!/usr/bin/env python3 import ipaddress import sys def main() -> None: while True: addr = ipaddress.ip_address(sys.stdin.buffer.read(4)) sys.stdout.write(f"{addr!s}\n") sys.stdout.flush() if __name__ == "__main__": main() ~
you can use this oneline instead of the ./dump.py:
~/lib/cmc/icmpreceiver | perl -ne 'map { CORE::say join "." => unpack "CCCC", pack "L", $_ } unpack "L*";'
Related articles