[skuksa@opmon01 zabbix]$ ./test.sh ["name"]=> string(8) "TestHost" ["itemid"]=> string(5) "23661" ["name"]=> string(8) "TestItem" ["key_"]=> string(8) "TestItem" ["history"]=> string(2) "90" ["description"]=> string(0) "" ["lastvalue"]=> string(1) "0" ["tag"]=> string(0) "" ["triggerid"]=> string(5) "13558" ["expression"]=> string(9) "{13161}=0" ["description"]=> string(10) "TestTriger" ["value"]=> string(1) "0" ["priority"]=> string(1) "2" ["functions"]=> array(1) { ["functionid"]=> string(5) "13161" ["itemid"]=> string(5) "23661" ["triggerid"]=> string(5) "13558" ["function"]=> string(4) "last" [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -p 10081 -s TestHost -k TestItem -o 1 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000045" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ sleep 5 ; ./test1.sh ["itemid"]=> string(5) "23661" ["key_"]=> string(8) "TestItem" ["history"]=> string(2) "90" ["description"]=> string(0) "" ["lastvalue"]=> string(1) "1" ["prevvalue"]=> string(1) "0" ["triggerid"]=> string(5) "13558" ["description"]=> string(10) "TestTriger" ["value"]=> string(1) "0" ["tag"]=> string(1) "1" [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -p 10081 -s TestHost -k TestItem -o 0 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000185" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ sleep 5 ; ./test1.sh ["itemid"]=> string(5) "23661" ["key_"]=> string(8) "TestItem" ["history"]=> string(2) "90" ["description"]=> string(0) "" ["lastvalue"]=> string(1) "0" ["prevvalue"]=> string(1) "1" ["triggerid"]=> string(5) "13558" ["description"]=> string(10) "TestTriger" ["value"]=> string(1) "1" ["tag"]=> string(1) "0" # History changed to 0 [skuksa@opmon01 zabbix]$ sleep 5; ./test1.sh ["itemid"]=> string(5) "23661" ["key_"]=> string(8) "TestItem" ["history"]=> string(1) "0" ["description"]=> string(0) "" ["lastvalue"]=> string(2) "10" ["prevvalue"]=> string(1) "0" ["triggerid"]=> string(5) "13558" ["description"]=> string(10) "TestTriger" ["value"]=> string(1) "0" ["tag"]=> string(2) "10" [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -p 10081 -s TestHost -k TestItem -o 1 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000044" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ sleep 5; ./test1.sh ["itemid"]=> string(5) "23661" ["key_"]=> string(8) "TestItem" ["history"]=> string(1) "0" ["description"]=> string(0) "" ["lastvalue"]=> string(2) "10" ["prevvalue"]=> string(1) "0" ["triggerid"]=> string(5) "13558" ["description"]=> string(10) "TestTriger" ["value"]=> string(1) "0" ["tag"]=> string(1) "1" [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -p 10081 -s TestHost -k TestItem -o 0 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000035" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ sleep 5; ./test1.sh ["itemid"]=> string(5) "23661" ["key_"]=> string(8) "TestItem" ["history"]=> string(1) "0" ["description"]=> string(0) "" ["lastvalue"]=> string(2) "10" ["prevvalue"]=> string(1) "0" ["triggerid"]=> string(5) "13558" ["description"]=> string(10) "TestTriger" ["value"]=> string(1) "0" ["tag"]=> string(1) "0" [skuksa@opmon01 zabbix]$ cat test.sh #!/bin/sh API=http://10.226.226.36/test/api_jsonrpc.php AUTH_TOKEN=$( curl -s -i -X POST -H 'Content-Type: application/json-rpc' -d '{ "params": { "user": "admin", "password": "zabbix" }, "jsonrpc": "2.0", "method": "user.authenticate", "auth": "", "id": 0 }' $API | grep result | cut -d "\"" -f 8 ) API_TAIL="\"auth\":\"$AUTH_TOKEN\",\"id\":1 }" HOST_GET='{ "jsonrpc":"2.0", "method":"host.get", "params":{ "hostids": 10106, "output":"extend", "selectItems": "extend", "selectInventory": ["tag" ] }, ' curl -s -X POST -H 'Content-Type: application/json-rpc' -d "$HOST_GET $API_TAIL" $API | \ php -r '$out=fread(STDIN,102400); var_dump(json_decode($out));' | \ egrep -i -A 1 'itemid|"name"|key_|history|lastvalue|description|tag|serialno_a' | grep -v '^--' | \ while read a; do read b; echo $a $b; done echo TRIG_GET='{ "jsonrpc":"2.0", "method":"trigger.get", "params":{ "hostids": 10106, "output":"extend", "selectFunctions": "extend" }, ' curl -s -X POST -H 'Content-Type: application/json-rpc' -d "$TRIG_GET $API_TAIL" $API | \ php -r '$out=fread(STDIN,102400); var_dump(json_decode($out));' | \ egrep -i 'itemid|"name"|key_|history|lastvalue|description|triggerid|value"|priority|expression|function' | grep -v '^--' | \ while read a; do read b; echo $a $b; done exit [skuksa@opmon01 zabbix]$ cat test1.sh #!/bin/sh API=http://10.226.226.36/test/api_jsonrpc.php AUTH_TOKEN=$( curl -s -i -X POST -H 'Content-Type: application/json-rpc' -d '{ "params": { "user": "admin", "password": "zabbix" }, "jsonrpc": "2.0", "method": "user.authenticate", "auth": "", "id": 0 }' $API | grep result | cut -d "\"" -f 8 ) API_TAIL="\"auth\":\"$AUTH_TOKEN\",\"id\":1 }" HOST_GET='{ "jsonrpc":"2.0", "method":"host.get", "params":{ "hostids": 10106, "output":"extend", "selectItems": "extend", "selectInventory": ["tag" ], "selectTriggers" : "extend" }, ' curl -s -X POST -H 'Content-Type: application/json-rpc' -d "$HOST_GET $API_TAIL" $API | \ php -r '$out=fread(STDIN,102400); var_dump(json_decode($out));' | \ egrep -i -A 1 'itemid|key_|history|lastvalue|description|tag|value"|triggerid' | grep -v '^--' | \ while read a; do read b; echo $a $b; done