Skip to main content

Monitor, record, and display ping results

Project description

pingmon PyPi Status

Monitor, record, and display ping results

License

This library is licensed under the Apache 2.0 License.

Requires

  • python => 3.7
  • matplotlib

If you are using linux, you will probably need to install python3-tkinter for the pinggraph command to display the plot (building the file will still work). It's required if you see the error matplotlib is currently using agg as background ... non-gui...

Example install:

yum install python3-tkinter

Tested on

  • MacOS
  • Amazon Linux 2

Installation

pip install pingmon 

Usage

pingmon <ip_or_hostname>

What it does (creates three files)

pingmon monitors a ping to a host or ip address, using ping -c <ip_or_hostname> and captures the results. Three files are created in the directory that pingmon is run from:

  • ping.results.csv.<YYYYMMDD> : CSV data that has date.time (YYYYMMDD.HHMMSS) and the time the ping took in ms.
  • ping.results.raw.<YYYYMMDD> : The raw output with date.time and a list output from the ping command.
  • ping.results.csv.<YYYYMMDD>.png : A high resolution PNG graph that is created when the day is over (23:59:59 is the last entry) that shows a plot of each ping for the entire day.

Examples of each file:

CSV File:

20200229.161158,26.726
20200229.161159,28.684
20200229.161322,39.558
20200229.161533,26.188
20200229.161535,36.179
20200229.161940,25.488
20200229.162017,28.074
20200229.162018,32.775
20200229.170008,31.615
20200229.170044,33.969

Raw file:

20200229.235949,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=17.110 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 17.110/17.110/17.110/0.000 ms', '']
20200229.235950,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=21.047 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 21.047/21.047/21.047/0.000 ms', '']
20200229.235951,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=30.030 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 30.030/30.030/30.030/0.000 ms', '']
20200229.235952,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=18.898 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 18.898/18.898/18.898/0.000 ms', '']
20200229.235954,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=24.082 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 24.082/24.082/24.082/0.000 ms', '']
20200229.235955,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=35.844 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 35.844/35.844/35.844/0.000 ms', '']
20200229.235956,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=28.508 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 28.508/28.508/28.508/0.000 ms', '']
20200229.235957,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=20.307 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 20.307/20.307/20.307/0.000 ms', '']
20200229.235958,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=33.487 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 33.487/33.487/33.487/0.000 ms', '']
20200229.235959,['PING 8.8.8.8 (8.8.8.8): 56 data bytes', '64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=22.552 ms', '', '--- 8.8.8.8 ping statistics ---', '1 packets transmitted, 1 packets received, 0.0% packet loss', 'round-trip min/avg/max/stddev = 22.552/22.552/22.552/0.000 ms', '']

Plot image from CSV file:

Plot image

Create the graph from an existing CSV file

If you ran the pingmon command and want to see the graph from a CSV file, you can run pinggraph. To display the graph with python run this:

pinggraph <csv_file>

To create a PNG file, use True as the second postional argument, and the file is created in your current working directory:

pinggraph <csv_file> True 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pingmon-0.0.10.tar.gz (9.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page