diff --git a/about b/about index 44fb6f5d8568d0ff55821d08f04cd197460525ac..93d0fb8847fe62700a87aeaf35eabcf1d441a293 100755 --- a/about +++ b/about @@ -5,14 +5,16 @@ # ABOUT # # ---------------------------------------------------------------------- -# 2023-10-23 v1.0 <axel.hahn@unibe.ch> initial version -# 2023-10-25 v1.1 <axel.hahn@unibe.ch> show disks, show installed versions (WIP) -# 2023-12-22 v1.2 <axel.hahn@unibe.ch> show help +# 2023-10-23 v1.0 <axel.hahn@unibe.ch> initial version +# 2023-10-25 v1.1 <axel.hahn@unibe.ch> show disks, show installed versions (WIP) +# 2023-12-22 v1.2 <axel.hahn@unibe.ch> show help +# 2025-02-10 v1.3 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.2 +export self_APPVERSION=1.3 . /etc/icingaclient/client.cfg 2>/dev/null diff --git a/check_apache_requests b/check_apache_requests index af9f8d17419422fb67e8867db576eeb059693371..6bed6cd39a7754cde34fc4c9f9dd98d69bc31bd4 100755 --- a/check_apache_requests +++ b/check_apache_requests @@ -13,9 +13,12 @@ # 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 +# 2025-02-10 v1.3 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 + export self_APPVERSION=1.6 # url=`hostname -f`/server-status diff --git a/check_ceph_diskfree b/check_ceph_diskfree index b9e9bc3f1cee02256592b74d0886ed75074f976f..3a3b72cd39772d5b5e602d126cf289ef4b6c8b05 100755 --- a/check_ceph_diskfree +++ b/check_ceph_diskfree @@ -22,10 +22,11 @@ # 2023-06-19 v1.4 <axel.hahn@unibe.ch> no more tmpfile # 2023-07-27 v1.5 <axel.hahn@unibe.ch> update help page # 2023-10-20 v1.6 <axel.hahn@unibe.ch> harden sudo command execution -# 2025-02-12 v1.7 <axel.hahn@unibe.ch> Show -w and -c param in help +# 2025-02-10 v1.7 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 export self_APPVERSION=1.7 diff --git a/check_ceph_io b/check_ceph_io index a5034a568e6c1d413baec366453e1233402e143a..9dc42561c9e8b267664ada5cb02b9b70afc004eb 100755 --- a/check_ceph_io +++ b/check_ceph_io @@ -15,16 +15,18 @@ # # ---------------------------------------------------------------------- # 2023-05-09 v1.0 <axel.hahn@unibe.ch> -# 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 -# 2023-10-20 v1.5 <axel.hahn@unibe.ch> harden sudo command execution +# 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 +# 2023-10-20 v1.5 <axel.hahn@unibe.ch> harden sudo command execution +# 2025-02-10 v1.6 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.5 +export self_APPVERSION=1.6 function showHelp(){ local _self; _self=$(basename $0) diff --git a/check_ceph_osd b/check_ceph_osd index 8de525537d8cfe428dd573bdbf62b9865f82c012..7b604219231b2354cb3d02199f2711518b3d655f 100755 --- a/check_ceph_osd +++ b/check_ceph_osd @@ -22,17 +22,19 @@ # ---------------------------------------------------------------------- # 2020-03-04 v1.0 <axel.hahn@iml.unibe.ch> # 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> added params -w -c -# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions -# 2022-10-21 v1.3 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space -# 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> shorten ceph exec; show output on error; shell fixes -# 2023-10-20 v1.7 <axel.hahn@unibe.ch> harden sudo command execution +# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions +# 2022-10-21 v1.3 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space +# 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> shorten ceph exec; show output on error; shell fixes +# 2023-10-20 v1.7 <axel.hahn@unibe.ch> harden sudo command execution +# 2025-02-10 v1.8 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.7 +export self_APPVERSION=1.8 # column number in output where to find the up/ down info iColUpDown=5 diff --git a/check_ceph_status b/check_ceph_status index d2e25fede66d627877316427150e731b19366209..0e2e8c763b4a064aae8d6ee210dbb9c362f956d0 100755 --- a/check_ceph_status +++ b/check_ceph_status @@ -23,11 +23,13 @@ # 2023-07-27 v1.6 <axel.hahn@unibe.ch> update help page # 2023-10-20 v1.7 <axel.hahn@unibe.ch> harden sudo command execution # 2024-02-29 v1.8 <axel.hahn@unibe.ch> show restore progress only for misplaed/ degraded objects +# 2025-02-10 v1.9 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.8 +export self_APPVERSION=1.9 initfile="/tmp/ceph-status-not-ok-start-$USER" diff --git a/check_clientbackup b/check_clientbackup index d9b18fb5ee976db8a19ed28bb903ff9e7fc3e0d3..834d04d7bb531fb35137af35dddb4c91da600fc8 100755 --- a/check_clientbackup +++ b/check_clientbackup @@ -6,24 +6,26 @@ # ---------------------------------------------------------------------- # 2016-12-09 v1.0 first lines # 2016-12-23 v1.1 added readable exitcode from shared functions file -# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions -# 2020-04-04 v1.3 <axel.hahn@iml.unibe.ch> set status unknown if never executed -# 2022-02-17 v1.4 <axel.hahn@iml.unibe.ch> no tmpfile; show more output to see backed up dirs -# 2022-03-07 v1.5 <axel.hahn@iml.unibe.ch> update scan for results in transfer -# 2022-03-18 v1.6 <axel.hahn@iml.unibe.ch> show dumped databases -# 2022-03-21 v1.7 <axel.hahn@iml.unibe.ch> show databases infos for couchdb2 too -# 2022-03-23 v1.8 <axel.hahn@iml.unibe.ch> FIX: exit with error if backup error occured -# 2022-08-10 v1.9 <axel.hahn@iml.unibe.ch> FIX: mask the dot in .log -# 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-07-27 v1.12 <axel.hahn@unibe.ch> add docs url of IML backup -# 2023-09-01 v1.13 <axel.hahn@unibe.ch> add changecounters and performancedata +# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions +# 2020-04-04 v1.3 <axel.hahn@iml.unibe.ch> set status unknown if never executed +# 2022-02-17 v1.4 <axel.hahn@iml.unibe.ch> no tmpfile; show more output to see backed up dirs +# 2022-03-07 v1.5 <axel.hahn@iml.unibe.ch> update scan for results in transfer +# 2022-03-18 v1.6 <axel.hahn@iml.unibe.ch> show dumped databases +# 2022-03-21 v1.7 <axel.hahn@iml.unibe.ch> show databases infos for couchdb2 too +# 2022-03-23 v1.8 <axel.hahn@iml.unibe.ch> FIX: exit with error if backup error occured +# 2022-08-10 v1.9 <axel.hahn@iml.unibe.ch> FIX: mask the dot in .log +# 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-07-27 v1.12 <axel.hahn@unibe.ch> add docs url of IML backup +# 2023-09-01 v1.13 <axel.hahn@unibe.ch> add changecounters and performancedata +# 2025-02-10 v1.14 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.13 +export self_APPVERSION=1.14 sInstalldir=/opt/imlbackup/client/ diff --git a/check_conn b/check_conn index bbf9842adb6cbfc07bb883172f673e8aa09811f7..f0af26d95af0b67012c748bcd9f06c54899dd983 100755 --- a/check_conn +++ b/check_conn @@ -10,12 +10,14 @@ # 2021-11-05 v0.0 <axel.hahn@iml.unibe.ch> # 2023-07-27 v1.1 <axel.hahn@unibe.ch> update help page # 2025-02-10 v1.2 <axel.hahn@unibe.ch> no text on STDERR if portcheck fails +# 2025-02-10 v1.3 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions || exit 1 -export self_APPVERSION=1.2 -cfgfile=$( dirname $0 )/$( basename $0 ).cfg +export self_APPVERSION=1.3 +cfgfile="$0.cfg" out="" # ---------------------------------------------------------------------- @@ -31,7 +33,7 @@ function getChecks(){ function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) @@ -92,7 +94,7 @@ typeset -i iErrors=0 typeset -i iOK=0 typeset -i iCount=0 -for myline in $( echo $configline; getChecks $cfgfile ) +for myline in $( echo "$configline"; getChecks "$cfgfile" ) do iCount=$iCount+1 diff --git a/check_couchdb b/check_couchdb index 1dbae7de834b55ef6e9c445b1ce46d83e84fc9d8..02da514ae823054e791ae4c0261c06c8edfd9fd6 100755 --- a/check_couchdb +++ b/check_couchdb @@ -13,20 +13,21 @@ # - check_couchdb [-h] [-c CFGFILE] -m MODE # # ---------------------------------------------------------------------- -# 2023-08-28 v0.1 <axel.hahn@unibe.ch> first lines -# 2023-08-28 v0.2 <axel.hahn@unibe.ch> first check "up" -# 2023-08-28 v0.3 <axel.hahn@unibe.ch> add check "replication" -# 2023-08-28 v0.4 <axel.hahn@unibe.ch> add check "pending" -# 2023-08-28 v0.5 <axel.hahn@unibe.ch> add checks "open_databases" + "open_os_files" -# 2023-08-28 v0.6 <axel.hahn@unibe.ch> add check "httpd_methods" -# 2023-08-29 v0.7 <axel.hahn@unibe.ch> add check "httpd" -# 2023-08-29 v0.8 <axel.hahn@unibe.ch> add check "httpd_status_codes" -# 2024-01-25 v0.9 <axel.hahn@unibe.ch> "httpd_status_codes" show total requests per sec +# 2023-08-28 v0.1 <axel.hahn@unibe.ch> first lines +# 2023-08-28 v0.2 <axel.hahn@unibe.ch> first check "up" +# 2023-08-28 v0.3 <axel.hahn@unibe.ch> add check "replication" +# 2023-08-28 v0.4 <axel.hahn@unibe.ch> add check "pending" +# 2023-08-28 v0.5 <axel.hahn@unibe.ch> add checks "open_databases" + "open_os_files" +# 2023-08-28 v0.6 <axel.hahn@unibe.ch> add check "httpd_methods" +# 2023-08-29 v0.7 <axel.hahn@unibe.ch> add check "httpd" +# 2023-08-29 v0.8 <axel.hahn@unibe.ch> add check "httpd_status_codes" +# 2025-02-10 v1.0 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=0.8 +export self_APPVERSION=1.0 cfgfile=/etc/icingaclient/.couchdb export RESPONSE diff --git a/check_cpu b/check_cpu index edf44bf8a0e58bd05c49d976bec5bee90e031b51..d5da20c54b7d860eae52ff3fbf3b87d578d355d2 100755 --- a/check_cpu +++ b/check_cpu @@ -24,19 +24,20 @@ # 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 # 2023-09-18 v1.15 <axel.hahn@unibe.ch> prevent broken pipe message in journallog +# 2025-02-10 v1.16 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions - -export self_APPVERSION=1.15 +export self_APPVERSION=1.16 # ---------------------------------------------------------------------- # functions # ---------------------------------------------------------------------- function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_cronstatus b/check_cronstatus index e904cc1403f1f4f1584d8eede5ff3bf54575cde6..86e56fb6f1f8d549165ec7b292c41e7c7b20a392 100755 --- a/check_cronstatus +++ b/check_cronstatus @@ -27,12 +27,13 @@ # 2023-09-18 v2.2 <axel.hahn@unibe.ch> replace pipes in systemctl status output # 2024-04-03 v2.3 <axel.hahn@unibe.ch> add NO_COLOR=1 to supress color and emojis # 2024-04-24 v2.4 <axel.hahn@unibe.ch> add short status on top of details +# 2025-02-10 v2.5 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $( dirname $0 )/inc_pluginfunctions - -export self_APPVERSION=2.4 +export self_APPVERSION=2.5 statusScript=/opt/cronwrapper/cronstatus.sh diff --git a/check_deployment b/check_deployment index a2334e7a387521c7dada1a9717da77062f9234f3..ff12d380878110fd6751eb98669bcea7cd916ffb 100755 --- a/check_deployment +++ b/check_deployment @@ -5,11 +5,13 @@ # # ---------------------------------------------------------------------- # 2023-12-14 v0.1 first lines +# 2025-02-10 v1.0 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=0.1 +export self_APPVERSION=1.0 sInstalldir=/opt/imldeployment-installer diff --git a/check_disk-io b/check_disk-io index 82d57d797883e03cfb96c37498022b21fc481380..f0de5eab04b8482879e933305bc853a599f94264 100755 --- a/check_disk-io +++ b/check_disk-io @@ -14,12 +14,13 @@ # ---------------------------------------------------------------------- # 2020-07-17 v1.0 <axel.hahn@iml.unibe.ch> # 2023-07-27 v1.1 <axel.hahn@unibe.ch> shell fixes; remove unsupported warn and critical +# 2025-02-10 v1.2 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $( dirname $0 )/inc_pluginfunctions - -export self_APPVERSION=1.1 +export self_APPVERSION=1.2 # ---------------------------------------------------------------------- # FUNCTIONS diff --git a/check_dns_responsetime b/check_dns_responsetime index d38b4d966a5247910fcacccffd91f500b94559d2..c184b218dbc01e1f80f94e18afdfadc2861c1548 100755 --- a/check_dns_responsetime +++ b/check_dns_responsetime @@ -13,12 +13,13 @@ # 2022-10-24 v1.2 <axel.hahn@unibe.ch> shell fixes; remove pipe char in output # 2023-07-27 v1.3 <axel.hahn@unibe.ch> shell fixes; add help page # 2023-10-13 v1.4 <axel.hahn@unibe.ch> fix syntax error in export +# 2025-02-10 v1.5 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $( dirname $0 )/inc_pluginfunctions - -export self_APPVERSION=1.4 +export self_APPVERSION=1.5 tmpfile=/tmp/check_netstat_out_$$ infofile=/tmp/check_netstat_out_2_$$ diff --git a/check_docker_info b/check_docker_info index 11278c516c773692a452a121f0e44b9a3181301d..46c63633f88c3ec56c68db8a89e9d5b20772b4a1 100755 --- a/check_docker_info +++ b/check_docker_info @@ -18,13 +18,14 @@ # 2024-01-24 v1.3 <axel.hahn@unibe.ch> remove emoji icons; handle "null" in license info; show rootless or not # 2024-01-29 v1.4 <axel.hahn@unibe.ch> add --target option # 2024-02-13 v1.5 <axel.hahn@unibe.ch> update docker ps --format +# 2025-02-10 v1.6 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$( dirname "$0" )/inc_dockerfunctions.sh" || exit 1 -. $(dirname $0)/inc_pluginfunctions -. $(dirname $0)/inc_dockerfunctions.sh - -self_APPVERSION=1.5 +self_APPVERSION=1.6 # ---------------------------------------------------------------------- # FUNCTIONS diff --git a/check_docker_io b/check_docker_io index f85571dcdfc0714a740e96df01b8d8cccc34d8f1..a755fb9893955e874fce0e1861d4cfaf2f0f8128 100755 --- a/check_docker_io +++ b/check_docker_io @@ -11,13 +11,14 @@ # # ---------------------------------------------------------------------- # 2024-02-22 v0.1 <axel.hahn@unibe.ch> init +# 2025-02-10 v0.2 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$( dirname "$0" )/inc_dockerfunctions.sh" || exit 1 -. $(dirname $0)/inc_pluginfunctions -. $(dirname $0)/inc_dockerfunctions.sh - -self_APPVERSION=0.1 +self_APPVERSION=0.2 typeset -i iRead typeset -i iTrans diff --git a/check_docker_stats b/check_docker_stats index 4ebe86cdcb005394f23139cd173ab3a1a09008d2..357900bf6f55797dcbb138aa7a20538cc137f8c6 100755 --- a/check_docker_stats +++ b/check_docker_stats @@ -15,13 +15,14 @@ # ---------------------------------------------------------------------- # 2024-01-26 v1.0 <axel.hahn@unibe.ch> init # 2024-01-29 v1.1 <axel.hahn@unibe.ch> fix help; detect reason for no output +# 2025-02-10 v1.2 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$( dirname "$0" )/inc_dockerfunctions.sh" || exit 1 -. $(dirname $0)/inc_pluginfunctions -. $(dirname $0)/inc_dockerfunctions.sh - -self_APPVERSION=1.1 +self_APPVERSION=1.2 # ---------------------------------------------------------------------- # FUNCTIONS diff --git a/check_dockercontainer_info b/check_dockercontainer_info index 1ac4e1f472b09d1d1139125fb839ec3081e0e5ac..0ae798b65befc5729abe364424ec77034076ee6c 100755 --- a/check_dockercontainer_info +++ b/check_dockercontainer_info @@ -13,13 +13,14 @@ # ---------------------------------------------------------------------- # 2024-01-18 v0.1 <axel.hahn@unibe.ch> init # 2024-02-13 v1.0 <axel.hahn@unibe.ch> update docker ps --format +# 2025-02-10 v1.1 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$( dirname "$0" )/inc_dockerfunctions.sh" || exit 1 -. $(dirname $0)/inc_pluginfunctions -. $(dirname $0)/inc_dockerfunctions.sh - -self_APPVERSION=1.0 +self_APPVERSION=1.1 # ---------------------------------------------------------------------- # FUNCTIONS diff --git a/check_dockercontainer_top b/check_dockercontainer_top index a4a4fe39ab5c68b4fc6fc155b9822e9615617615..39a3e297eadc077001f11c405c638c2dd93bd741 100755 --- a/check_dockercontainer_top +++ b/check_dockercontainer_top @@ -14,13 +14,14 @@ # ---------------------------------------------------------------------- # 2024-01-26 v1.0 <axel.hahn@unibe.ch> init # 2024-01-29 v1.1 <axel.hahn@unibe.ch> fix help; +# 2025-02-10 v1.2 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$( dirname "$0" )/inc_dockerfunctions.sh" || exit 1 -. $(dirname $0)/inc_pluginfunctions -. $(dirname $0)/inc_dockerfunctions.sh - -self_APPVERSION=1.1 +self_APPVERSION=1.2 # ---------------------------------------------------------------------- # FUNCTIONS diff --git a/check_eol b/check_eol index 391a5335dab8fa24adef5be166b6a2aa67741968..7b8f2acec4faccf574ba188261036f50b43ebd46 100755 --- a/check_eol +++ b/check_eol @@ -50,12 +50,14 @@ # 2022-08-29 v1.5 <axel.hahn@iml.unibe.ch> fix help; shell syntax updates # 2023-01-30 v1.6 <axel.hahn@unibe.ch> add max value in performance data # 2023-07-27 v1.7 <axel.hahn@unibe.ch> update help page +# 2025-02-10 v1.8 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. "$( dirname $0 )/inc_pluginfunctions" -eolcfg="${0}-data/*.cfg" +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.7 +export self_APPVERSION=1.8 +eolcfg="${0}-data/*.cfg" # --- limits typeset -i iDaysWarn=365 diff --git a/check_file_age b/check_file_age index 63cc4b41ba44f3853ed9ad6c44f38270de237804..dca372ae3359976880cefb88f3960eb3b2b639ab 100755 --- a/check_file_age +++ b/check_file_age @@ -5,11 +5,13 @@ # # ---------------------------------------------------------------------- # 2024-06-21 v1.0 <martin.gasser@unibe.ch> +# 2025-02-10 v1.1 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.0 +export self_APPVERSION=1.1 dir_files=/var/iml-backup filter_files='*.*' diff --git a/check_fs_errors b/check_fs_errors index d76e67408e915bec14c640677736bd048932f714..12e95c57a8150f8e2bbc912f4aefd009e4da2c2e 100755 --- a/check_fs_errors +++ b/check_fs_errors @@ -12,12 +12,13 @@ # 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@unibe.ch> shell fixes; update help page # 2023-10-20 v1.3 <axel.hahn@unibe.ch> harden sudo command execution +# 2025-02-10 v1.4 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $( dirname $0 )/inc_pluginfunctions - -export self_APPVERSION=1.3 +export self_APPVERSION=1.4 # ---------------------------------------------------------------------- diff --git a/check_fs_writable b/check_fs_writable index e6c354324a46f22ca1baf815df520722e7873999..c7cb842b9c0ae19a6ab141b5f4456a88536fe087 100755 --- a/check_fs_writable +++ b/check_fs_writable @@ -9,12 +9,13 @@ # ---------------------------------------------------------------------- # 2021-03-23 v0.0 <axel.hahn@iml.unibe.ch> # 2023-07-27 v1.1 <axel.hahn@unibe.ch> shell fixes; update help page +# 2025-02-10 v1.2 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $( dirname $0 )/inc_pluginfunctions - -export self_APPVERSION=1.1 +export self_APPVERSION=1.2 dirs2test="/tmp /var/tmp" out="" diff --git a/check_gitlab_tokens b/check_gitlab_tokens index b839b060881822b5eaa759a406a51e41a9ed056f..6e382c3a4c707271bafb7b22f55e547664067e96 100755 --- a/check_gitlab_tokens +++ b/check_gitlab_tokens @@ -12,12 +12,15 @@ # 2024-10-29 v1.0 <axel.hahn@unibe.ch> # 2024-10-30 v1.1 <axel.hahn@unibe.ch> GITLAB_TOKEN=SKIP responds OK without tests # 2024-11-20 v1.2 <axel.hahn@unibe.ch> Update rest api client +# 2025-02-10 v1.3 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 + cd "$( dirname "$0" )" || exit -. "$( dirname $0 )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.2 +export self_APPVERSION=1.3 sSkipvalue="SKIP" GITLAB_API='https://gitlab.example.com/api/v4' diff --git a/check_haproxy_health b/check_haproxy_health index 1be5adc3ee0a83c6f699dc44d131e0592401886a..4621a4173ac8871407b22eb3eb1fa0ddee7127d3 100755 --- a/check_haproxy_health +++ b/check_haproxy_health @@ -14,15 +14,14 @@ # 2022-10-21 v1.5 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # 2023-07-28 v1.6 <axel.hahn@unibe.ch> add help page # 2023-08-23 v1.7 <axel.hahn@unibe.ch> fix wrong exitcode to "critical" +# 2025-02-10 v1.8 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions - -export self_APPVERSION=1.7 - -. $(dirname $0)/inc_haproxy_cfg.sh - +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$( dirname "$0" )/inc_haproxy_cfg.sh" || exit 1 +export self_APPVERSION=1.8 tmpfile=/tmp/check_haproxy_healthcheck_$$ # ---------------------------------------------------------------------- diff --git a/check_haproxy_status b/check_haproxy_status index d3bce5a3af6b88ec291531f5c1607ee05c6cf9dd..5fa15d72d52874c53e2cd561fa542d76a3266d79 100755 --- a/check_haproxy_status +++ b/check_haproxy_status @@ -18,13 +18,14 @@ # 2022-04-01 v1.6 <axel.hahn@iml.unibe.ch> use wget default params; shell fixes # 2022-10-21 v1.7 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # 2023-07-28 v1.8 <axel.hahn@unibe.ch> add help page +# 2025-02-10 v1.9 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$( dirname "$0" )/inc_haproxy_cfg.sh" || exit 1 -export self_APPVERSION=1.8 - -. $(dirname $0)/inc_haproxy_cfg.sh +export self_APPVERSION=1.9 tmpfile=/tmp/check_haproxy_status_$$ tmpfile2=/tmp/check_haproxy_status2_$$ diff --git a/check_http b/check_http index 61dc91cacae18ed661e4158c1bc44b4fe5b5fb05..8b88fb87685fecc341643a18e2fd2a36f26f9bed 100755 --- a/check_http +++ b/check_http @@ -8,11 +8,13 @@ # # ------------------------------------------------------------------------------- # 2023-09-06 v1.0 <axel.hahn@unibe.ch> -# ================================================================================ +# 2025-02-10 v1.1 <axel.hahn@unibe.ch> harden sourcing files +# ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.0 +export self_APPVERSION=1.1 # ---------------------------------------------------------------------- # FUNCTIONS diff --git a/check_iml_backup_server b/check_iml_backup_server index 9c28caf0258d7c2970e980a28490de6280f6379a..db61e351701a9faf5e755f3e6430a99c83d9581d 100755 --- a/check_iml_backup_server +++ b/check_iml_backup_server @@ -12,11 +12,13 @@ # 2023-12-21 v1.0 <axel.hahn@iml.unibe.ch> first version # 2023-12-21 v1.1 <axel.hahn@iml.unibe.ch> Update help text # 2024-03-22 v1.2 <axel.hahn@iml.unibe.ch> Update grep for backup via restic rest +# 2025-02-10 v1.3 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions -export self_APPVERSION=1.2 +export self_APPVERSION=1.3 sInstalldir=/opt/imlbackup/server sScript=storage_helper.sh diff --git a/check_journallog b/check_journallog index 6652b6ac5913759825068bcbf665d31e29b28ec5..04d2729ed0fb8a2423b0a89a0fbe43fe90491556 100755 --- a/check_journallog +++ b/check_journallog @@ -10,11 +10,13 @@ # ---------------------------------------------------------------------- # 2023-10-12 v0.1 <axel.hahn@unibe.ch> initial version # 2023-10-13 v1.0 <axel.hahn@unibe.ch> update sudo command; set v1.0 +# 2025-02-10 v1.1 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.0 +export self_APPVERSION=1.1 tmpfile=/tmp/last_journallog_line_${USER}.txt diff --git a/check_memory b/check_memory index 358b6854e1ecf06246f9023a02a8e19c185b4405..f8f4928288be64120df848e909aa279d7371f63b 100755 --- a/check_memory +++ b/check_memory @@ -27,12 +27,13 @@ # 2023-02-13 v1.8 <axel.hahn@unibe.ch> shell fixes # 2023-07-28 v1.9 <axel.hahn@unibe.ch> update help page # 2023-09-14 v1.10 <axel.hahn@unibe.ch> fix sort: write failed: 'standard output': Broken pipe +# 2025-02-10 v1.11 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. "$(dirname $0)/inc_pluginfunctions" - -self_APPVERSION=1.10 +self_APPVERSION=1.11 # ---------------------------------------------------------------------- # FUNCTIONS diff --git a/check_mysqlserver b/check_mysqlserver index 2cc6d4cecaf173a214638eb9c46b5bb77744bd96..8a6997535c12431ecfb1ca0dcd8d82ce9e23d5a4 100755 --- a/check_mysqlserver +++ b/check_mysqlserver @@ -22,11 +22,13 @@ # 2023-07-28 v1.0 <axel.hahn@unibe.ch> update help page; fix [client]: command not found # 2023-08-30 v1.1 <axel.hahn@unibe.ch> reverse return code in ph.hasParamoption to unix like return codes: 0=true; <>0 = false # 2024-12-09 v1.2 <axel.hahn@unibe.ch> fix showing help +# 2025-02-10 v1.3 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.2 +export self_APPVERSION=1.3 # --- set HOME HOME=/etc/icingaclient diff --git a/check_netio b/check_netio index 88fb012f808160962568c441676f39c31638d39a..20134be49508d0ab15472180cb57d07138312404 100755 --- a/check_netio +++ b/check_netio @@ -13,12 +13,13 @@ # 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 # 2024-03-26 v1.7 <axel.hahn@unibe.ch> ignore docker and veth interfaces +# 2025-02-10 v1.8 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $( dirname $0 )/inc_pluginfunctions - -export self_APPVERSION=1.7 +export self_APPVERSION=1.8 # network data without non physical interfaces to be removed from /proc/net/dev # - lo - local diff --git a/check_netstat b/check_netstat index 168ac8c943705079cad978e1a480fd358478eec4..c1274c921ec0abb4f81ceadc5b9a78a5377382de 100755 --- a/check_netstat +++ b/check_netstat @@ -10,12 +10,13 @@ # 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 # 2023-08-22 v1.2 <axel.hahn@unibe.ch> update help; small shell fixes +# 2025-02-10 v1.3 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $( dirname $0 )/inc_pluginfunctions - -export self_APPVERSION=1.2 +export self_APPVERSION=1.3 # ---------------------------------------------------------------------- # functions diff --git a/check_onehost b/check_onehost index aa40c9895ed029fb14cc4e41b2a842895c703a5f..b36af13ceda6ff83d81b5b5de3b12cc9e4d8f811 100755 --- a/check_onehost +++ b/check_onehost @@ -12,12 +12,13 @@ # 2023-08-23 v1.2 <axel.hahn@unibe.ch> update help; show help without requirements # 2023-09-15 v1.3 <axel.hahn@unibe.ch> add detection for disabled hosts; update texts # 2023-10-20 v1.4 <axel.hahn@unibe.ch> harden sudo command execution +# 2025-02-10 v1.5 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions - -self_APPVERSION=1.4 +self_APPVERSION=1.5 # ---------------------------------------------------------------------- # functions diff --git a/check_onevm b/check_onevm index deae829c76205b0a72946ffdf4ee3f49894d5f8c..d15fdcda506c9a23c8114a580bb4d72897f603f3 100755 --- a/check_onevm +++ b/check_onevm @@ -40,12 +40,13 @@ # 2023-08-23 v1.2 <axel.hahn@unibe.ch> update help; show help without requirements # 2023-10-20 v1.3 <axel.hahn@unibe.ch> harden sudo command execution # 2024-10-04 v1.4 <axel.hahn@unibe.ch> added bak, rest, drsz; backup won't result in warning +# 2025-02-10 v1.5 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions - -self_APPVERSION=1.4 +self_APPVERSION=1.5 # new line NL=" diff --git a/check_opencpu b/check_opencpu index 253daa76f9864f7a038468d7b2b8bc37d7bfb2d1..ace024e378b1cdef47c022a5ae11600765c608af 100755 --- a/check_opencpu +++ b/check_opencpu @@ -21,11 +21,13 @@ # 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions # 2022-04-01 v1.3 <axel.hahn@iml.unibe.ch> use wget default params; shell fixes # 2023-08-23 v1.4 <axel.hahn@unibe.ch> add help; add param -p; fix critical status +# 2025-02-10 v1.5 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions -self_APPVERSION=1.4 +self_APPVERSION=1.5 tmpOk=/tmp/check_opencpu-ok tmpErr=/tmp/check_opencpu-error diff --git a/check_packages2install b/check_packages2install index 9d6c2cc6cc5f0c6575d42069fb95752fa7628f6d..2281f93c6e8573491f3323691edf80de81d2d572 100755 --- a/check_packages2install +++ b/check_packages2install @@ -26,11 +26,13 @@ # 2022-10-21 v1.11 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # 2023-08-24 v1.12 <axel.hahn@unibe.ch> update help; rename to getSecurityCount # 2023-10-20 v1.13 ah harden sudo command execution +# 2025-02-10 v1.14 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions -self_APPVERSION=1.13 +self_APPVERSION=1.14 readonly iWarnDefault=1 readonly iCriticalDefault=200 diff --git a/check_php-fpm-status b/check_php-fpm-status index 37ca114f16db4da8ef8ddc4640917a9ab9eae0c8..c00576e936a62fcc62ca7b3d1795205fbecc7b65 100755 --- a/check_php-fpm-status +++ b/check_php-fpm-status @@ -15,11 +15,13 @@ # 2022-07-08 v0.8 <axel.hahn@iml.unibe.ch> eliminate division by 0 # 2022-10-21 v1.0 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # 2023-08-24 v1.1 <axel.hahn@unibe.ch> update help; do not use tmp file anymore +# 2025-02-10 v1.2 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.1 +export self_APPVERSION=1.2 outFpmStatus= defaulturl=localhost/status diff --git a/check_proc_mem b/check_proc_mem index cc73aebd101eff5ce1819846b35dfedaf5771854..00b62121ab9d76979f1f9206fede0332a60c3449 100755 --- a/check_proc_mem +++ b/check_proc_mem @@ -14,11 +14,13 @@ # 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions # 2023-02-13 v1.2 <axel.hahn@unibe.ch> some shell fixes # 2023-12-22 v1.3 <axel.hahn@unibe.ch> add help; do not use tmp file anymore; 5..10 times faster +# 2025-02-10 v1.4 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.3 +export self_APPVERSION=1.4 typeset -i iSizeMB diff --git a/check_proc_ressources b/check_proc_ressources index ba3e48122c6a8bcc59b7c3fa340f7b40ecce509c..bf431c37aa932d05da02d8dbe8b05cd0989a43ea 100755 --- a/check_proc_ressources +++ b/check_proc_ressources @@ -16,11 +16,13 @@ # 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions # 2020-06-06 v1.2 <axel.hahn@iml.unibe.ch> for cpu: limits are multiplicated with count of cpu # 2023-12-22 v1.3 <axel.hahn@unibe.ch> update help; no temp files +# 2025-02-10 v1.4 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.3 +export self_APPVERSION=1.4 # --- limits iWarnLimitCpu=70 diff --git a/check_proc_zombie b/check_proc_zombie index ec342685954b9aea5a6dd9d70d52353db2ff4062..ec82c1f4cc1a9a2484e3d624fcb2ee73a6bd1c33 100755 --- a/check_proc_zombie +++ b/check_proc_zombie @@ -8,14 +8,16 @@ # # ---------------------------------------------------------------------- # 2020-03-10 v1.0 <axel.hahn@iml.unibe.ch> -# 2020-07-08 v1.1 <axel.hahn@iml.unibe.ch> FIX: set "ph." instead "ps." -# 2024-06-07 v1.2 <axel.hahn@unibe.ch> update help and add docs link +# 2020-07-08 v1.1 <axel.hahn@iml.unibe.ch> FIX: set "ph." instead "ps." +# 2024-06-07 v1.2 <axel.hahn@unibe.ch> update help and add docs link +# 2025-02-10 v1.3 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. `dirname $0`/inc_pluginfunctions -tmpfile=/tmp/check_proc_zombie_$$ +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.2 +export self_APPVERSION=1.3 +tmpfile=/tmp/check_proc_zombie_$$ # show help function showHelp(){ diff --git a/check_psqlserver b/check_psqlserver index 47c0e7f03ce2fd43b5f26d63936d6de3030b6939..3fa00e4896f7faa4cbd35a4e4cd53ece5bc69fb1 100755 --- a/check_psqlserver +++ b/check_psqlserver @@ -22,12 +22,13 @@ # 2023-08-30 v0.8 <axel.hahn@unibe.ch> reverse return code in ph.hasParamoption to unix like return codes: 0=true; <>0 = false # 2023-09-18 v0.9 <axel.hahn@unibe.ch> prevent broken pipe message in journallog # 2025-02-11 v1.0 <axel.hahn@unibe.ch> add default banner for IML checks +# 2025-02-10 v1.1 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=0.9 +self_APPVERSION=1.1 # --- other vars... cfgfile=/etc/icingaclient/.psql.conf @@ -110,7 +111,7 @@ EOF # show help function _usage(){ - local _self=$( basename $0 ) + local _self; _self="$( basename "$0" )" cat <<EOH $( ph.showImlHelpHeader ) diff --git a/check_rearbackup b/check_rearbackup index 9b85ba3a7371efbd4cb418054d608bc4d0f4c89d..49c9b39268076fd876aa6649bdeca64c5fa5ce3e 100755 --- a/check_rearbackup +++ b/check_rearbackup @@ -5,11 +5,13 @@ # # ---------------------------------------------------------------------- # 2023-12-22 v1.0 <axel.hahn@unibe.ch> +# 2025-02-10 v1.1 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.0 +export self_APPVERSION=1.1 dir_reardata=/rearshare/rear-backup @@ -31,7 +33,7 @@ typeset -i iLimitCritical=14 # show help text function showHelp(){ - local _self; _self=$(basename $0) + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) diff --git a/check_reboot_required b/check_reboot_required index 4fad65100c71325d00e712f567b2b45eb38ca20c..3d0bf07ea450b2c6e8c30e6e0b76bb937b0489d1 100755 --- a/check_reboot_required +++ b/check_reboot_required @@ -10,20 +10,19 @@ # - ubuntu10+ # ---------------------------------------------------------------------- # 2016-08-12 added ouput of packages -# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions -# 2022-10-14 v1.3 <axel.hahn@unibe.ch> fix debian output if /var/run/reboot-required.pkgs does not exist -# Shellfixes; add help -# 2023-03-29 v1.4 <martin.gasser@unibe.ch> add almalinux as distro -# 2024-03-07 v1.4 <martin.gasser@unibe.ch> add rocky as distro -# 2025-02-11 v1.5 <axel.hahn@unibe.ch> add default banner for IML checks; add support for manjaro +# 2020-03-05 v1.2 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions +# 2022-10-14 v1.3 <axel.hahn@unibe.ch> fix debian output if /var/run/reboot-required.pkgs does not exist +# Shellfixes; add help +# 2023-03-29 v1.4 <martin.gasser@unibe.ch> add almalinux as distro +# 2024-03-07 v1.4 <martin.gasser@unibe.ch> add rocky as distro +# 2025-02-11 v1.5 <axel.hahn@unibe.ch> add default banner for IML checks; add support for manjaro +# 2025-02-10 v1.6 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions - -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.5 - +self_APPVERSION=1.6 distro=$( ph.getOS ) # ---------------------------------------------------------------------- @@ -31,6 +30,7 @@ distro=$( ph.getOS ) # ---------------------------------------------------------------------- function showHelp(){ + local _self; _self="$( basename "$0" )" cat <<EOF $( ph.showImlHelpHeader ) @@ -48,7 +48,8 @@ If your distro is based on Arch, Centos or Debian then it easily can be added in the script if it does not work. Report the distro name to the author. SYNTAX: -$(basename $0) + + $_self OPTIONS: @@ -58,9 +59,6 @@ PARAMETERS: None. -EXAMPLE: -$(basename $0) - EOF } # ---------------------------------------------------------------------- diff --git a/check_requirements b/check_requirements index ab209325aa75455213227c07345d423d9cc25ec9..2664f76458b80ce70bc68b9826b64bf320cbd63b 100755 --- a/check_requirements +++ b/check_requirements @@ -13,14 +13,15 @@ # 2023-02-15 v1.1 ah add label # 2024-06-07 v1.2 ah use iml help and add link to docs # 2025-02-11 v1.3 ah add ping check; add timeout in connection check +# 2025-02-10 v1.4 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. "$( dirname $0 )/inc_pluginfunctions" +self_APPVERSION=1.4 -self_APPVERSION=1.3 - -self=$( basename $0 ) +self="$( basename "$0" )" typeset -i VERBOSE=0 diff --git a/check_smartstatus b/check_smartstatus index 43b9d03e94a2888231c3d97d68a206897db16784..7af6668d7e55ad35e0d2c528e03b476ca218bf46 100755 --- a/check_smartstatus +++ b/check_smartstatus @@ -32,19 +32,20 @@ # 2016-12-23 v0.3 ah,ds # 2018-12-06 v0.4 ah,ds show details for each disc # 2020-02-27 v0.5 ah,ds add /sbin to PATH variable -# 2020-03-05 v1.0 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions -# 2021-01-22 v1.1 <axel.hahn@iml.unibe.ch> add status [no access] -# 2021-04-07 v1.2 <axel.hahn@iml.unibe.ch> update message if sudo smartctl -H fails -# 2021-10-28 v1.3 <axel.hahn@iml.unibe.ch> detect -d param for smartctl -# 2022-07-08 v1.4 <axel.hahn@iml.unibe.ch> remove pipe in status line -# 2023-10-20 v1.5 <axel.hahn@unibe.ch> harden sudo command execution -# 2024-06-07 v1.6 <axel.hahn@unibe.ch> add help page; use smartctl --scan to detect devices +# 2020-03-05 v1.0 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions +# 2021-01-22 v1.1 <axel.hahn@iml.unibe.ch> add status [no access] +# 2021-04-07 v1.2 <axel.hahn@iml.unibe.ch> update message if sudo smartctl -H fails +# 2021-10-28 v1.3 <axel.hahn@iml.unibe.ch> detect -d param for smartctl +# 2022-07-08 v1.4 <axel.hahn@iml.unibe.ch> remove pipe in status line +# 2023-10-20 v1.5 <axel.hahn@unibe.ch> harden sudo command execution +# 2024-06-07 v1.6 <axel.hahn@unibe.ch> add help page; use smartctl --scan to detect devices +# 2025-02-10 v1.7 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions - -self_APPVERSION=1.6 +self_APPVERSION=1.7 typeset -i iFound=0 typeset -i iErrors=0 diff --git a/check_snmp_data b/check_snmp_data index 212c4f002d3e2c8ac221c5d06332e032a98bd7e9..f1ba7d0e24c22dac275f2e3d35cb846c970fad40 100755 --- a/check_snmp_data +++ b/check_snmp_data @@ -63,23 +63,22 @@ # DATA:synoio:out:data:syno-io-write:1.3.6.1.4.1.6574.102.1.1.13.1 # # ---------------------------------------------------------------------- -# 2020-08-11 <axel.hahn@iml.unibe.ch> initial version -# 2020-08-13 <axel.hahn@iml.unibe.ch> add host in label for counter data -# 2022-10-21 v0.4 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space +# 2020-08-11 <axel.hahn@iml.unibe.ch> initial version +# 2020-08-13 <axel.hahn@iml.unibe.ch> add host in label for counter data +# 2022-10-21 v0.4 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # 2022-10-21 v0.5 <andrea.gottsponer@unibe.ch> remove grep: warning: stray \ before white space -# 2022-10-25 v0.6 <axel.hahn@unibe.ch> fix empty value in performance data; shell fixes -# 2023-05-05 v0.7 <axel.hahn@unibe.ch> source shared func, support snmpv3; add synoio -# 2023-05-16 v0.8 <axel.hahn@unibe.ch> add about for general infos and without perf data -# 2025-02-12 v1.0 <axel.hahn@unibe.ch> add IML header in help +# 2022-10-25 v0.6 <axel.hahn@unibe.ch> fix empty value in performance data; shell fixes +# 2023-05-05 v0.7 <axel.hahn@unibe.ch> source shared func, support snmpv3; add synoio +# 2023-05-16 v0.8 <axel.hahn@unibe.ch> add about for general infos and without perf data +# 2025-02-12 v1.0 <axel.hahn@unibe.ch> add IML header in help +# 2025-02-10 v1.1 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions -. $(dirname $0)/check_snmp_includes - -# --- basic vars -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.0 +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$(dirname "$0" )/check_snmp_includes" || exit 1 +self_APPVERSION=1.1 METHOD="" # --- output variables diff --git a/check_snmp_printer b/check_snmp_printer index 0d07fabb136fa52480080f55cb05ca0ab7e33dc8..3506a891d5a5b924bdf3e1d69ad08d1c8869f6b5 100755 --- a/check_snmp_printer +++ b/check_snmp_printer @@ -12,21 +12,18 @@ # except "-c <script>" # # ------------------------------------------------------------ -# 2021-03-22 <axel.hahn@iml.unibe.ch> v0.1 -# 2023-09-18 <axel.hahn@iml.unibe.ch> v0.2 snmpv3 support -# 2023-10-12 <axel.hahn@iml.unibe.ch> v0.3 parameter for custom script; detect debian -# 2025-02-12 <axel.hahn@unibe.ch> v1.0 add help and debug param -# ============================================================ - -# ------------------------------------------------------------ -# CONFIG -# ------------------------------------------------------------ - -. $( dirname $0 )/inc_pluginfunctions -. $( dirname $0 )/check_snmp_includes - -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.0 +# 2021-03-22 v0.1 <axel.hahn@iml.unibe.ch> +# 2023-09-18 v0.2 <axel.hahn@iml.unibe.ch> snmpv3 support +# 2023-10-12 v0.3 <axel.hahn@iml.unibe.ch> parameter for custom script; detect debian +# 2025-02-12 v1.0 <axel.hahn@unibe.ch> add help and debug param +# 2025-02-10 v1.1 <axel.hahn@unibe.ch> harden sourcing files +# ====================================================================== + +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$( dirname $0 )/check_snmp_includes" || exit 1 + +self_APPVERSION=1.1 debug=0 diff --git a/check_snmp_synology b/check_snmp_synology index 8d2c01e2674cab43d7c16ae0309c63421a6c64ed..23baedada0229a18bf4dee208216e86f6e817c73 100755 --- a/check_snmp_synology +++ b/check_snmp_synology @@ -1,11 +1,5 @@ #!/bin/bash -# check_snmp_synology for nagios version 1.2 -# 30.04.2013 Nicolas Ordonez, Switzerland -# 08.08.2020 Axel Hahn: add update, community string -# 03.05.2023 v1.2 Axel Hahn: support Snmpv3 connections -# 09.05.2023 v1.3 Axel Hahn: allow complete check or single check(s) -# 12.05.2023 v1.4 Axel Hahn: no raid size check (DSM 5.x) -# 12.02.2025 v1.5 Axel Hahn: update header in help with link to online help +# check_snmp_synology for nagios # ---------------------------------------------------------------------- # this plugin check the health of your Synology NAS # - System status (Power, Fans) @@ -18,14 +12,20 @@ # see docs: # https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_DiskStation_MIB_Guide.pdf # ---------------------------------------------------------------------- +# 30.04.2013 Nicolas Ordonez, Switzerland +# 08.08.2020 Axel Hahn: add update, community string +# 03.05.2023 v1.2 Axel Hahn: support Snmpv3 connections +# 09.05.2023 v1.3 Axel Hahn: allow complete check or single check(s) +# 12.05.2023 v1.4 Axel Hahn: no raid size check (DSM 5.x) +# 12.02.2025 v1.5 <axel.hahn@unibe.ch> update header in help with link to online help +# 2025-02-10 v1.6 <axel.hahn@unibe.ch> harden sourcing files +# ====================================================================== -. $(dirname $0)/inc_pluginfunctions -. $(dirname $0)/check_snmp_includes - -# --- basic vars +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 +. "$( dirname "$0" )/check_snmp_includes" || exit 1 -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.5 +self_APPVERSION=1.6 SNMPOUTPUT= option_found=0 diff --git a/check_ssl b/check_ssl index 566d5e6eb7393e33d6b1c9f664a7feea2e002ed4..f162278d59803a72b8814db310471524a533a6c9 100755 --- a/check_ssl +++ b/check_ssl @@ -19,13 +19,13 @@ # 2023-02-13 v1.2 <axel.hahn@unibe.ch> some shell fixes # 2023-08-23 v1.3 <axel.hahn@unibe.ch> fix wrong exitcode to "critical" # 2025-02-12 v1.4 <axel.hahn@unibe.ch> add IML header in help; add warning and critical level +# 2025-02-10 v1.5 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. $(dirname $0)/inc_pluginfunctions - -self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=1.4 +self_APPVERSION=1.5 sDomain= iPort=443 diff --git a/check_ssl_certs b/check_ssl_certs index 9604ceb8713bf56afbaaceb343d96bbdc1f6a3a1..4b2197cba212f7543ac6541fd6520852e46cb7b1 100755 --- a/check_ssl_certs +++ b/check_ssl_certs @@ -14,10 +14,13 @@ # 2022-03-16 v0.2 <axel.hahn@iml.unibe.ch> shell fixes; shorten perfdata label # 2022-10-21 v1.3 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # 2024-04-24 v1.4 <axel.hahn@unibe.ch> update for newer openssl version; update help +# 2025-02-10 v1.5 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions -self_APPVERSION=1.4 +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 + +self_APPVERSION=1.5 typeset -i iWarn=14 typeset -i iCrit=5 diff --git a/check_systemdservices b/check_systemdservices index 565449976da9f2de28ccf7df2e77d2c2262a1e40..6acd6e986d12ff5d20a330ba575a8885222f1dbf 100755 --- a/check_systemdservices +++ b/check_systemdservices @@ -20,9 +20,13 @@ # 2020-04-02 v1.2 <axel.hahn@iml.unibe.ch> added ph.execIfReady in _init # 2021-10-21 v1.3 <axel.hahn@iml.unibe.ch> remove starting spaces in systemctl output # 2022-04-14 v1.4 <axel.hahn@iml.unibe.ch> remove any special chars at beginning of line -# ================================================================================ +# 2025-02-10 v1.5 <axel.hahn@unibe.ch> harden sourcing files +# ====================================================================== + +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. `dirname $0`/inc_pluginfunctions +self_APPVERSION=1.5 cfgfile="$0.cfg" ignorefile="$0.ignore" diff --git a/check_systemdunit b/check_systemdunit index 54360894babf1759fcbdeecedfbdb896beb1f875..8a57587aa39ca22e902d427d80c2aa271b8bf292 100755 --- a/check_systemdunit +++ b/check_systemdunit @@ -12,11 +12,13 @@ # 2020-10-20 v1.5 <axel.hahn@unibe.ch> remove special chars from systemd status # 2020-10-23 v1.6 <axel.hahn@unibe.ch> handle units with multiple instrances # 2020-11-03 v1.7 <axel.hahn@unibe.ch> autodetect multiple instances without @ char in unit name -# ================================================================================ +# 2025-02-10 v1.8 <axel.hahn@unibe.ch> harden sourcing files +# ====================================================================== -. $( dirname $0 )/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -export self_APPVERSION=1.7 +export self_APPVERSION=1.8 # ---------------------------------------------------------------------- # FUNCTIONS diff --git a/check_timesync b/check_timesync index 91df8e0daddc4b9b1992caf807a0f3699ac48c2e..cdef18f79bf86d4166212c7f7837d1707ec457e3 100755 --- a/check_timesync +++ b/check_timesync @@ -12,14 +12,17 @@ # - ubuntu16 # ---------------------------------------------------------------------- # 2018-10-26 v1.0 <axel.hahn@iml.unibe.ch> -# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions -# 2020-05-13 v1.2 <axel.hahn@iml.unibe.ch> update pre detect output of timedatectl +# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions +# 2020-05-13 v1.2 <axel.hahn@iml.unibe.ch> update pre detect output of timedatectl # 2021-08-19 v1.3 <martin.gasser@iml.unibe.ch> update for chrony with timedatectl -# 2025-02-19 v1.4 <axel.hahn@unibe.ch> update help page +# 2025-02-19 v1.4 <axel.hahn@unibe.ch> update help page +# 2025-02-10 v1.5 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== -. $(dirname $0)/inc_pluginfunctions -self_APPVERSION=1.4 +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 + +self_APPVERSION=1.5 myos="$( ph.getOS )" tmpfile=/tmp/check_timesync.tmp diff --git a/check_uptime b/check_uptime index d160254fcab1d6fbc0c8f94ba3582bfa5cdbefe7..9442f2c06721e52276d5ba0aa3d9288ddded437b 100755 --- a/check_uptime +++ b/check_uptime @@ -20,11 +20,13 @@ # 2020-07-02 v1.3 <axel.hahn@iml.unibe.ch> use sec for performance data # 2022-10-21 v1.4 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # 2025-02-19 v1.5 <axel.hahn@unibe.ch> add help: remove IML specific check for auto updates; add idletime +# 2025-02-10 v1.6 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 -. "$( dirname "$0" )/inc_pluginfunctions" -self_APPVERSION=1.5 +self_APPVERSION=1.6 # ---------------------------------------------------------------------- diff --git a/inc_dockerfunctions.sh b/inc_dockerfunctions.sh index e34e4251638290a06201a834cd8b1f26bef36cb9..a131e310a4c1555f1173070977e32530039376e0 100644 --- a/inc_dockerfunctions.sh +++ b/inc_dockerfunctions.sh @@ -13,10 +13,11 @@ # ---------------------------------------------------------------------- # 2024-01-19 v1.0 <axel.hahn@unibe.ch> init # 2024-01-29 v1.1 <axel.hahn@unibe.ch> _detectDockererror +# 2025-02-10 v1.2 <axel.hahn@unibe.ch> harden sourcing files # ====================================================================== - -. $(dirname $0)/inc_pluginfunctions +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 _is_docker_rootless=0 _is_docker_detected=0 diff --git a/zz_template_check_xyz b/zz_template_check_xyz index 8419392e84bb5319d97d0782c4984dde90fc0402..d1a665913fbbecd4384fd9b2b8c48693fa002fd9 100644 --- a/zz_template_check_xyz +++ b/zz_template_check_xyz @@ -7,29 +7,30 @@ # 202n-nn-nn v0.0 <name@unibe.ch> initial version # ====================================================================== +# shellcheck source=/dev/null +. "$( dirname "$0" )/inc_pluginfunctions" || exit 1 + + +self_APPVERSION=0.0 -. `dirname $0`/inc_pluginfunctions # ---------------------------------------------------------------------- # functions # ---------------------------------------------------------------------- +# show help text function showHelp(){ + local _self; _self="$( basename "$0" )" cat <<EOF -______________________________________________________________________ - -CHECK_XYZ !!! add a short description - -(c) Institute for Medical Education - University of Bern -Licence: GNU GPL 3 -______________________________________________________________________ +$( ph.showImlHelpHeader ) !!! Add some information what the check does. !!! add / remove params in syntax, options and example SYNTAX: -`basename $0` [-w WARN_LIMIT] [-c CRITICAL_LIMIT] + + $_self [-h] OPTIONS: @@ -40,13 +41,15 @@ OPTIONS: PARAMETERS: - None. + None. EXAMPLE: -`basename $0` -w 60 -c 80 + + $_self -w 60 -c 80 EOF } + # ---------------------------------------------------------------------- # MAIN # ----------------------------------------------------------------------