Skip to content
Snippets Groups Projects

check_netio: added regex filter for include and exclude

Merged Hahn Axel (hahn) requested to merge 6908_check_rearbackup into master
2 files
+ 81
36
Compare changes
  • Side-by-side
  • Inline

Files

+ 30
7
@@ -13,11 +13,10 @@ This plugin scans `/proc/net/dev` with the regex `eth|en[ops][0-9]*` to show a f
## Syntax
```text
> ./check_netio -h
______________________________________________________________________
CHECK_NETIO
v1.4
v1.5
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
@@ -38,6 +37,10 @@ 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.
@@ -48,6 +51,16 @@ EXAMPLES:
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
@@ -74,10 +87,20 @@ If you enter a wrong interface the check returns with "UNKNOWN".
`check_netio -i "whatever"`returns
```txt
UNKNOWN: Network IO ... IN 0 MB/s >> [host] >> 0 MB/s OUT
ERROR: the interface [whatever] does not exist.
```
--- whatever:
UNKNOWN: the interface whatever does not exist.
### Filter interface list
|rx=0;; tx=0;;
```
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:
```txt
ERROR: No interface was found.
```
Loading