From c679d7cbb6b7ce24af6e1600233079a4a0ee21ce Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Mon, 18 Sep 2023 13:18:06 +0200 Subject: [PATCH] prevent broken pipe message in journallog --- check_cpu | 5 +++-- check_psqlserver | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/check_cpu b/check_cpu index 1c03b9a..edf44bf 100755 --- a/check_cpu +++ b/check_cpu @@ -23,12 +23,13 @@ # 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 +# 2023-09-18 v1.15 <axel.hahn@unibe.ch> prevent broken pipe message in journallog # ====================================================================== . $(dirname $0)/inc_pluginfunctions -export self_APPVERSION=1.14 +export self_APPVERSION=1.15 # ---------------------------------------------------------------------- # functions @@ -169,7 +170,7 @@ if [ $iUsed -gt $iMinCpuUsageToShowProcesses ]; then echo "$topout" | sed -n "${iStart},${iEnd}p" | tr '|' ':' echo echo "output of ps:" - ps aux | head -1; ps aux | sort -nrk 3,3 | head -n 5 | tr '|' ':' + ps aux | head -1; ps aux | sort -nrk 3,3 2>/dev/null | head -n 5 | tr '|' ':' echo fi diff --git a/check_psqlserver b/check_psqlserver index 909a35c..4e1afb4 100755 --- a/check_psqlserver +++ b/check_psqlserver @@ -20,12 +20,13 @@ # 2023-06-13 v0.6 <axel.hahn@unibe.ch> no output on activity; update replication check # 2023-06-16 v0.7 <axel.hahn@unibe.ch> update help text # 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 # ====================================================================== . $(dirname $0)/inc_pluginfunctions self_APPNAME=$( basename $0 | tr [:lower:] [:upper:] ) -self_APPVERSION=0.8 +self_APPVERSION=0.9 # --- other vars... cfgfile=/etc/icingaclient/.psql.conf @@ -359,7 +360,7 @@ case "${sMode}" in # --- check: max_leg # max_leg is the maximum value of write_lag,flush_lag,replay_lag # value as sec + "." + millisec ... or empty - MaxLag=$( cut -f 7 -d '|' <<< "${data}" | sort | tail -1 | awk -F: '{ print ($1 * 3600) + ($2 * 60) + $3 }' ) + MaxLag=$( cut -f 7 -d '|' <<< "${data}" | sort 2>/dev/null | tail -1 | awk -F: '{ print ($1 * 3600) + ($2 * 60) + $3 }' ) test -z "$MaxLag" && MaxLag="0" ph.perfadd "max-lag" "${MaxLag}" -- GitLab