Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Infpyng can ping multiple hosts at once and write data to InfluxDB -- Alternative to Smokeping

License

NotificationsYou must be signed in to change notification settings

oijkn/infpyng

Repository files navigation

Introduction

Infpyng is a powerful python script which usefping to probe endpoint through ICMP and parsing the output toInfluxdb. The result can then be visualize easily throughGrafana.

  • Infpyng is perhaps your alternative to SmokePing
  • You can adddynamic hosts without restarting script
  • CustomPolling time configuration
  • Low resource consumption
  • Docker compatibility

Benchmark

Those tests were performed from CentOS 8 with 1 CPU and 2 GB of memory

IP to pingIP reachableFinished in
47445411 seconds
1299119713 seconds
2653255228 seconds
3388326232 seconds

Screenshots

Requirements

Installation

You must bind the configuration files with the container during the run for Infpyng to work normally, otherwise an error will appear in the systemd log.

Docker usage

  1. Pull the image from hub.docker

    # docker pull oijkn/infpyng

  2. 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 haveconfig files on your host and edit them according to your environment and adapt theTZ=Europe/Paris depending on your location.

SSH to Infpyng Docker

The command started usingdocker exec only runs while the container’s is running, and it is not restarted if the container is restarted.

  1. Retrieve container id

    # docker ps -a

    CONTAINER IDIMAGECOMMANDCREATEDSTATUSPORTSNAMES
    5591dbd111e5oijkn/infpyng:1.0.0"python infpyng.py"13 seconds agoUp 11 secondsinfpyng
  2. Retrieve container id

    # docker exec -it 5591dbd111e5 sh

  3. Show log file

    /app/infpyng # cat /var/log/infpyng.log2020-05-28 08:54:16 root INFO :: Settings loaded successfully2020-05-28 08:54:16 root INFO :: Init InfluxDB successfully2020-05-28 08:54:16 root INFO :: Starting Infpyng Multiprocessing v1.0.02020-05-28 08:54:16 root INFO :: Polling time every 300s2020-05-28 08:54:16 root INFO :: Total of targets : 52020-05-28 08:54:16 root INFO :: Multiprocessing : 402020-05-28 08:54:16 root INFO :: Buckets : 52020-05-28 08:54:20 root INFO :: Targets alive : 52020-05-28 08:54:20 root INFO :: Targets unreachable : 02020-05-28 08:54:20 root INFO :: Data written to DB successfully2020-05-28 08:54:20 root INFO :: Finished in : 4.44 seconds2020-05-28 08:54:20 root INFO :: ---------------------------------------

Docker Compose usage (Stack)

Multi-container Docker app built from the following services:

Useful for quickly setting up a monitoring stack for performance testing. Please refer to this linkInfpyng-stack to create a performance testing environment in minutes.

Github usage

  1. Download Infpyng project

    # cd /dir/from/host/
    # git clone https://github.com/oijkn/infpyng.git
    # pip install -r requirements.txt

  2. Ensure correct permission on *.py files

    # chmod -R +x /somewhere/in/your/host/infpyng/*.py

  3. Edit your custom settings (conf + hosts)

    # vi /dir/from/host/infpyng/config/config.toml
    # vi /dir/from/host/infpyng/config/hosts.toml

  4. Run Infpyng python script

    # python /dir/from/host/infpyng/infpyng.py &

Grafana

Grafana allows you to query and visualize metrics stored in InfluxDB.

You can use mydashboard example or you can create your own.

Logger

By default the Infpyng logs are located in/var/log/infpyng.log

2020-05-26 09:19:41 root INFO :: Settings loaded successfully2020-05-26 09:19:41 root INFO :: Init InfluxDB successfully2020-05-26 09:19:41 root INFO :: Starting Infpyng Multiprocessing v1.0.02020-05-26 09:19:41 root INFO :: Polling time every 300s2020-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

Metrics

Format

  • infpyng
    • tags:
      • host (host name)
      • target
    • fields:
      • packets_transmitted (integer)
      • packets_received (integer)
      • percent_packets_loss (float)
      • average_response_ms (float)
      • minimum_response_ms (float)
      • maximum_response_ms (float)

Example Output

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

Github contributors lib

Licensing

This project is released under the terms of the MIT Open Source License. View LICENSE file for more information.

About

Infpyng can ping multiple hosts at once and write data to InfluxDB -- Alternative to Smokeping

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp