diff --git a/check_netstat b/check_netstat index 4d38b7ff717cbb31261d27b378a052d747115842..168ac8c943705079cad978e1a480fd358478eec4 100755 --- a/check_netstat +++ b/check_netstat @@ -8,47 +8,43 @@ # # ---------------------------------------------------------------------- # 2020-07-08 v1.0 <axel.hahn@iml.unibe.ch> -# 2022-10-25 v1.1 <axel.hahn@unibe.ch> shell fixes; no tmpfiles; IML look +# 2022-10-25 v1.1 <axel.hahn@unibe.ch> shell fixes; no tmpfiles; IML look +# 2023-08-22 v1.2 <axel.hahn@unibe.ch> update help; small shell fixes # ====================================================================== -. $(dirname $0)/inc_pluginfunctions +. $( dirname $0 )/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.1 +export self_APPVERSION=1.2 # ---------------------------------------------------------------------- # functions # ---------------------------------------------------------------------- function showHelp(){ + local _self; _self=$(basename $0) cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ +$( ph.showImlHelpHeader ) Count number of network connections. SYNTAX: -$(basename $0) [ -w value -c value -h ] +$_self [ -w value -c value -h ] - -w VALUE cpu usage warning level (default: 75) - -c VALUE cpu usage critical level (default: 90) + -w VALUE warning level for connectios total + -c VALUE critical level -h or --help show this help. PARAMETERS: None. -EXAMPLE: -$(basename $0) -w 60 -c 80 -p 40 - -If there is no -w and -c then the result is always OK. +EXAMPLES: +$_self Show count of current connections + If there is no -w and -c then the result is always OK. +$_self -w 400 -c 500 + Show count of connections incl. limits for warning + and critical. EOF } @@ -69,8 +65,8 @@ case "$1" in esac # --- set optional limits -typeset -i iWarnLimit=$( ph.getValueWithParam 0 w "$@") -typeset -i iCriticalLimit=$( ph.getValueWithParam 0 c "$@") +typeset -i iWarnLimit; iWarnLimit=$( ph.getValueWithParam 0 w "$@") +typeset -i iCriticalLimit; iCriticalLimit=$( ph.getValueWithParam 0 c "$@") # --- count all connections typeset -i iTotal=0