Infpyng can ping multiple hosts at once and write data to InfluxDB -- Alternative to Smokeping
10K+
Infpyng is a powerful python script which use fping to probe endpoint through ICMP and parsing the output to Influxdb. The result can then be visualize easily through Grafana.
Benchmark
Those tests were performed from CentOS 8 with 1 CPU and 2 GB of memory
| IP to ping | IP reachable | Finished in |
|---|---|---|
| 474 | 454 | 11 seconds |
| 1299 | 1197 | 13 seconds |
| 2653 | 2552 | 28 seconds |
| 3388 | 3262 | 32 seconds |
Screenshots

Grafana 6.7.x
Influxdb 1.8.x
The basic configuration is embedded in the image of the Docker you will have to create the files config.toml and hosts.toml from your host which will then have to be pushed in the image.
The config.toml file will contain your custom settings and especially the hostname/user/pass of your InfluxDB.
The hosts.toml file will have the list of all the hosts to ping.
Note: For the following commands remember to adapt the tag version (example: infpyng:1.0.0) according to the image of the docker you are using.
Pull the image from hub.docker
# docker pull oijkn/infpyng
Run the container to add your config/hosts files
docker run -d \
--name infpyng \
--hostname docker-infpyng \
--restart unless-stopped \
--mount src=/dir/from/host/infpyng/config,target=/infpyng/config,type=bind \
--mount src=/dir/from/host/infpyng.log,target=/infpyng/infpyng.log,type=bind \
--log-driver=journald \
--log-opt tag="{{.Name}}" \
--env TZ=Europe/Paris \
oijkn/infpyng
Note: You must have config files on your host and edit them according to your environment and adapt the
TZ=Europe/Parisdepending on your location.
The command started using docker exec only runs while the container’s is running, and it is not restarted if the container is restarted.
Retrieve container id
# docker ps -a
| CONTAINER ID | IMAGE | COMMAND | CREATED | STATUS | PORTS | NAMES |
|---|---|---|---|---|---|---|
| 5591dbd111e5 | oijkn/infpyng:1.0.0 | "python infpyng.py" | 13 seconds ago | Up 11 seconds | infpyng |
Retrieve container id
# docker exec -it 5591dbd111e5 sh
Show log file
/app/infpyng # cat /var/log/infpyng.log
2020-05-28 08:54:16 root INFO :: Settings loaded successfully
2020-05-28 08:54:16 root INFO :: Init InfluxDB successfully
2020-05-28 08:54:16 root INFO :: Starting Infpyng Multiprocessing v1.0.0
2020-05-28 08:54:16 root INFO :: Polling time every 300s
2020-05-28 08:54:16 root INFO :: Total of targets : 5
2020-05-28 08:54:16 root INFO :: Multiprocessing : 40
2020-05-28 08:54:16 root INFO :: Buckets : 5
2020-05-28 08:54:20 root INFO :: Targets alive : 5
2020-05-28 08:54:20 root INFO :: Targets unreachable : 0
2020-05-28 08:54:20 root INFO :: Data written to DB successfully
2020-05-28 08:54:20 root INFO :: Finished in : 4.44 seconds
2020-05-28 08:54:20 root INFO :: ---------------------------------------
Multi-container Docker app built from the following services:
Useful for quickly setting up a monitoring stack for performance testing. Please refer to this link Infpyng-stack to create a performance testing environment in minutes.
Download Infpyng project
# cd /dir/from/host/
# git clone https://github.com/oijkn/infpyng.git
# pip install -r requirements.txt
Ensure correct permission on *.py files
# chmod -R +x /somewhere/in/your/host/infpyng/*.py
Edit your custom settings (conf + hosts)
# vi /dir/from/host/infpyng/config/config.toml
# vi /dir/from/host/infpyng/config/hosts.toml
Run Infpyng python script
# python /dir/from/host/infpyng/infpyng.py &
Grafana allows you to query and visualize metrics stored in InfluxDB.
You can use my dashboard example or you can create your own.
By default the Infpyng logs are located in /var/log/infpyng.log
2020-05-26 09:19:41 root INFO :: Settings loaded successfully
2020-05-26 09:19:41 root INFO :: Init InfluxDB successfully
2020-05-26 09:19:41 root INFO :: Starting Infpyng Multiprocessing v1.0.0
2020-05-26 09:19:41 root INFO :: Polling time every 300s
2020-05-26 09:19:41 root INFO :: Total of targets : 1883
2020-05-26 09:19:41 root INFO :: Multiprocessing : 40
2020-05-26 09:19:41 root INFO :: Buckets : 47
2020-05-26 09:19:51 root INFO :: Targets alive : 1883
2020-05-26 09:19:51 root INFO :: Targets unreachable : 0
2020-05-26 09:19:51 root INFO :: Data written to DB successfully
2020-05-26 09:19:51 root INFO :: Finished in : 9.94 seconds
infpyng,country=de,host=TIG,server=germany,target=facebook.de average_response_ms=21.2,maximum_response_ms=21.8,minimum_response_ms=20.7,packets_received=2i,packets_transmitted=2i,percent_packet_loss=0i 1589193188000000000
This project is released under the terms of the MIT Open Source License. View LICENSE file for more information.
Content type
Image
Digest
Size
27.4 MB
Last updated
over 6 years ago
docker pull oijkn/infpyng