diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-06 16:11:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-06 16:11:30 +0000 |
commit | aa2fe8ccbfcb117efa207d10229eeeac5d0f97c7 (patch) | |
tree | 941cbdd387b41c1a81587c20a6df9f0e5e0ff7ab /collectors/fping.plugin | |
parent | Adding upstream version 1.37.1. (diff) | |
download | netdata-aa2fe8ccbfcb117efa207d10229eeeac5d0f97c7.tar.xz netdata-aa2fe8ccbfcb117efa207d10229eeeac5d0f97c7.zip |
Adding upstream version 1.38.0.upstream/1.38.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/fping.plugin')
-rw-r--r-- | collectors/fping.plugin/Makefile.am | 24 | ||||
-rw-r--r-- | collectors/fping.plugin/README.md | 110 | ||||
-rw-r--r-- | collectors/fping.plugin/fping.conf | 44 | ||||
-rwxr-xr-x | collectors/fping.plugin/fping.plugin.in | 202 |
4 files changed, 0 insertions, 380 deletions
diff --git a/collectors/fping.plugin/Makefile.am b/collectors/fping.plugin/Makefile.am deleted file mode 100644 index 90654832b..000000000 --- a/collectors/fping.plugin/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later - -AUTOMAKE_OPTIONS = subdir-objects -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in - -CLEANFILES = \ - fping.plugin \ - $(NULL) - -include $(top_srcdir)/build/subst.inc -SUFFIXES = .in - -dist_plugins_SCRIPTS = \ - fping.plugin \ - $(NULL) - -dist_noinst_DATA = \ - fping.plugin.in \ - README.md \ - $(NULL) - -dist_libconfig_DATA = \ - fping.conf \ - $(NULL) diff --git a/collectors/fping.plugin/README.md b/collectors/fping.plugin/README.md deleted file mode 100644 index e32d3911b..000000000 --- a/collectors/fping.plugin/README.md +++ /dev/null @@ -1,110 +0,0 @@ -<!-- -title: "fping.plugin" -custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/fping.plugin/README.md ---> - -# fping.plugin - -The fping plugin supports monitoring latency, packet loss and uptime of any number of network end points, -by pinging them with `fping`. - -This plugin requires version 5.1 or newer of `fping` (earlier versions may or may not work). Our static builds and -Docker images come bundled with a known working version of `fping`. Native packages and local builds will need to -have a working version installed before the plugin is usable. - -## Installing fping locally - -If your distribution’s repositories do not include a working version of `fping`, the supplied plugin can install -it, by running: - -```sh -/usr/libexec/netdata/plugins.d/fping.plugin install -``` - -The above will download, build and install the right version as `/usr/local/bin/fping`. This requires a working C -compiler, GNU autotools (at least autoconf and automake), and GNU make. On Debian or Ubuntu, you can pull in most -of the required tools by installing the `build-essential` package (this should include everything except automake -and autoconf). - -## Configuration - -Then you need to edit `/etc/netdata/fping.conf` (to edit it on your system run -`/etc/netdata/edit-config fping.conf`) like this: - -```sh -# set here all the hosts you need to ping -# I suggest to use hostnames and put their IPs in /etc/hosts -hosts="host1 host2 host3" - -# override the chart update frequency - the default is inherited from Netdata -update_every=1 - -# time in milliseconds (1 sec = 1000 ms) to ping the hosts -# 200 = 5 pings per second -ping_every=200 - -# other fping options - these are the defaults -fping_opts="-R -b 56 -i 1 -r 0 -t 5000" -``` - -## alarms - -Netdata will automatically attach a few alarms for each host. -Check the [latest versions of the fping alarms](https://raw.githubusercontent.com/netdata/netdata/master/health/health.d/fping.conf) - -## Additional Tips - -### Customizing Amount of Pings Per Second - -For example, to update the chart every 10 seconds and use 2 pings every 10 seconds, use this: - -```sh -# Chart Update Frequency (Time in Seconds) -update_every=10 - -# Time in Milliseconds (1 sec = 1000 ms) to Ping the Hosts -# The Following Example Sends 1 Ping Every 5000 ms -# Calculation Formula: ping_every = (update_every * 1000 ) / 2 -ping_every=5000 -``` - -### Multiple fping Plugins With Different Settings - -You may need to run multiple fping plugins with different settings for different end points. -For example, you may need to ping a few hosts 10 times per second, and others once per second. - -Netdata allows you to add as many `fping` plugins as you like. - -Follow this procedure: - -**1. Create New fping Configuration File** - -```sh -# Step Into Configuration Directory -cd /etc/netdata - -# Copy Original fping Configuration File To New Configuration File -cp fping.conf fping2.conf -``` - -Edit `fping2.conf` and set the settings and the hosts you need for the seconds instance. - -**2. Soft Link Original fping Plugin to New Plugin File** - -```sh -# Become root (If The Step Step Is Performed As Non-Root User) -sudo su - -# Step Into The Plugins Directory -cd /usr/libexec/netdata/plugins.d - -# Link fping.plugin to fping2.plugin -ln -s fping.plugin fping2.plugin -``` - -That's it. Netdata will detect the new plugin and start it. - -You can name the new plugin any name you like. -Just make sure the plugin and the configuration file have the same name. - - diff --git a/collectors/fping.plugin/fping.conf b/collectors/fping.plugin/fping.conf deleted file mode 100644 index 63a7f7acd..000000000 --- a/collectors/fping.plugin/fping.conf +++ /dev/null @@ -1,44 +0,0 @@ -# no need for shebang - this file is sourced from fping.plugin - -# fping.plugin requires a recent version of fping. -# -# You can get it on your system, by running: -# -# /usr/libexec/netdata/plugins.d/fping.plugin install - -# ----------------------------------------------------------------------------- -# configuration options - -# The fping binary to use. We need one that can output netdata friendly info -# (supporting: -N). If you have multiple versions, put here the full filename -# of the right one - -#fping="/usr/local/bin/fping" - - -# a space separated list of hosts to fping -# we suggest to put names here and the IPs of these names in /etc/hosts - -hosts="" - - -# The update frequency of the chart - the default is inherited from netdata - -#update_every=2 - - -# The time in milliseconds (1 sec = 1000 ms) to ping the hosts -# by default 5 pings per host per iteration -# fping will not allow this to be below 20ms - -#ping_every="200" - - -# other fping options - defaults: -# -R = send packets with random data -# -b 56 = the number of bytes per packet -# -i 1 = 1 ms when sending packets to others hosts (switching hosts) -# -r 0 = never retry packets -# -t 5000 = per packet timeout at 5000 ms - -#fping_opts="-R -b 56 -i 1 -r 0 -t 5000" diff --git a/collectors/fping.plugin/fping.plugin.in b/collectors/fping.plugin/fping.plugin.in deleted file mode 100755 index 4b3d1d126..000000000 --- a/collectors/fping.plugin/fping.plugin.in +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-3.0-or-later - -# netdata -# real-time performance and health monitoring, done right! -# (C) 2017 Costa Tsaousis <costa@tsaousis.gr> -# GPL v3+ -# -# This plugin requires a latest version of fping. -# You can compile it from source, by running me with option: install - -export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/sbin" -export LC_ALL=C - -if [ "${1}" = "install" ] - then - [ "${UID}" != 0 ] && echo >&2 "Please run me as root. This will install a single binary file: /usr/local/bin/fping." && exit 1 - - [ -z "${2}" ] && fping_version="5.1" || fping_version="${2}" - - run() { - printf >&2 " > " - printf >&2 "%q " "${@}" - printf >&2 "\n" - "${@}" || exit 1 - } - - download() { - local curl="$(which curl 2>/dev/null || command -v curl 2>/dev/null)" - [ ! -z "${curl}" ] && run curl -s -L "${1}" && return 0 - - local wget="$(which wget 2>/dev/null || command -v wget 2>/dev/null)" - [ ! -z "${wget}" ] && run wget -q -O - "${1}" && return 0 - - echo >&2 "Cannot find 'curl' or 'wget' in this system." && exit 1 - } - - [ ! -d /usr/src ] && run mkdir -p /usr/src - [ ! -d /usr/local/bin ] && run mkdir -p /usr/local/bin - - run cd /usr/src - - if [ -d "fping-${fping_version}" ] - then - run rm -rf "fping-${fping_version}" || exit 1 - fi - - download "https://github.com/schweikert/fping/releases/download/v${fping_version}/fping-${fping_version}.tar.gz" | run tar -zxvpf - - [ $? -ne 0 ] && exit 1 - run cd "fping-${fping_version}" || exit 1 - - run ./configure --prefix=/usr/local - run make clean - run make - if [ -f /usr/local/bin/fping ] - then - run mv -f /usr/local/bin/fping /usr/local/bin/fping.old - fi - run mv src/fping /usr/local/bin/fping - run chown root:root /usr/local/bin/fping - run chmod 4755 /usr/local/bin/fping - echo >&2 - echo >&2 "All done, you have a compatible fping now at /usr/local/bin/fping." - echo >&2 - - fping="$(which fping 2>/dev/null || command -v fping 2>/dev/null)" - if [ "${fping}" != "/usr/local/bin/fping" ] - then - echo >&2 "You have another fping installed at: ${fping}." - echo >&2 "Please set:" - echo >&2 - echo >&2 " fping=\"/usr/local/bin/fping\"" - echo >&2 - echo >&2 "at /etc/netdata/fping.conf" - echo >&2 - fi - exit 0 -fi - -# ----------------------------------------------------------------------------- - -PROGRAM_NAME="$(basename "${0}")" - -logdate() { - date "+%Y-%m-%d %H:%M:%S" -} - -log() { - local status="${1}" - shift - - echo >&2 "$(logdate): ${PROGRAM_NAME}: ${status}: ${*}" - -} - -warning() { - log WARNING "${@}" -} - -error() { - log ERROR "${@}" -} - -info() { - log INFO "${@}" -} - -fatal() { - log FATAL "${@}" - echo "DISABLE" - exit 1 -} - -debug=0 -debug() { - [ $debug -eq 1 ] && log DEBUG "${@}" -} - -# ----------------------------------------------------------------------------- - -# store in ${plugin} the name we run under -# this allows us to copy/link fping.plugin under a different name -# to have multiple fping plugins running with different settings -plugin="${PROGRAM_NAME/.plugin/}" - - -# ----------------------------------------------------------------------------- - -# the frequency to send info to netdata -# passed by netdata as the first parameter -update_every="${1-1}" - -# the netdata configuration directory -# passed by netdata as an environment variable -[ -z "${NETDATA_USER_CONFIG_DIR}" ] && NETDATA_USER_CONFIG_DIR="@configdir_POST@" -[ -z "${NETDATA_STOCK_CONFIG_DIR}" ] && NETDATA_STOCK_CONFIG_DIR="@libconfigdir_POST@" - -# ----------------------------------------------------------------------------- -# configuration options -# can be overwritten at /etc/netdata/fping.conf - -# the fping binary to use -# we need one that can output netdata friendly info (supporting: -N) -# if you have multiple versions, put here the full filename of the right one -fping="$( which fping 2>/dev/null || command -v fping 2>/dev/null )" - -# a space separated list of hosts to fping -# we suggest to put names here and the IPs of these names in /etc/hosts -hosts="" - -# the time in milliseconds (1 sec = 1000 ms) -# to ping the hosts - by default 5 pings per host per iteration -ping_every="$((update_every * 1000 / 5))" - -# fping options -fping_opts="-R -b 56 -i 1 -r 0 -t 5000" - -# ----------------------------------------------------------------------------- -# load the configuration files - -for CONFIG in "${NETDATA_STOCK_CONFIG_DIR}/${plugin}.conf" "${NETDATA_USER_CONFIG_DIR}/${plugin}.conf" -do - if [ -f "${CONFIG}" ] - then - info "Loading config file '${CONFIG}'..." - source "${CONFIG}" - [ $? -ne 0 ] && error "Failed to load config file '${CONFIG}'." - else - warning "Cannot find file '${CONFIG}'." - fi -done - -if [ -z "${hosts}" ] -then - fatal "no hosts configured - nothing to do." -fi - -if [ -z "${fping}" ] -then - fatal "fping command is not found. Please set its full path in '${NETDATA_USER_CONFIG_DIR}/${plugin}.conf'" -fi - -if [ ! -x "${fping}" ] -then - fatal "fping command '${fping}' is not executable - cannot proceed." -fi - -if [ ${ping_every} -lt 20 ] - then - warning "ping every was set to ${ping_every} but 20 is the minimum for non-root users. Setting it to 20 ms." - ping_every=20 -fi - -# the fping options we will use -options=( -N -l -Q ${update_every} -p ${ping_every} ${fping_opts} ${hosts} ) - -# execute fping -info "starting fping: ${fping} ${options[*]}" -exec "${fping}" "${options[@]}" - -# if we cannot execute fping, stop -fatal "command '${fping} ${options[*]}' failed to be executed (returned code $?)." |