Demonstrates the monitoring plugin check_linux_netdev. Use with -p 8080:80.
10K+
The check plugin check_linux_netdev monitors
a Linux system's network device statistics via /proc/net/dev.
$ docker run -itp 8080:80 grandmaster/check_linux_netdevThe plug-and-play Linux binariesā take some optional CLI arguments and no environment variables:
$ ./check_linux_netdev [-d DURATION] [INTERFACE:METRIC:THRESHOLD=RANGE ...]
check_linux_netdev measures not only e.g. the bytes every network device received so far, but also the average B/s during DURATION being e.g. 10s or 2m (default: 1m).
Yes, this plugin runs for one minute by default!
INTERFACE specifies either one particular network device (e.g. "eth0") or a pattern (e.g. "eth?*") with the special characters "?" (matches one character) and "*" (matches zero or more characters).
METRIC specifies a field of a network device in /proc/net/dev:
THRESHOLD specifies a warning/critical threshold:
"total" stands for the field value as-is, "persec" for the average raise per second. "w" stands for warning, "c" for critical.
RANGE is a threshold range as specified by the Nagio$ check plugin APIā , e.g. "23" or "@~:-42.0".
I.e. to let this plugin warn once an ethernet NIC sends more than 1GB/s during 5 minutes:
$ ./check_linux_netdev -d 5m 'eth?*:tx:bytes:persec:w=1000000000' 'enp?*s?*:tx:bytes:persec:w=1000000000'
To print the legal info, execute the plugin in a terminal:
$ ./check_linux_netdev
In this case the program will always terminate with exit status 3 ("unknown") without actually checking anything.
If you want to actually execute a check inside a terminal, you have to connect the standard output of the plugin to anything other than a terminal ā e.g. the standard input of another process:
$ ./check_linux_netdev |cat
In this case the exit code is likely to be the cat's one. This can be worked around like this:
bash $ set -o pipefail
bash $ ./check_linux_netdev |cat
Just integrate the plugin into the monitoring tool of your choice like any other check plugin. (Consult that tool's manual on how to do that.) It should work with any monitoring tool supporting the Nagio$ check plugin APIā .
The only limitation: check_linux_netdev must be run on the host to be checked ā either with an agent of your monitoring tool or by SSH. Otherwise it will check the host your monitoring tool runs on.
Also take care of the execution timeout as this plugin runs for one minute by default and the check interval as e.g. Icinga 2ā seems to add the execution time to the check interval, i.e. if you want to check via Icinga 2 every minute for one minute, your check interval should be 1s.
This repository ships the check command definitionā as well as a service templateā and host exampleā for Icinga 2.
The service definition will work in both correctly set up Icinga 2 clustersā and Icinga 2 instances not being part of any cluster as long as the hostsā are named after the endpointsā .
Content type
Image
Digest
Size
310.3 MB
Last updated
almost 7 years ago
docker pull grandmaster/check_linux_netdev