There is test host with two test items with simple trigger on each and connected to Inventory. Host – TestHost. Zabbix trapper items: TestInt as int, connected to “Tag” inventory field TestStr as string connected to “serialno_a”. History was set first time for a 90 days. Triggers are very easy: TestIntT {TestHost:TestInt.last()}<10 TestStrT {TestHost:TestStr.diff(0)}=1. Data was sent via zabbix_sender. I got data via API to keep space from screenshots. Script “test.sh” is bellow data logs. 1. Sending initial data. [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestInt -o 100 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000085" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestStr -o "TestValue" info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000144" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestInt -o 100 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000085" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestStr -o "TestValue" info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000113" sent: 1; skipped: 0; total: 1 2. Check host params. [skuksa@opmon01 zabbix]$ ./test.sh ["name"]=> string(8) "TestHost" ["itemid"]=> string(15) "100100000023884" ["name"]=> string(7) "TestInt" ["key_"]=> string(7) "TestInt" ["history"]=> string(2) "90" ["description"]=> string(0) "" ["lastvalue"]=> string(3) "100" ["prevvalue"]=> string(3) "100" ["itemid"]=> string(15) "100100000023883" ["name"]=> string(7) "TestStr" ["key_"]=> string(7) "TestStr" ["history"]=> string(2) "90" ["description"]=> string(0) "" ["lastvalue"]=> string(9) "TestValue" ["prevvalue"]=> string(9) "TestValue" } ["serialno_a"]=> string(9) "TestValue" ["tag"]=> string(3) "100" ["triggerid"]=> string(15) "100100000013631" ["expression"]=> string(20) "{100100000013098}<10" ["description"]=> string(8) "TestIntT" ["value"]=> string(1) "0" ["priority"]=> string(1) "2" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013098" ["itemid"]=> string(15) "100100000023884" ["triggerid"]=> string(15) "100100000013631" ["function"]=> string(4) "last" ["triggerid"]=> string(15) "100100000013630" ["expression"]=> string(19) "{100100000013097}=1" ["description"]=> string(8) "TestStrT" ["value"]=> string(1) "0" ["priority"]=> string(1) "1" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013097" ["itemid"]=> string(15) "100100000023883" ["triggerid"]=> string(15) "100100000013630" ["function"]=> string(4) "diff" 3. Îę, values correct, Inventory data is correct, triggers state is correct. 4. Sending data to activate triggers. [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestStr -o "TestValue1" info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000054" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestInt -o 1 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000059" sent: 1; skipped: 0; total: 1 5. Check result [skuksa@opmon01 zabbix]$ ./test.sh ["name"]=> string(8) "TestHost" ["itemid"]=> string(15) "100100000023884" ["name"]=> string(7) "TestInt" ["key_"]=> string(7) "TestInt" ["history"]=> string(2) "90" ["description"]=> string(0) "" ["lastvalue"]=> string(1) "1" ["prevvalue"]=> string(3) "100" ["itemid"]=> string(15) "100100000023883" ["name"]=> string(7) "TestStr" ["key_"]=> string(7) "TestStr" ["history"]=> string(2) "90" ["description"]=> string(0) "" ["lastvalue"]=> string(10) "TestValue1" ["prevvalue"]=> string(9) "TestValue" } ["serialno_a"]=> string(10) "TestValue1" ["tag"]=> string(1) "1" ["triggerid"]=> string(15) "100100000013631" ["expression"]=> string(20) "{100100000013098}<10" ["description"]=> string(8) "TestIntT" ["value"]=> string(1) "1" ["priority"]=> string(1) "2" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013098" ["itemid"]=> string(15) "100100000023884" ["triggerid"]=> string(15) "100100000013631" ["function"]=> string(4) "last" ["triggerid"]=> string(15) "100100000013630" ["expression"]=> string(19) "{100100000013097}=1" ["description"]=> string(8) "TestStrT" ["value"]=> string(1) "1" ["priority"]=> string(1) "1" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013097" ["itemid"]=> string(15) "100100000023883" ["triggerid"]=> string(15) "100100000013630" ["function"]=> string(4) "diff" 6. Ok, it works good, all correct. Sending data to clear triggers. [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestInt -o 1000 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000051" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestStr -o "TestValue1" info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000051" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ ./test.sh ["name"]=> string(8) "TestHost" ["itemid"]=> string(15) "100100000023884" ["name"]=> string(7) "TestInt" ["key_"]=> string(7) "TestInt" ["history"]=> string(2) "90" ["description"]=> string(0) "" ["lastvalue"]=> string(4) "1000" ["prevvalue"]=> string(1) "1" ["itemid"]=> string(15) "100100000023883" ["name"]=> string(7) "TestStr" ["key_"]=> string(7) "TestStr" ["history"]=> string(2) "90" ["description"]=> string(0) "" ["lastvalue"]=> string(10) "TestValue1" ["prevvalue"]=> string(10) "TestValue1" ["serialno_a"]=> string(10) "TestValue1" ["tag"]=> string(4) "1000" ["triggerid"]=> string(15) "100100000013631" ["expression"]=> string(20) "{100100000013098}<10" ["description"]=> string(8) "TestIntT" ["value"]=> string(1) "0" ["priority"]=> string(1) "2" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013098" ["itemid"]=> string(15) "100100000023884" ["triggerid"]=> string(15) "100100000013631" ["function"]=> string(4) "last" ["triggerid"]=> string(15) "100100000013630" ["expression"]=> string(19) "{100100000013097}=1" ["description"]=> string(8) "TestStrT" ["value"]=> string(1) "0" ["priority"]=> string(1) "1" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013097" ["itemid"]=> string(15) "100100000023883" ["triggerid"]=> string(15) "100100000013630" ["function"]=> string(4) "diff" 7. Ok, it works good, all correct. 8. Now change configuration and set history to 0 and wait configuration sync. 9. Check new config. [skuksa@opmon01 zabbix]$ ./test.sh ["name"]=> string(8) "TestHost" ["itemid"]=> string(15) "100100000023884" ["name"]=> string(7) "TestInt" ["key_"]=> string(7) "TestInt" ["history"]=> string(1) "0" ["description"]=> string(0) "" ["lastvalue"]=> string(4) "1000" ["prevvalue"]=> string(1) "1" ["itemid"]=> string(15) "100100000023883" ["name"]=> string(7) "TestStr" ["key_"]=> string(7) "TestStr" ["history"]=> string(1) "0" ["description"]=> string(0) "" ["lastvalue"]=> string(10) "TestValue1" ["prevvalue"]=> string(10) "TestValue1" ["serialno_a"]=> string(10) "TestValue1" ["tag"]=> string(4) "1000" ["triggerid"]=> string(15) "100100000013631" ["expression"]=> string(20) "{100100000013098}<10" ["description"]=> string(8) "TestIntT" ["value"]=> string(1) "0" ["priority"]=> string(1) "2" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013098" ["itemid"]=> string(15) "100100000023884" ["triggerid"]=> string(15) "100100000013631" ["function"]=> string(4) "last" ["triggerid"]=> string(15) "100100000013630" ["expression"]=> string(19) "{100100000013097}=1" ["description"]=> string(8) "TestStrT" ["value"]=> string(1) "0" ["priority"]=> string(1) "1" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013097" ["itemid"]=> string(15) "100100000023883" ["triggerid"]=> string(15) "100100000013630" ["function"]=> string(4) "diff" 10. Ok, it’s correct, triggers did not change. 11. Sending data to activate triggers once again. [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestInt -o 1 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000047" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestStr -o "TestValue2" info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000106" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ ./test.sh ["name"]=> string(8) "TestHost" ["itemid"]=> string(15) "100100000023884" ["name"]=> string(7) "TestInt" ["key_"]=> string(7) "TestInt" ["history"]=> string(1) "0" ["description"]=> string(0) "" ["lastvalue"]=> string(4) "1000" ["prevvalue"]=> string(1) "1" ["itemid"]=> string(15) "100100000023883" ["name"]=> string(7) "TestStr" ["key_"]=> string(7) "TestStr" ["history"]=> string(1) "0" ["description"]=> string(0) "" ["lastvalue"]=> string(10) "TestValue1" ["prevvalue"]=> string(10) "TestValue1" ["serialno_a"]=> string(10) "TestValue2" ["tag"]=> string(1) "1" ["triggerid"]=> string(15) "100100000013631" ["expression"]=> string(20) "{100100000013098}<10" ["description"]=> string(8) "TestIntT" ["value"]=> string(1) "0" ["priority"]=> string(1) "2" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013098" ["itemid"]=> string(15) "100100000023884" ["triggerid"]=> string(15) "100100000013631" ["function"]=> string(4) "last" ["triggerid"]=> string(15) "100100000013630" ["expression"]=> string(19) "{100100000013097}=1" ["description"]=> string(8) "TestStrT" ["value"]=> string(1) "0" ["priority"]=> string(1) "1" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013097" ["itemid"]=> string(15) "100100000023883" ["triggerid"]=> string(15) "100100000013630" ["function"]=> string(4) "diff" 12. It didn’t work! Inventory have new values data was accepted, but items lastvalues are wrong and triggers did not activated. 13. Check once again. [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestStr -o "TestValue3" info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000052" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ zabbix_sender -z 127.0.0.1 -s TestHost -k TestInt -o 2 info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000047" sent: 1; skipped: 0; total: 1 [skuksa@opmon01 zabbix]$ ./test.sh ["name"]=> string(8) "TestHost" ["itemid"]=> string(15) "100100000023884" ["name"]=> string(7) "TestInt" ["key_"]=> string(7) "TestInt" ["history"]=> string(1) "0" ["description"]=> string(0) "" ["lastvalue"]=> string(4) "1000" ["prevvalue"]=> string(1) "1" ["itemid"]=> string(15) "100100000023883" ["name"]=> string(7) "TestStr" ["key_"]=> string(7) "TestStr" ["history"]=> string(1) "0" ["description"]=> string(0) "" ["lastvalue"]=> string(10) "TestValue1" ["prevvalue"]=> string(10) "TestValue1" ["serialno_a"]=> string(10) "TestValue3" ["tag"]=> string(1) "2" ["triggerid"]=> string(15) "100100000013631" ["expression"]=> string(20) "{100100000013098}<10" ["description"]=> string(8) "TestIntT" ["value"]=> string(1) "0" ["priority"]=> string(1) "2" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013098" ["itemid"]=> string(15) "100100000023884" ["triggerid"]=> string(15) "100100000013631" ["function"]=> string(4) "last" ["triggerid"]=> string(15) "100100000013630" ["expression"]=> string(19) "{100100000013097}=1" ["description"]=> string(8) "TestStrT" ["value"]=> string(1) "0" ["priority"]=> string(1) "1" ["functions"]=> array(1) { ["functionid"]=> string(15) "100100000013097" ["itemid"]=> string(15) "100100000023883" ["triggerid"]=> string(15) "100100000013630" ["function"]=> string(4) "diff" 14. It does not work again. There is test.sh script code. #!/bin/sh API=http://X.X.X.X/zabbix/api_jsonrpc.php AUTH_TOKEN=$( curl -s -i -X POST -H 'Content-Type: application/json-rpc' -d '{ "params": { "user": "test", "password": "test" }, "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": 100100000010090, "output":"extend", "selectItems": "extend", "selectInventory": ["serialno_a", "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|triggerid|value"|priority|expression|tag|serialno_a' | \ grep -v '^--' | \ cat echo TRIG_GET='{ "jsonrpc":"2.0", "method":"trigger.get", "params":{ "hostids": 100100000010090, "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 -A 1 'itemid|"name"|key_|history|lastvalue|description|triggerid|value"|priority|expression|function' | \ grep -v '^--' | \ cat echo exit