From b50456ef17b9db28c59320a63732664df45b7757 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Mon, 4 Mar 2024 11:28:17 +0100 Subject: [PATCH] remove Kubernetes interfaces --- check_netio | 14 ++++++++++++-- docs/20_Checks/check_netio.md | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/check_netio b/check_netio index a42c5f3..df97ce8 100755 --- a/check_netio +++ b/check_netio @@ -11,13 +11,20 @@ # 2023-08-22 v1.3 <axel.hahn@unibe.ch> show status line with 2 digits after "." # 2023-09-22 v1.4 <axel.hahn@unibe.ch> fix syntax error -eq: unary operator expected # 2024-01-10 v1.5 <axel.hahn@unibe.ch> added regex filter for include and exclude +# 2024-03-04 v1.6 <axel.hahn@unibe.ch> remove Kubernetes interfaces # ====================================================================== . $( dirname $0 )/inc_pluginfunctions -export self_APPVERSION=1.5 +export self_APPVERSION=1.6 +# network data without non physical interfaces to be removed from /proc/net/dev +# - lo - local +# - bond - bonded interfaces +# - ppp - dialer connections +# - cali - Kubernetes interfaces +nonPhysicalInterfaces="(lo|bond.*|ppp.*|cali.*):" # ---------------------------------------------------------------------- # FUNCTIONS @@ -80,6 +87,8 @@ if [ $bOptHelp -eq 0 ]; then exit 0 fi +ph.require bc + typeset -i iCountInterfaces typeset -i iRead=0 @@ -89,7 +98,8 @@ typeset -i iSpeedTrans=0 typeset -i iTotalRead=0 typeset -i iTotalTrans=0 -data=$( cat /proc/net/dev | grep ":" | grep -vE "(lo|bond.*|ppp.*):") +# network data without non physical interfaces +data=$( cat /proc/net/dev | grep ":" | grep -vE "${nonPhysicalInterfaces}") sFilter=$( ph.getValueWithParam "." "f" "$@" ) sRemove=$( ph.getValueWithParam "SOMETHING_INVALID" "r" "$@" ) diff --git a/docs/20_Checks/check_netio.md b/docs/20_Checks/check_netio.md index ba5db8d..5739150 100644 --- a/docs/20_Checks/check_netio.md +++ b/docs/20_Checks/check_netio.md @@ -16,7 +16,7 @@ This plugin scans `/proc/net/dev` with the regex `eth|en[ops][0-9]*` to show a f ______________________________________________________________________ CHECK_NETIO -v1.5 +v1.6 (c) Institute for Medical Education - University of Bern Licence: GNU GPL 3 -- GitLab