Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pavel-durov/pynetwork
Python script - running network downoad/upload/ping reports (created for Raspberry Pi)
https://github.com/pavel-durov/pynetwork
Last synced: about 1 month ago
JSON representation
Python script - running network downoad/upload/ping reports (created for Raspberry Pi)
- Host: GitHub
- URL: https://github.com/pavel-durov/pynetwork
- Owner: Pavel-Durov
- License: mit
- Created: 2017-02-09T09:28:43.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-18T17:44:32.000Z (over 7 years ago)
- Last Synced: 2024-12-06T21:32:47.859Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 433 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pynetwork
Designed to run as Linux crontab job on Raspberry Pi, for network ping/upload/download speed measurements and analysis.
### Install
In a terminal:
```
$ sudo install.sh
```## Usage
In a terminal:
```
$ pynetwork.py -u 2 -d 25 -p 4
```
```
$ pynetwork.py -husage: pynetwork.py [OPTION]...
Network upload, download, ping speed check and notifications script
optional arguments:
-h, --help show this help message and exit
-d D Download speed constraint
-u U Upload speed constraint
-p P Ping speed constraint
```### Possible Configurations (can be found in config.json file):
```
{
//weather configurations
"weather":{
"enabled" : true,
//Sets city code for current city
"openWeatherAPICityCode" : 293397
},
"gdrive" :{
"enabled" : true,
//Sets whether upload daily json data file to Google Drive
"uploadDailyData" : true,
//Sets whether upload daily generated chart to Google Drive
"uploadDailyChart" : true
},
"mail" :{
"enabled": true,
//Sets for attaching chart html to mail
"attachMailChart" : true
},
//Sets whether use real time network check (mainly used for DEBUG purposes)
"realNetworkCheck" : true,
//Sets whether writing local file with the mail html content
"writeLocalHtml" : true,
//Slack config
"slack" : {
"enabled" : true,
"channel" : "#network-updates"
}
}
```
## chart screenshot
![screenshot](chart_screenshot.png)### Uploading collected data to Google Drive
If you want to upload generated files to Google drive,
you'll need to provide ./secrets/client.secret.json file (can be downloaded from your Google API Console)## Data Files:
pynetwork generates data files as its output, so you can browse history of your network performance.
### Pynetwork data directory:
```
Windows:
%APPDATA%\pynetwork
Linux:
$HOME\pynetwork
```* Daily charts can be found under : ./html/[date]_chart.html
```
Data files hierarchy:
./data
/
...
/_data.json (global data file: contains all of the information)
...
/chart_img
...
/.jpeg
...
/html
...
/_chart.html
...
```
### Enviroment veriables
```
// get_current_weather_dataMail secret (separated by semi columns):
PYNETWORK_GMAIL_CREDENTIALS=[receiver-gail-account;agent-gmail-account;agent-gmail-password]// Slack api token
SLACK_PYNETWORK_API_TOKEN=[api-token-string-value]// Weather api token
WEATHER_APP_ID=[open-weather-app-id]
```### Runing as crontab job
In a terminal:
```
$ crontab -e
```
Then enter the following:
```
# Enviroment veriables:SLACK_PYNETWORK_API_TOKEN=[api-token-string-value]
PYNETWORK_GMAIL_CREDENTIALS=[receiver-gail-account;agent-gmail-account;agent-gmail-password]
WEATHER_APP_ID=[open-weather-app-id]# Scheduling job : [Cron Time Format] [script] [parameters]
*/5 * * * * /usr/bin/python3 /home/pynetwork/pynetwork.py -d 20 -u 2 -p 3```
+ This will run pynetwork.py script every 5 minutes