Skip to content
Snippets Groups Projects
Commit a4495ab7 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

remove grep: warning: stray \ before white space

parent 5d6c898e
No related branches found
No related tags found
1 merge request!43remove grep: warning: stray \ before white space
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
# 2020-03-04 v1.0 <axel.hahn@iml.unibe.ch> # 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.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 # 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 . `dirname $0`/inc_pluginfunctions
...@@ -34,7 +35,7 @@ tmpfile=/tmp/ceph_status_output_$$ ...@@ -34,7 +35,7 @@ tmpfile=/tmp/ceph_status_output_$$
# fetch lines of OSD entries only from output of ceph osd tree # fetch lines of OSD entries only from output of ceph osd tree
function getOsd(){ function getOsd(){
grep "^\ *[0-9]" $tmpfile grep "^ *[0-9]" $tmpfile
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
# 2020-12-03 v1.4 <axel.hahn@iml.unibe.ch> added support of multiple front- and backends # 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 # 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-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 . $(dirname $0)/inc_pluginfunctions
...@@ -41,7 +42,7 @@ if [ $? -ne 0 ]; then ...@@ -41,7 +42,7 @@ if [ $? -ne 0 ]; then
ph.abort "UNKNOWN: unable to read ha proxy config $cfgfile ... `ls -l $cfgfile`" ph.abort "UNKNOWN: unable to read ha proxy config $cfgfile ... `ls -l $cfgfile`"
fi fi
cat $cfgfile | grep "\ mode\ .*http" >/dev/null cat $cfgfile | grep " mode .*http" >/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
ph.abort "UNKNOWN: haproxy is not in http mode" ph.abort "UNKNOWN: haproxy is not in http mode"
fi fi
......
...@@ -23,6 +23,7 @@ ...@@ -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-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 # 2022-06-07 v1.10 <axel.hahn@iml.unibe.ch> fix iPkg2Update on empty package list
# rename package manager functions # 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(){ ...@@ -49,7 +50,7 @@ function _showAutoupdate(){
if ls ${cronfile} >/dev/null 2>&1 if ls ${cronfile} >/dev/null 2>&1
then then
echo Autoupdate ON echo Autoupdate ON
if grep "\ \-r" ${cronfile} >/dev/null 2>&1 if grep -- " -r" ${cronfile} >/dev/null 2>&1
then then
echo Autoreboot ON echo Autoreboot ON
else else
......
...@@ -7,10 +7,11 @@ ...@@ -7,10 +7,11 @@
# included by ../check_packages2install # 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-03 v1.0 ah first version
# 2022-06-07 v1.1 ah remove text "Nothing to install" # 2022-06-07 v1.1 ah remove text "Nothing to install"
# rename functions # rename functions
# 2022-10-21 v1.3 ah remove grep: warning: stray \ before white space
# =============================================================== # ===============================================================
...@@ -32,7 +33,7 @@ function apt.getPackageList(){ ...@@ -32,7 +33,7 @@ function apt.getPackageList(){
if [ $iStart -gt 0 ]; then if [ $iStart -gt 0 ]; then
# show packages = text starting with 2 spaces below start line # show packages = text starting with 2 spaces below start line
# packages are delimited with space -> replace with new 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 fi
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# 2022-04-01 v0.6 <axel.hahn@iml.unibe.ch> use wget default params; shell fixes # 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-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-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 . $(dirname $0)/inc_pluginfunctions
...@@ -28,7 +29,7 @@ sDeltaunit="min" ...@@ -28,7 +29,7 @@ sDeltaunit="min"
# get service data from json output # get service data from json output
function _getServicedata(){ function _getServicedata(){
cat $tmpfile | jq | grep '^\ \ "' | grep -v "\[" | cut -f 1 -d "," cat $tmpfile | jq | grep '^ "' | grep -v "\[" | cut -f 1 -d ","
} }
function _getWorkerStates(){ function _getWorkerStates(){
...@@ -61,7 +62,7 @@ function _getWorkerOfState(){ ...@@ -61,7 +62,7 @@ function _getWorkerOfState(){
# param string variable (part before ":") # param string variable (part before ":")
function _getvalue(){ function _getvalue(){
# grep "^$1:" $tmpfile | cut -d ":" -f 2 | awk '{ print $1 }' # 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 }'
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
# #
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2018-07-17 first lines # 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 . `dirname $0`/inc_pluginfunctions
...@@ -19,7 +20,7 @@ tmpfile=/tmp/check_sensuplugins.out ...@@ -19,7 +20,7 @@ tmpfile=/tmp/check_sensuplugins.out
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
function _getStatus(){ function _getStatus(){
cat $tmpfile | grep '^\.\.\.' | grep "\ $1\:" cat $tmpfile | grep '^\.\.\.' | grep " $1\:"
} }
function getTotal(){ function getTotal(){
......
...@@ -36,12 +36,13 @@ ...@@ -36,12 +36,13 @@
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2020-08-11 <axel.hahn@iml.unibe.ch> initial version # 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 # 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 . `dirname $0`/inc_pluginfunctions
# --- basic vars # --- basic vars
ABOUT="SNMP performance data v0.3" ABOUT="SNMP performance data v0.4"
SNMPCOMMUNITY="public" SNMPCOMMUNITY="public"
SNMPVERSION="2c" SNMPVERSION="2c"
SNMPGET=$(which snmpget) SNMPGET=$(which snmpget)
...@@ -75,7 +76,7 @@ _wd() ...@@ -75,7 +76,7 @@ _wd()
# get line(s) for config # get line(s) for config
# param string one of label|data # param string one of label|data
_cfg_reader(){ _cfg_reader(){
grep "^#\ DATA:$METHOD:$1:" $0 grep "^# DATA:$METHOD:$1:" $0
} }
_cfg_getlabel(){ _cfg_getlabel(){
_cfg_reader "label" | cut -f 4- -d ":" _cfg_reader "label" | cut -f 4- -d ":"
...@@ -89,7 +90,7 @@ _cfg_dataitem(){ ...@@ -89,7 +90,7 @@ _cfg_dataitem(){
# get a list existing methods # get a list existing methods
_cfg_getMethods(){ _cfg_getMethods(){
grep "^#\ DATA:.*:label:" $0 | cut -f 2 -d ":" grep "^# DATA:.*:label:" $0 | cut -f 2 -d ":"
} }
#--------------------------------------------------- #---------------------------------------------------
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2021-10-06 v0.1 <axel.hahn@iml.unibe.ch> initial version # 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-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 . $(dirname $0)/inc_pluginfunctions
...@@ -117,7 +118,7 @@ for mycert in $( ls -1 $filelist 2>/dev/null ) ...@@ -117,7 +118,7 @@ for mycert in $( ls -1 $filelist 2>/dev/null )
do do
iCounter=$iCounter+1 iCounter=$iCounter+1
data=$(openssl x509 -noout -text -in $mycert 2>/dev/null ) 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}}" mySubject2="${mySubject//${myDomain}}"
if [ -z "$mySubject" ]; then if [ -z "$mySubject" ]; then
...@@ -126,7 +127,7 @@ do ...@@ -126,7 +127,7 @@ do
!!! WARNING: File $mycert is no client certificate. HINT: adjust your file filter in -f FILEFILTER" !!! WARNING: File $mycert is no client certificate. HINT: adjust your file filter in -f FILEFILTER"
else 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 iExpire=$( date +%s -d "$dateExpire" )
typeset -i iLeft=($iExpire-$iNow)/60/60/24 typeset -i iLeft=($iExpire-$iNow)/60/60/24
...@@ -149,7 +150,7 @@ do ...@@ -149,7 +150,7 @@ do
shortstatus="${shortstatus}${result} ${mySubject} [${iLeft}d] ; " shortstatus="${shortstatus}${result} ${mySubject} [${iLeft}d] ; "
fullstatus="${fullstatus} fullstatus="${fullstatus}
----- [$iCounter of $iTotal] ${mySubject} - expires in $iLeft days $mySubject2 ----- [$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 File: $mycert
" "
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# 2020-03-05 v1.1 <axel.hahn@iml.unibe.ch> switch to ph.* helper functions # 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-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 # 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 ...@@ -35,7 +36,7 @@ echo "Uptime: `uptime | awk '{ print $3 " days " $5 " h"}' | tr -d ","` ... $iSe
ls ${cronfile} >/dev/null 2>&1 ls ${cronfile} >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo Autoupdate ON echo Autoupdate ON
grep "\ \-r" ${cronfile} >/dev/null 2>&1 grep -- " -r" ${cronfile} >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo Autoreboot ON echo Autoreboot ON
else else
......
...@@ -106,7 +106,7 @@ It starts with a short description: ...@@ -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:% # 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. There is a single line with **label** to define a short description of the check.
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
# #
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 2021-12-14 v1.0 <axel.hahn@iml.unibe.ch> init # 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 # full path to haproxy.cfg
...@@ -59,10 +60,10 @@ function cfgrewriter(){ ...@@ -59,10 +60,10 @@ function cfgrewriter(){
_section=$line _section=$line
echo "# new section: $_section" echo "# new section: $_section"
fi fi
echo $line | grep "^\ \ [a-z]*" >/dev/null echo $line | grep "^ [a-z]*" >/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo -n "$_section:" echo -n "$_section:"
echo $line | sed -e "s#^\ *\([a-z\-]*\)\ *#\1=#g" echo $line | sed -e "s#^ *\([a-z\-]*\) *#\1=#g"
fi fi
done < $HAPROXYcfgfile done < $HAPROXYcfgfile
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment