Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Debugging the smart ping via cli

For using this command, you have to create (as site user) a file dump.py in ~/local/bin. The file should look like this: Debugging of smart ping

Code Block
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'

or you can use the command with the dump.py

Code Block
 ~/lib/cmc/icmpreceiver |python3 ./dump.py |grep --line-buffered  "127.0.0.1" |ts -i

...

Code Block
#!/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 online instead of the ./dump.py:

...