When I test "UserParameter" locally it looks good:
But when server requests the same the agent returns this:
What is the problem?
Agent Config:
Script "hilink.discovery":
Code:
root@client1:~# zabbix_agentd -t hilink.discovery
hilink.discovery [t|{"data":[{"{#HILINKNAME}": "eth11"},{"{#HILINKNAME}": "eth12"},{"{#HILINKNAME}": "eth13"}]}]
Code:
Nov 19 14:49:56 client1 zabbix_agentd[24025]: EXECUTE_STR() command:' hilink_discovery' len:11 cmd_result:'{"data":[]}'
Nov 19 14:49:56 client1 zabbix_agentd[24025]: Sending back [{"data":[]}]
Agent Config:
Code:
... UserParameter=hilink.discovery, hilink_discovery ...
Code:
#! /bin/sh
IFACES=$(uci -q show hilink | sed -n -E 's/hilink.(.*)=interface/\1/p')
NUM=$(echo "$IFACES" | wc -w)
echo -n '{"data":['
COUNT=0
for iface in $IFACES; do
echo -n "{\"{#HILINKNAME}\": \"$iface\"}"
COUNT=$(( $COUNT + 1 ))
[ $COUNT -eq $NUM ] || echo -n ","
done
echo ']}'
Comment