Ad Widget

Collapse

UserParameter: return empty

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LovingFox
    Junior Member
    • Oct 2019
    • 6

    #1

    UserParameter: return empty

    When I test "UserParameter" locally it looks good:
    Code:
    root@client1:~# zabbix_agentd -t hilink.discovery
    hilink.discovery                              [t|{"data":[{"{#HILINKNAME}": "eth11"},{"{#HILINKNAME}": "eth12"},{"{#HILINKNAME}": "eth13"}]}]
    But when server requests the same the agent returns this:
    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":[]}]
    What is the problem?

    Agent Config:
    Code:
    ...
    UserParameter=hilink.discovery, hilink_discovery
    ...
    Script "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 ']}'
  • LovingFox
    Junior Member
    • Oct 2019
    • 6

    #2
    Managed out to find the problem: agent's permissions...

    Comment

    Working...