diff --git a/check_ceph_osd b/check_ceph_osd index f14fd97042f73bdc475aee153fdd23528de09d20..4f8160f45ba48a8deb14d6f28a3b4fc7f5719014 100755 --- a/check_ceph_osd +++ b/check_ceph_osd @@ -22,6 +22,7 @@ # 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 # ====================================================================== . `dirname $0`/inc_pluginfunctions @@ -34,7 +35,7 @@ tmpfile=/tmp/ceph_status_output_$$ # fetch lines of OSD entries only from output of ceph osd tree function getOsd(){ - grep "^\ *[0-9]" $tmpfile + grep "^ *[0-9]" $tmpfile } # ---------------------------------------------------------------------- diff --git a/check_haproxy_status b/check_haproxy_status index 42a1f4a2767bc638be1c3e72af2aab063501b650..3823b4d8130233f2d2b2e70466d88cbefd3db80b 100755 --- a/check_haproxy_status +++ b/check_haproxy_status @@ -16,6 +16,7 @@ # 2020-12-03 v1.4 <axel.hahn@iml.unibe.ch> added support of multiple front- and backends # 2021-12-14 v1.5 <axel.hahn@iml.unibe.ch> use updated haproxy paser in sourced file # 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 # ====================================================================== . $(dirname $0)/inc_pluginfunctions @@ -41,7 +42,7 @@ if [ $? -ne 0 ]; then ph.abort "UNKNOWN: unable to read ha proxy config $cfgfile ... `ls -l $cfgfile`" fi -cat $cfgfile | grep "\ mode\ .*http" >/dev/null +cat $cfgfile | grep " mode .*http" >/dev/null if [ $? -ne 0 ]; then ph.abort "UNKNOWN: haproxy is not in http mode" fi diff --git a/check_packages2install b/check_packages2install index f093cae91a4e594d77d7444f0df8985b701ad3b1..9a548c52b4f8060228a3b56746a4e64b7512602e 100755 --- a/check_packages2install +++ b/check_packages2install @@ -23,6 +23,7 @@ # 2022-06-03 v1.9 <axel.hahn@iml.unibe.ch> call yum with path; shellcheck updates; plugin like package managers # 2022-06-07 v1.10 <axel.hahn@iml.unibe.ch> fix iPkg2Update on empty package list # rename package manager functions +# 2022-10-21 v1.11 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # ====================================================================== @@ -49,7 +50,7 @@ function _showAutoupdate(){ if ls ${cronfile} >/dev/null 2>&1 then echo Autoupdate ON - if grep "\ \-r" ${cronfile} >/dev/null 2>&1 + if grep -- " -r" ${cronfile} >/dev/null 2>&1 then echo Autoreboot ON else diff --git a/check_packages2install-pkgmanager/apt.sh b/check_packages2install-pkgmanager/apt.sh index 877722d73b49d8d51ed2aca3b8cf98479a352b93..b7c16a6e925be6fbde3de9c8233088358fd67361 100644 --- a/check_packages2install-pkgmanager/apt.sh +++ b/check_packages2install-pkgmanager/apt.sh @@ -7,10 +7,11 @@ # included by ../check_packages2install # # --------------------------------------------------------------- -# ah <axel.hahn@iml.unibe.ch> +# ah <axel.hahn@unibe.ch> # 2022-06-03 v1.0 ah first version # 2022-06-07 v1.1 ah remove text "Nothing to install" # rename functions +# 2022-10-21 v1.3 ah remove grep: warning: stray \ before white space # =============================================================== @@ -32,7 +33,7 @@ function apt.getPackageList(){ if [ $iStart -gt 0 ]; then # show packages = text starting with 2 spaces below start line # packages are delimited with space -> replace with new line - echo "$packagemanOut" | sed -n $iStart,\$p | grep "^\ \ " | sed "s#^\ \ ##g" | tr " " "\n" + echo "$packagemanOut" | sed -n $iStart,\$p | grep "^ " | sed "s#^\ \ ##g" | tr " " "\n" fi } diff --git a/check_php-fpm-status b/check_php-fpm-status index af153e588956b3f6d822f75be725cdb6eaf2f50e..43ece8ec6c98c73acd5fe58239479992a14b7ac3 100755 --- a/check_php-fpm-status +++ b/check_php-fpm-status @@ -13,6 +13,7 @@ # 2022-04-01 v0.6 <axel.hahn@iml.unibe.ch> use wget default params; shell fixes # 2022-05-09 v0.7 <axel.hahn@iml.unibe.ch> use wget default params # 2022-07-08 v0.8 <axel.hahn@iml.unibe.ch> eliminate division by 0 +# 2022-10-21 v1.3 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # ====================================================================== . $(dirname $0)/inc_pluginfunctions @@ -28,7 +29,7 @@ sDeltaunit="min" # get service data from json output function _getServicedata(){ - cat $tmpfile | jq | grep '^\ \ "' | grep -v "\[" | cut -f 1 -d "," + cat $tmpfile | jq | grep '^ "' | grep -v "\[" | cut -f 1 -d "," } function _getWorkerStates(){ @@ -61,7 +62,7 @@ function _getWorkerOfState(){ # param string variable (part before ":") function _getvalue(){ # grep "^$1:" $tmpfile | cut -d ":" -f 2 | awk '{ print $1 }' - _getServicedata | grep "^\ \ \"$1\":" | cut -d ":" -f 2 | awk '{ print $1 }' + _getServicedata | grep "^ "$1\":" | cut -d ":" -f 2 | awk '{ print $1 }' } diff --git a/check_sensuplugins b/check_sensuplugins index d2e0c2c2b3413f098dcdc0feb84031e7fdf8dab8..0b1f8eab5c17c59843edd72920f1a865ff7a2cd4 100755 --- a/check_sensuplugins +++ b/check_sensuplugins @@ -7,6 +7,7 @@ # # ---------------------------------------------------------------------- # 2018-07-17 first lines +# 2022-10-21 v1.1 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # ====================================================================== . `dirname $0`/inc_pluginfunctions @@ -19,7 +20,7 @@ tmpfile=/tmp/check_sensuplugins.out # ---------------------------------------------------------------------- function _getStatus(){ - cat $tmpfile | grep '^\.\.\.' | grep "\ $1\:" + cat $tmpfile | grep '^\.\.\.' | grep " $1\:" } function getTotal(){ diff --git a/check_snmp_data b/check_snmp_data index d25ddc458d2d0614dadb7acf606b520d59ef0274..6fc4dab420db30399a196111d1f5b740cd109df9 100755 --- a/check_snmp_data +++ b/check_snmp_data @@ -36,12 +36,13 @@ # ---------------------------------------------------------------------- # 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 # ====================================================================== . `dirname $0`/inc_pluginfunctions # --- basic vars -ABOUT="SNMP performance data v0.3" +ABOUT="SNMP performance data v0.4" SNMPCOMMUNITY="public" SNMPVERSION="2c" SNMPGET=$(which snmpget) @@ -75,7 +76,7 @@ _wd() # get line(s) for config # param string one of label|data _cfg_reader(){ - grep "^#\ DATA:$METHOD:$1:" $0 + grep "^# DATA:$METHOD:$1:" $0 } _cfg_getlabel(){ _cfg_reader "label" | cut -f 4- -d ":" @@ -89,7 +90,7 @@ _cfg_dataitem(){ # get a list existing methods _cfg_getMethods(){ - grep "^#\ DATA:.*:label:" $0 | cut -f 2 -d ":" + grep "^# DATA:.*:label:" $0 | cut -f 2 -d ":" } #--------------------------------------------------- diff --git a/check_ssl_certs b/check_ssl_certs index 5208861458b7db929d5e72096c1901ed9ae73ecc..b4d52b84790ba31f9946f85b80667f4249c22030 100755 --- a/check_ssl_certs +++ b/check_ssl_certs @@ -12,6 +12,7 @@ # ---------------------------------------------------------------------- # 2021-10-06 v0.1 <axel.hahn@iml.unibe.ch> initial version # 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 # ====================================================================== . $(dirname $0)/inc_pluginfunctions @@ -117,7 +118,7 @@ for mycert in $( ls -1 $filelist 2>/dev/null ) do iCounter=$iCounter+1 data=$(openssl x509 -noout -text -in $mycert 2>/dev/null ) - mySubject=$( echo "$data" | grep "Subject:\ CN\ =\ " | grep -v "," | cut -f 2- -d "=" | cut -c 2- ) + mySubject=$( echo "$data" | grep "Subject: CN = " | grep -v "," | cut -f 2- -d "=" | cut -c 2- ) mySubject2="${mySubject//${myDomain}}" if [ -z "$mySubject" ]; then @@ -126,7 +127,7 @@ do !!! WARNING: File $mycert is no client certificate. HINT: adjust your file filter in -f FILEFILTER" else - dateExpire=$( echo "$data" | grep "Not\ After" | cut -f 2- -d ":" ) + dateExpire=$( echo "$data" | grep "Not After" | cut -f 2- -d ":" ) typeset -i iExpire=$( date +%s -d "$dateExpire" ) typeset -i iLeft=($iExpire-$iNow)/60/60/24 @@ -149,7 +150,7 @@ do shortstatus="${shortstatus}${result} ${mySubject} [${iLeft}d] ; " fullstatus="${fullstatus} ----- [$iCounter of $iTotal] ${mySubject} - expires in $iLeft days $mySubject2 -$( echo "$data" | grep -E "(DNS:|Issuer:|Not\ |Subject:)" | sed 's#^\ *##g') +$( echo "$data" | grep -E "(DNS:|Issuer:|Not |Subject:)" | sed 's#^ *##g') File: $mycert " diff --git a/check_uptime b/check_uptime index 197ff0457b41cfde4e6618eacff18087a643637c..2310c9558ba625c88d2b46a254d65467a048b7c3 100755 --- a/check_uptime +++ b/check_uptime @@ -18,6 +18,7 @@ # 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions # 2020-03-10 v1.2 <axel.hahn@iml.unibe.ch> add performance data # 2020-07-02 v1.3 <axel.hahn@iml.unibe.ch> use sec for performance data +# 2022-10-21 v1.3 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # ====================================================================== @@ -35,7 +36,7 @@ echo "Uptime: `uptime | awk '{ print $3 " days " $5 " h"}' | tr -d ","` ... $iSe ls ${cronfile} >/dev/null 2>&1 if [ $? -eq 0 ]; then echo Autoupdate ON - grep "\ \-r" ${cronfile} >/dev/null 2>&1 + grep -- " -r" ${cronfile} >/dev/null 2>&1 if [ $? -eq 0 ]; then echo Autoreboot ON else diff --git a/docs/20_Checks/check_snmp_data.md b/docs/20_Checks/check_snmp_data.md index b0725ac3002d1b4860768d30d16d5714a50c790b..57a512316b01229410746eb6f91f85675940a5f1 100644 --- a/docs/20_Checks/check_snmp_data.md +++ b/docs/20_Checks/check_snmp_data.md @@ -106,7 +106,7 @@ It starts with a short description: # DATA:cpu:data:cpu-idle:1.3.6.1.4.1.2021.11.11.0:% ``` -To fetch configuration data the text in $0 is grepped by `^#\ DATA:`. +To fetch configuration data the text in $0 is grepped by `^# DATA:`. There is a single line with **label** to define a short description of the check. diff --git a/inc_haproxy_cfg.sh b/inc_haproxy_cfg.sh index 02860befb2159cda26b99bd6c41bc8d6c4499d44..9fe049d9b59bd3b9f8175f63ad6fa2a092ca562e 100644 --- a/inc_haproxy_cfg.sh +++ b/inc_haproxy_cfg.sh @@ -6,6 +6,7 @@ # # ---------------------------------------------------------------------- # 2021-12-14 v1.0 <axel.hahn@iml.unibe.ch> init +# 2022-10-21 v1.1 <axel.hahn@unibe.ch> remove grep: warning: stray \ before white space # ====================================================================== # full path to haproxy.cfg @@ -59,10 +60,10 @@ function cfgrewriter(){ _section=$line echo "# new section: $_section" fi - echo $line | grep "^\ \ [a-z]*" >/dev/null + echo $line | grep "^ [a-z]*" >/dev/null if [ $? -eq 0 ]; then echo -n "$_section:" - echo $line | sed -e "s#^\ *\([a-z\-]*\)\ *#\1=#g" + echo $line | sed -e "s#^ *\([a-z\-]*\) *#\1=#g" fi done < $HAPROXYcfgfile }