From b262d95a9d016c07ef5558d6958a9707e374c627 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Thu, 27 Jul 2023 16:50:48 +0200 Subject: [PATCH] implement ph.showImlHelpHeader --- check_apache_requests | 20 +++++++------------- check_ceph_diskfree | 25 +++++++++---------------- check_ceph_io | 17 +++++------------ check_ceph_osd | 14 +++----------- check_ceph_status | 4 ++-- check_clientbackup | 18 +++++------------- check_conn.cfg | 5 +++++ check_cpu | 42 ++++++++++++++++++------------------------ check_cronstatus | 28 +++++++++++----------------- check_disk-io | 18 ++++-------------- check_dns_responsetime | 16 ++++------------ check_fs_errors | 16 ++++------------ check_fs_writable | 12 ++---------- 13 files changed, 79 insertions(+), 156 deletions(-) create mode 100644 check_conn.cfg diff --git a/check_apache_requests b/check_apache_requests index 7945cea..481704a 100755 --- a/check_apache_requests +++ b/check_apache_requests @@ -12,11 +12,11 @@ # 2022-08-31 v1.3 <axel.hahn@iml.unibe.ch> add help; shellfix corrections # 2022-08-31 v1.4 <axel.hahn@iml.unibe.ch> add help; shellfix corrections # 2023-06-19 v1.5 <axel.hahn@unibe.ch> no more tmpfile +# 2023-07-27 v1.6 <axel.hahn@unibe.ch> update help page # ====================================================================== . $(dirname $0)/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.5 +self_APPVERSION=1.6 # url=`hostname -f`/server-status url=localhost/server-status @@ -41,15 +41,9 @@ paramsWget="-T 5 -t 1 --no-check-certificate" # ---------------------------------------------------------------------- function showHelp(){ -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) Get Apache httpd server-status page $url. You get output with the server status and values for each slot type. @@ -80,7 +74,7 @@ Slot types of apache httpd: SYNTAX: -$(basename $0) [-w WARN_LIMIT] [-c CRITICAL_LIMIT] +$_self [-w WARN_LIMIT] [-c CRITICAL_LIMIT] OPTIONS: @@ -95,7 +89,7 @@ PARAMETERS: EXAMPLE: -$(basename $0) -w 60 -c 80 +$_self -w 60 -c 80 EOF } diff --git a/check_ceph_diskfree b/check_ceph_diskfree index 749bf1f..5f5253a 100755 --- a/check_ceph_diskfree +++ b/check_ceph_diskfree @@ -16,10 +16,11 @@ # # ---------------------------------------------------------------------- # 2020-03-04 v1.0 <axel.hahn@iml.unibe.ch> -# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions -# 2023-04-24 v1.2 <axel.hahn@unibe.ch> update for newer ceph versions -# 2023-05-09 v1.3 <axel.hahn@unibe.ch> add help -# 2023-06-19 v1.4 <axel.hahn@unibe.ch> no more tmpfile +# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions +# 2023-04-24 v1.2 <axel.hahn@unibe.ch> update for newer ceph versions +# 2023-05-09 v1.3 <axel.hahn@unibe.ch> add help +# 2023-06-19 v1.4 <axel.hahn@unibe.ch> no more tmpfile +# 2023-07-27 v1.5 <axel.hahn@unibe.ch> update help page # ====================================================================== . $(dirname $0)/inc_pluginfunctions @@ -27,20 +28,12 @@ typeset -i iWarning=0 typeset -i iCritical=0 - -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.4 +self_APPVERSION=1.5 function showHelp(){ -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) Show available and free space on a ceph cluster. This check sends performance data. diff --git a/check_ceph_io b/check_ceph_io index e5b65a8..cf1701f 100755 --- a/check_ceph_io +++ b/check_ceph_io @@ -18,24 +18,17 @@ # 2023-05-10 v1.1 <axel.hahn@unibe.ch> fix for small transfer rates in B/s # 2023-05-10 v1.2 <axel.hahn@unibe.ch> add tests # 2023-05-11 v1.3 <axel.hahn@unibe.ch> handle ceph status without io data in output +# 2023-07-27 v1.4 <axel.hahn@unibe.ch> update help page # ====================================================================== . $(dirname $0)/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.3 +self_APPVERSION=1.4 function showHelp(){ - _self=$(basename $0) -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) Show cheph IO as read and written bytes per second. This check sends performance data. diff --git a/check_ceph_osd b/check_ceph_osd index bbe1dd5..d5c4522 100755 --- a/check_ceph_osd +++ b/check_ceph_osd @@ -31,7 +31,6 @@ . $(dirname $0)/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) self_APPVERSION=1.6 # column number in output where to find the up/ down info @@ -42,16 +41,9 @@ iColUpDown=5 # ---------------------------------------------------------------------- function showHelp(){ - _self=$(basename $0) -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) Show cheph osd status: how many OSDs exist and how many are up/ down. This check sends performance data. diff --git a/check_ceph_status b/check_ceph_status index aa18e59..3e8b6bd 100755 --- a/check_ceph_status +++ b/check_ceph_status @@ -20,14 +20,14 @@ # 2021-04-12 v1.3 <axel.hahn@iml.unibe.ch> if degraded items are 0 delete init file too # 2023-04-24 v1.4 <axel.hahn@unibe.ch> update for newer ceph versions # 2023-06-19 v1.5 <axel.hahn@unibe.ch> add help and param support; no more tmpfile +# 2023-07-27 v1.6 <axel.hahn@unibe.ch> update help page # ====================================================================== . $(dirname $0)/inc_pluginfunctions initfile="/tmp/ceph-status-not-ok-start-$USER" -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.5 +self_APPVERSION=1.6 iSleep=3 doLoop=1 diff --git a/check_clientbackup b/check_clientbackup index f0a66a4..a3aad97 100755 --- a/check_clientbackup +++ b/check_clientbackup @@ -17,13 +17,12 @@ # 2022-10-21 v1.10 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # show last backup, prune, verify # 2023-06-22 v1.11 <axel.hahn@unibe.ch> add help and param support; add parameter for install directory -# 2023-06-22 v1.12 <axel.hahn@unibe.ch> add docs url of IML backup +# 2023-07-27 v1.12 <axel.hahn@unibe.ch> add docs url of IML backup # ====================================================================== . $( dirname $0 )/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.11 +self_APPVERSION=1.12 sInstalldir=/opt/imlbackup/client/ @@ -32,16 +31,9 @@ sInstalldir=/opt/imlbackup/client/ # ---------------------------------------------------------------------- function showHelp(){ - _self=$(basename $0) -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) Show status of IML backup. See https://os-docs.iml.unibe.ch/iml-backup/ diff --git a/check_conn.cfg b/check_conn.cfg new file mode 100644 index 0000000..2e36a1f --- /dev/null +++ b/check_conn.cfg @@ -0,0 +1,5 @@ +# +tcp/www.axel-hahn.de/80 +tcp/www.axel-hahn.de/443 + +tcp/localhost/8002 diff --git a/check_cpu b/check_cpu index 0f5bc3e..3e160ce 100755 --- a/check_cpu +++ b/check_cpu @@ -9,41 +9,35 @@ # # ---------------------------------------------------------------------- # 2020-03-10 v1.0 <axel.hahn@iml.unibe.ch> -# 2020-03-23 v1.1 <axel.hahn@iml.unibe.ch> added more data -# 2020-07-08 v1.2 <axel.hahn@iml.unibe.ch> FIX: set "ph." instead "ps." -# 2020-07-17 v1.3 <axel.hahn@iml.unibe.ch> use ph.require to check binaries -# 2021-02-10 v1.4 <axel.hahn@iml.unibe.ch> added critical io wait -# 2021-10-28 v1.5 <axel.hahn@iml.unibe.ch> Use 2nd update of top -# 2021-12-10 v1.6 <axel.hahn@iml.unibe.ch> show processes with status D to find cpu waits -# 2022-03-09 v1.7 <axel.hahn@iml.unibe.ch> show most cpu intensive processes -# 2022-03-10 v1.8 <axel.hahn@iml.unibe.ch> add cli param -p; update help -# 2022-03-22 v1.9 <axel.hahn@iml.unibe.ch> fix syntax error on 100% idle -# 2022-04-14 v1.10 <axel.hahn@iml.unibe.ch> show consuming cpu processes with top and ps -# 2022-08-29 v1.11 <axel.hahn@iml.unibe.ch> replace pipe to prevent start of metrics section -# 2022-08-29 v1.12 <axel.hahn@iml.unibe.ch> fix: replace pipe -# 2023-02-13 v1.13 <axel.hahn@iml.unibe.ch> small shell fixes +# 2020-03-23 v1.1 <axel.hahn@iml.unibe.ch> added more data +# 2020-07-08 v1.2 <axel.hahn@iml.unibe.ch> FIX: set "ph." instead "ps." +# 2020-07-17 v1.3 <axel.hahn@iml.unibe.ch> use ph.require to check binaries +# 2021-02-10 v1.4 <axel.hahn@iml.unibe.ch> added critical io wait +# 2021-10-28 v1.5 <axel.hahn@iml.unibe.ch> Use 2nd update of top +# 2021-12-10 v1.6 <axel.hahn@iml.unibe.ch> show processes with status D to find cpu waits +# 2022-03-09 v1.7 <axel.hahn@iml.unibe.ch> show most cpu intensive processes +# 2022-03-10 v1.8 <axel.hahn@iml.unibe.ch> add cli param -p; update help +# 2022-03-22 v1.9 <axel.hahn@iml.unibe.ch> fix syntax error on 100% idle +# 2022-04-14 v1.10 <axel.hahn@iml.unibe.ch> show consuming cpu processes with top and ps +# 2022-08-29 v1.11 <axel.hahn@iml.unibe.ch> replace pipe to prevent start of metrics section +# 2022-08-29 v1.12 <axel.hahn@iml.unibe.ch> fix: replace pipe +# 2023-02-13 v1.13 <axel.hahn@iml.unibe.ch> small shell fixes +# 2023-07-27 v1.14 <axel.hahn@unibe.ch> update help page # ====================================================================== . $(dirname $0)/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.13 +self_APPVERSION=1.14 # ---------------------------------------------------------------------- # functions # ---------------------------------------------------------------------- function showHelp(){ -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) check cpu usage and cpu wait Cpu infos are taken from output of top command. diff --git a/check_cronstatus b/check_cronstatus index e675264..ffc4b1d 100755 --- a/check_cronstatus +++ b/check_cronstatus @@ -17,19 +17,19 @@ # ds=daniel.schueler@iml.unibe.ch # # 2017-10-13 v1.0 ah,ds -# 2017-10-17 v1.1 ah,ds remove PIPESTATUS for Debian8 compatibility -# 2019-04-30 v1.2 ah,ds show scriptlabel of failed jobs in 1st line -# 2020-02-28 v1.3 ah,ds ouput with separated error jobs and OK jobs -# 2020-03-05 v1.4 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions -# 2022-02-28 v1.5 <axel.hahn@iml.unibe.ch> fix output of error counter -# 2022-08-23 v2.0 <axel.hahn@iml.unibe.ch> simplify it: use cronstatus.sh (it has exitcode >0 on errors now) +# 2017-10-17 v1.1 ah,ds remove PIPESTATUS for Debian8 compatibility +# 2019-04-30 v1.2 ah,ds show scriptlabel of failed jobs in 1st line +# 2020-02-28 v1.3 ah,ds ouput with separated error jobs and OK jobs +# 2020-03-05 v1.4 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions +# 2022-02-28 v1.5 <axel.hahn@iml.unibe.ch> fix output of error counter +# 2022-08-23 v2.0 <axel.hahn@iml.unibe.ch> simplify it: use cronstatus.sh (it has exitcode >0 on errors now) +# 2023-07-27 v2.1 <axel.hahn@unibe.ch> update help page # ====================================================================== . $( dirname $0 )/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=2.0 +self_APPVERSION=2.1 statusScript=/opt/cronwrapper/cronstatus.sh # ---------------------------------------------------------------------- @@ -37,15 +37,9 @@ statusScript=/opt/cronwrapper/cronstatus.sh # ---------------------------------------------------------------------- function showHelp(){ -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) Show status of all Cronjobs using Axels Cronwrapper https://github.com/axelhahn/cronwrapper diff --git a/check_disk-io b/check_disk-io index 31e1112..4dcdc25 100755 --- a/check_disk-io +++ b/check_disk-io @@ -13,13 +13,12 @@ # # ---------------------------------------------------------------------- # 2020-07-17 v1.0 <axel.hahn@iml.unibe.ch> -# 2023-07-27 v1.1 <axel.hahn@iml.unibe.ch> shell fixes; remove unsupported warn and critical +# 2023-07-27 v1.1 <axel.hahn@unibe.ch> shell fixes; remove unsupported warn and critical # ====================================================================== . $( dirname $0 )/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) self_APPVERSION=1.1 # ---------------------------------------------------------------------- @@ -46,18 +45,9 @@ function getDisks(){ # show help function showHelp(){ - _self=$(basename $0) -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -Check dis io and latency - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) Disk infos based on /sys/block/[NAME]/stat See https://www.kernel.org/doc/Documentation/block/stat.txt diff --git a/check_dns_responsetime b/check_dns_responsetime index 6e86510..88d07d9 100755 --- a/check_dns_responsetime +++ b/check_dns_responsetime @@ -11,13 +11,12 @@ # test tcp 53 first # check result depends on 1st nameserver only # 2022-10-24 v1.2 <axel.hahn@unibe.ch> shell fixes; remove pipe char in output -# 2023-07-27 v1.3 <axel.hahn@iml.unibe.ch> shell fixes; add help page +# 2023-07-27 v1.3 <axel.hahn@unibe.ch> shell fixes; add help page # ====================================================================== . $( dirname $0 )/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) self_APPVERSION=1.3 tmpfile=/tmp/check_netstat_out_$$ @@ -38,16 +37,9 @@ typeset -i iNotReachable=0 # show help function showHelp(){ - _self=$(basename $0) -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) Loop over all defined dns servers (in /etc/resolv.conf) and check each: diff --git a/check_fs_errors b/check_fs_errors index 6369f4b..426c186 100755 --- a/check_fs_errors +++ b/check_fs_errors @@ -10,13 +10,12 @@ # ---------------------------------------------------------------------- # 2021-03-23 v1.0 <axel.hahn@iml.unibe.ch> # 2021-03-30 v1.1 <axel.hahn@iml.unibe.ch> max age of detected errors: since yesterday (commented) -# 2023-07-27 v1.2 <axel.hahn@iml.unibe.ch> shell fixes; update help page +# 2023-07-27 v1.2 <axel.hahn@unibe.ch> shell fixes; update help page # ====================================================================== . $( dirname $0 )/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) self_APPVERSION=1.2 @@ -25,16 +24,9 @@ self_APPVERSION=1.2 # ---------------------------------------------------------------------- function showHelp(){ - _self=$(basename $0) -cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ + local _self=$(basename $0) + cat <<EOF +$( ph.showImlHelpHeader ) Check if kernel logs inconsistency messages in the journallog. It requires sudo permission on /bin/journalctl diff --git a/check_fs_writable b/check_fs_writable index 20c5443..9470f60 100755 --- a/check_fs_writable +++ b/check_fs_writable @@ -8,13 +8,12 @@ # # ---------------------------------------------------------------------- # 2021-03-23 v0.0 <axel.hahn@iml.unibe.ch> -# 2023-07-27 v1.2 <axel.hahn@iml.unibe.ch> shell fixes; update help page +# 2023-07-27 v1.2 <axel.hahn@unibe.ch> shell fixes; update help page # ====================================================================== . $( dirname $0 )/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) self_APPVERSION=1.2 dirs2test="/tmp /var/tmp" @@ -27,14 +26,7 @@ out="" function showHelp(){ _self=$(basename $0) cat <<EOF -______________________________________________________________________ - -$self_APPNAME -v$self_APPVERSION - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ +$( ph.showImlHelpHeader ) Check if a filesystem is readonly in given directories. In each of the given directories a random file will be touched. -- GitLab