From 0569d0ea289cc584dc1de1e44f2620a777ded2ed Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Wed, 30 Aug 2023 14:04:58 +0200 Subject: [PATCH] fix grep in value loop --- check_couchdb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/check_couchdb b/check_couchdb index 6bbdba6..b50425b 100755 --- a/check_couchdb +++ b/check_couchdb @@ -145,7 +145,7 @@ case "${sMode}" in ph.status "Couchdb :: Http request methods" printf "%30s %10s %10s\n" "Property" "Counter" "Delta" | tr ' ' '_' - for myVar in $( grep "[a-z\_]" <<< "$_status" | cut -f 1 -d ':' ) + for myVar in $( grep "^[a-z\_]" <<< "$_status" | cut -f 1 -d ':' ) do _iValue=$( grep "^${myVar}:" <<< "$_status" | cut -f 2 -d ':' ) _label="couchdb-hp-${myVar//_/-}" # underscrore to minus @@ -173,9 +173,9 @@ case "${sMode}" in ph.status "Couchdb :: Http request methods" printf "%10s %10s %10s\n" "Method" "Counter" "Delta" | tr ' ' '_' - for myVar in $( grep "[A-Z]" <<< "$_status" | cut -f 1 -d ':' ) + for myVar in $( grep "^[A-Z]" <<< "$_status" | cut -f 1 -d ':' ) do - _iValue=$( grep "$myVar" <<< "$_status" | cut -f 2 -d ':' ) + _iValue=$( grep "^$myVar:" <<< "$_status" | cut -f 2 -d ':' ) _label="couchdb-hm-${myVar//_/-}" # underscrore to minus _iDelta=$( ph.perfdeltaspeed "${_label}" $_iValue) printf "%10s %10s %10s per sec\n" "$myVar" $_iValue $_iDelta @@ -202,9 +202,9 @@ case "${sMode}" in ph.status "Couchdb :: Http status codes" printf "%10s %10s %10s\n" "Status" "Counter" "Delta" | tr ' ' '_' - for myVar in $( grep "[1-9]" <<< "$_status" | cut -f 1 -d ':' ) + for myVar in $( grep "^[1-9]" <<< "$_status" | cut -f 1 -d ':' ) do - _iValue=$( grep "$myVar" <<< "$_status" | cut -f 2 -d ':' ) + _iValue=$( grep "^$myVar:" <<< "$_status" | cut -f 2 -d ':' ) _label="couchdb-hs-${myVar//_/-}" # underscrore to minus _iDelta=$( ph.perfdeltaspeed "${_label}" $_iValue) printf "%10s %10s %10s per sec\n" "$myVar" $_iValue $_iDelta -- GitLab