# pingmon [![PyPi Status](https://badge.fury.io/py/pingmon.png)](https://badge.fury.io/py/pingmon)
Monitor, record, and graph 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 *python3-tkinter* install:
```
yum install python3-tkinter
```
## Tested on
* MacOS
* Amazon Linux 2
## Installation
```
pip install pingmon
```
## Usage
```
pingmon -i <ip/hostname> [-q]
pinggraph -f CSV_FILE
```
## What it does (standard out and creates three files)
```pingmon``` monitors a ping to a host or ip address, using ```ping -b 56 -c <ip_or_hostname>``` and captures the results. Results go to stdout (by default, can be silenced) and 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 how long 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 recorded 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](https://raw.githubusercontent.com/veloduff/pingmon/master/_images/ping.results.csv.20200229.png)
## 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 (does not save to a file):
```
pinggraph -f CSV_FILE
```
To create a PNG file, use **-c** flag, and the graph file is created in your current working directory:
```
pinggraph -f CSV_FILE -c
```
To show a full day (00:00 to 23:59) on the graph, rather then just the first and last ping times recorded, use the **-d** flag:
```
pinggraph -f CSV_FILE -d
```
## Optional utilities
* `ping-wd.sh` is a shell script that can be run from cron, that checks the internet (with ping) and will reboot the system from which it is run from.
Raw data
{
"_id": null,
"home_page": "https://github.com/veloduff/pingmon",
"name": "pingmon",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "ping monitor",
"author": "Mark Duffield",
"author_email": "veloduff@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8f/c2/fa2d7267e5ea9abbd007fbbfd24c34c68ec04be14741817e0b626f8f6b25/pingmon-1.0.2.tar.gz",
"platform": null,
"description": "# pingmon [![PyPi Status](https://badge.fury.io/py/pingmon.png)](https://badge.fury.io/py/pingmon)\n\nMonitor, record, and graph ping results\n\n\n## License\n\nThis library is licensed under the Apache 2.0 License. \n\n## Requires\n\n* python => 3.7\n* matplotlib \n\nIf 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...``` \n\nExample *python3-tkinter* install:\n\n```\nyum install python3-tkinter\n```\n\n## Tested on\n\n* MacOS\n* Amazon Linux 2\n\n## Installation\n\n```\npip install pingmon \n```\n\n## Usage\n\n```\npingmon -i <ip/hostname> [-q]\n\npinggraph -f CSV_FILE\n\n```\n\n## What it does (standard out and creates three files)\n\n```pingmon``` monitors a ping to a host or ip address, using ```ping -b 56 -c <ip_or_hostname>``` and captures the results. Results go to stdout (by default, can be silenced) and three files are created in the directory that ```pingmon``` is run from:\n\n* ```ping.results.csv.<YYYYMMDD>``` : CSV data that has date.time (YYYYMMDD.HHMMSS) and the how long the ping took in ms.\n* ```ping.results.raw.<YYYYMMDD>``` : The raw output with date.time and a list output from the ping command.\n* ```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 recorded for the entire day.\n\n### Examples of each file:\n\n**CSV File:**\n```\n20200229.161158,26.726\n20200229.161159,28.684\n20200229.161322,39.558\n20200229.161533,26.188\n20200229.161535,36.179\n20200229.161940,25.488\n20200229.162017,28.074\n20200229.162018,32.775\n20200229.170008,31.615\n20200229.170044,33.969\n```\n\n**Raw file:**\n```\n20200229.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', '']\n20200229.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', '']\n20200229.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', '']\n20200229.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', '']\n20200229.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', '']\n20200229.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', '']\n20200229.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', '']\n20200229.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', '']\n20200229.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', '']\n20200229.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', '']\n```\n\n**Plot image from CSV file:**\n\n![Plot image](https://raw.githubusercontent.com/veloduff/pingmon/master/_images/ping.results.csv.20200229.png)\n\n## Create the graph from an existing CSV file\n\nIf 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 (does not save to a file):\n\n```\npinggraph -f CSV_FILE \n```\n\nTo create a PNG file, use **-c** flag, and the graph file is created in your current working directory:\n```\npinggraph -f CSV_FILE -c\n```\n\nTo show a full day (00:00 to 23:59) on the graph, rather then just the first and last ping times recorded, use the **-d** flag:\n```\npinggraph -f CSV_FILE -d\n```\n\n## Optional utilities\n\n* `ping-wd.sh` is a shell script that can be run from cron, that checks the internet (with ping) and will reboot the system from which it is run from. \n\n\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Monitor, record, and display ping results",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/veloduff/pingmon"
},
"split_keywords": [
"ping",
"monitor"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8fc2fa2d7267e5ea9abbd007fbbfd24c34c68ec04be14741817e0b626f8f6b25",
"md5": "89ad4d07301053ffa6f6ca0e2ebeb7ce",
"sha256": "882bf94cf026b4f54e53b75c212c0114323fc8f7214bfe72def6325d781fc021"
},
"downloads": -1,
"filename": "pingmon-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "89ad4d07301053ffa6f6ca0e2ebeb7ce",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 10940,
"upload_time": "2023-09-04T17:23:13",
"upload_time_iso_8601": "2023-09-04T17:23:13.302696Z",
"url": "https://files.pythonhosted.org/packages/8f/c2/fa2d7267e5ea9abbd007fbbfd24c34c68ec04be14741817e0b626f8f6b25/pingmon-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-04 17:23:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "veloduff",
"github_project": "pingmon",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pingmon"
}