-
Notifications
You must be signed in to change notification settings - Fork 29
Nagios Plugin check_network
Davide Madrisan edited this page Aug 8, 2020
·
2 revisions
check_network - displays some network interfaces statistics
[/etc/nrpe.d/check_network]
command[check_network]=/usr/lib/nagios/plugins/check_network
This plugin displays some network interfaces.statistics.
Copyright (C) 2014,2015,2020 Davide Madrisan <[email protected]>
Usage:
check_network [-klW] [-bCdemp] [-i <ifname-regex>] [delay]
check_network [-klW] [-bCdemp] [-i <ifname-regex>] --ifname-debug
Options:
-i, --ifname only display interfaces matching a regular expression
--ifname-debug display the list of metric keys and exit
-k, --check-link report an error if at least a link is down
-l, --no-loopback skip the loopback interface
-W, --no-wireless skip the wireless interfaces
-%, --perc return percentage metrics if possible
-w, --warning COUNTER warning threshold
-c, --critical COUNTER critical threshold
-h, --help display this help and exit
-V, --version output version information and exit
delay is the delay between the two network snapshots in seconds (default: 1sec)
By default all the counters are reported in the output but it's possible to select a subset of them:
-b --no-bytes omit the rx/tx bytes counter from perfdata
-C, --no-collisions omit the collisions counter from perfdata
-d --no-drops omit the rx/tx drop counters from perfdata
-e --no-errors omit the rx/tx errors counters from perfdata
-m, --no-multicast omit the multicast counter from perfdata
-p, --no-packets omit the rx/tx packets counter from perfdata
-r, --rx-only consider the received traffic only in the thresholods
-t, --tx-only consider the transmitted traffic only in the thresholds
Note:
- The option --ifname supports the POSIX Extended Regular Expression syntax.
See: https://man7.org/linux/man-pages/man7/regex.7.html
- You cannot select both the options r/rx-only and t/tx-only.
Examples:
check_network
check_network --check-link --ifname "^(enp|eth)" 15
check_network --check-link --ifname ^wlp --warning 645120 15
check_network --ifname "^(enp|wlp)" --ifname-debug -Cdm
check_network --perc --ifname "^(enp|eth)" -w 80% 15
check_network --no-loopback --no-wireless 15
$ ./plugins/check_network --ifname "^(enp|wlp)" --ifname-debug -Cdm
enp1s0 (NO-CARRIER)
- enp1s0_txbyte/s enp1s0_rxbyte/s
- enp1s0_txerr/s enp1s0_rxerr/s
- enp1s0_txpck/s enp1s0_rxpck/s
wlp2s0
- wlp2s0_txbyte/s wlp2s0_rxbyte/s
- wlp2s0_txerr/s wlp2s0_rxerr/s
- wlp2s0_txpck/s wlp2s0_rxpck/s
$ ./plugins/check_network --ifname "^(enp|wlp)"
network OK - found 2 interface(s): enp1s0,wlp2s0 | enp1s0_txbyte/s=0 enp1s0_rxbyte/s=0 enp1s0_txerr/s=0 enp1s0_rxerr/s=0 enp1s0_txdrop/s=0 enp1s0_rxdrop/s=0 enp1s0_txpck/s=0 enp1s0_rxpck/s=0 enp1s0_coll/s=0 enp1s0_mcast/s=0 wlp2s0_txbyte/s=0 wlp2s0_rxbyte/s=66 wlp2s0_txerr/s=0 wlp2s0_rxerr/s=0 wlp2s0_txdrop/s=0 wlp2s0_rxdrop/s=0 wlp2s0_txpck/s=0 wlp2s0_rxpck/s=1 wlp2s0_coll/s=0 wlp2s0_mcast/s=0
lo_txpck/s
lo_rxpck/s
lo_txbyte/s
lo_rxbyte/s
lo_txerr/s
lo_rxerr/s
lo_txdrop/s
lo_rxdrop/s
lo_mcast/s
lo_mcast/s
lo_coll/s
enp1s0_txpck/s
enp1s0_rxpck/s
...
docker0_txpck/s
docker0_rxpck/s
...