diff --git a/src/zabbix/cvpoller-zabbix b/src/zabbix/cvpoller-zabbix index 672248c..d79324d 100755 --- a/src/zabbix/cvpoller-zabbix +++ b/src/zabbix/cvpoller-zabbix @@ -6,23 +6,17 @@ whitespace="[[:space:]]" _args='' ### Process variables with spaces in -#for i in "$@" -#do -# if [[ $i =~ $whitespace ]] -# then -# _args="${_args} \"$i\"" -# else -# _args="${_args} $i" -# fi -#done +for i in "$@" +do + if [[ $i =~ $whitespace ]] + then + _args="${_args} \"$i\"" + else + _args="${_args} $i" + fi +done -for i in "$@";do - _args="$_args \"${i//\"/\\\"}\"" -done; - -#_args="$@" -#_property_name=`echo ${_args} | sed -ne 's|.* -p \([a-zA-Z\.]*\)|\1|p'` -_property_name=`echo $@ | sed -ne 's|.* -p \([a-zA-Z\.]*\)|\1|p'` +_property_name=`echo ${_args} | sed -ne 's|.* -p \([a-zA-Z\.]*\)|\1|p'` # Rename property as it might contain dots in the complete property name, so that 'jq' can parse it sh -c "vpoller-cclient ${_args} 2>/dev/null" | jq -r ".result[0] | {\"property\": .[\"${_property_name}\"]}.property"