diff --git a/usr/lib/zabbix-check/bin/zabbix-check-drbd-discover b/usr/lib/zabbix-check/bin/zabbix-check-drbd-discover index efe6197..0201fac 100755 --- a/usr/lib/zabbix-check/bin/zabbix-check-drbd-discover +++ b/usr/lib/zabbix-check/bin/zabbix-check-drbd-discover @@ -1,18 +1,8 @@ #!/bin/bash -i=0 -echo '{ - "data": [' +comma="" +echo -n '{ "data": [' -drbd-overview | awk -F ':' '{print $1}' | while read -e l; do - if ! [ "$l" -eq "$l" ] 2>/dev/null; then continue; fi - if [ "$i" -gt "0" ]; then echo ","; fi - i=1 - echo -n '{ "{#RES}" : "' - echo -n $l - echo -n '" }' -done +for k in $(cat /proc/drbd | cut -d: -f1); do test -z "${k##[0-9]*}" && echo -n $comma "{ \"{#RES}\": \"$k\" }" && comma=","; done -echo ' - ] -}' +echo ']}'