infping

command module
v2.0.0-...-3a65ea0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 16 Imported by: 0

README

Introduction

infping is a simple Go program to parse the output of fping and store it in InfluxDB. Based upon software by Tor Hveem.

Configuration

This program uses the Viper configuration package and can process configuration files in JSON, YAML, TOML, and others. Save your configuration file as infping.<json|yaml|toml|...> in /etc/, /usr/local/etc, or the program directory. A sample configuration file is provided in JSON format.

influx
  • host: The hostname to connect to
  • port: The TCP port number
  • user: The username, if needed
  • pass: The password, if needed
  • db: The database name to connect to – this will be created if it does not exist
  • secure: Set to true to enable HTTPS
  • measurement: Measurement name, if needed - by default "infping"
  • policy: Retention policy to use (by default uses influx's default retention) - must be created manually
fping
  • backoff: The value for the -B argument
  • retries: The value for the -r argument
  • tos: The value for the -O argument
  • summary: The value for the -Q argument – this determines how often data is collected
  • period: The value for the -p argument
hosts
  • hosts: An array of hostnames to ping
hostname
  • hostname: Manual specification of the host (tx_host) - by default gets the os hostname

Influx Storage

Data is stored in Influx with the following fields and tags:

  • min: field showing minimum ping time during the run
  • max: field showing maximum ping time during the run
  • avg: field showing average ping time during the run
  • loss: field showing packet loss during the run
  • rx_host: tag showing the target host
  • tx_host: tag showing the originating host of the ping check

Docker

There is a beta-quality Dockerfile in the root of this repo that uses multistage builds to build and create an image of infping. Running it can be as easy as:

docker run -v /local/infping.json:/config/infping.json $IMAGE

It will automatically detect the configuration in /config. For best results, assign a hostname, otherwise you'll end up with one that doesn't make much sense

We also have a docker-compose file at /docker/docker-compose.yml with a reference to run this service.

Grafana Dashboard

A sample Grafana dashboard is included, that plots all four of the collected ping statistics in something approximating the display of Smokeping. Simply create a datasource named "infping" pointing to Influx, and then import this dashboard. The hostname variable will be automatically populated with all the host names found in the database, and can be used to select different graphs.

dashboard screenshot

Documentation

Overview

The MIT License (MIT)

Copyright (c) 2017 Nicholas Van Wiggeren https://github.com/nickvanw/infping Copyright (c) 2018 Michael Newton https://github.com/miken32/infping

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL