Check_netio

Script: check_netio

Show network io for all or selected interfaces.

This plugin scans /proc/net/dev with the regex eth|en[ops][0-9]* to show a few types of interfaces.

Requirements

  • none

Standalone installation

From this repository ypu need next to this script:

  • inc_pluginfunctions shared function for all IML checks written in bash

Syntax

______________________________________________________________________

CHECK_NETIO
v1.7

(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3

https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_netio.html
______________________________________________________________________

Show network io for all or selected interfaces.
It shows the current counter value from /proc/net/dev and the speed 
in byte per sec since last execution.

This plugin sends performancedata.

SYNTAX:
  check_netio [-h] [-i INTERFACE(S)]

OPTIONS:
  -h               this help

PARAMETERS:

  -f  REGEX        filter interfaces by given regex.
  -r  REGEX        remove interfaces by given regex

  -i  INTERFACE    show this interface only. Quote multiple interfaces.
                   The check returns unknown if an interface does not
                   exist.

EXAMPLES:

  check_netio      show netio of all network interfaces
  check_netio -i "eth0 eth1" 
                   show netio of given interfaces.

  check_netio -f "^eth" 
                   show netio of interfaces beginning with "eth"

  check_netio -f "^eth" -r "eth2"
                   show netio of interfaces matching "^eth" but not "eth2"

  check_netio -f "^(enp|wlp)"
                   Example to include multiple interface names: use brackets
                   and divide expressions with pipe sign.

Examples

Host with single interface

A simple call on a host with a single interface… check_netio returns

OK: Network IO ... IN 0 MB/s >> [host] >> 0 MB/s OUT

--- enp0s31f6:
       receive:      1079156830      28849 byte/s     
      transmit:      1082596810       2898 byte/s     

 |rx=28849;; tx=2898;;

Custom interface

You get the same output with check_netio -i enp0s31f6.

If you enter a wrong interface the check returns with “UNKNOWN”. check_netio -i "whatever"returns

ERROR: the interface [whatever] does not exist.

Filter interface list

The parameter -f is followes by pattern that an interface must match. The opposite does the regexp behind -r: it removes interfaces that match that regex.

You can combine both parameters.

The regexp can be an extended regexp (grep -E <pattern>). This allows to use brackets and divide expressions with pipe sign, eg. check_netio -f "^(enp|wlp)"

If your filter rules remove all existing interfaces you get an error message:

ERROR: No interface was found.