I wrote a script that queries a DB to output a JSON similar to the following:
I setup the type as "Zabbix agent". Problem is that it seems like the results get cutoff sometimes. I would get up to CustomerE and then the rest of the output will get lost when I look at the items that get created from this discovery. I have also tried "Zabbix agent active" neither works. I have increased the timeout on both the agent and the server to 30 seconds instead of 3 but still no change.
I then proceeded to try setting up a Discovery with the Trapper type. I have reformatted the file as the follow:
Then make the following call:
I get the following output:
The server log, even with trace turned on, didn't show reasons why it failed:
I'm stuck...I can run the first script perhaps twice a day so it won't put a huge load on the server. I would prefer running the script directly instead of using trapper if possible. At this point, I just want to get it to work..
Any help will be much appreciated!
Code:
{
"data":[
{ "{#DBNAME}":"CustomerA", "{#TESTNAME}":"system1"},
{ "{#DBNAME}":"CustomerA", "{#TESTNAME}":"system2"},
{ "{#DBNAME}":"CustomerA", "{#TESTNAME}":"system3"},
{ "{#DBNAME}":"CustomerB", "{#TESTNAME}":"system1"},
{ "{#DBNAME}":"CustomerB", "{#TESTNAME}":"system2"},
{ "{#DBNAME}":"CustomerB", "{#TESTNAME}":"system3"},
{ "{#DBNAME}":"CustomerC", "{#TESTNAME}":"system1"},
{ "{#DBNAME}":"CustomerD", "{#TESTNAME}":"system1"},
{ "{#DBNAME}":"CustomerE", "{#TESTNAME}":"system1"},
{ "{#DBNAME}":"CustomerE", "{#TESTNAME}":"system2"},
{ "{#DBNAME}":"CustomerE", "{#TESTNAME}":"system3"},
{ "{#DBNAME}":"CustomerE", "{#TESTNAME}":"system4"},
{ "{#DBNAME}":"CustomerF", "{#TESTNAME}":"system1"},
{ "{#DBNAME}":"CustomerG", "{#TESTNAME}":"system1"}
]
}
I then proceeded to try setting up a Discovery with the Trapper type. I have reformatted the file as the follow:
Code:
"hostA" "testSender" { "data":[ { "{#DBNAME}":"CustomerA", "{#TESTNAME}":"system1"},{ "{#DBNAME}":"CustomerA", "{#TESTNAME}":"system2"},{ "{#DBNAME}":"CustomerA", "{#TESTNAME}":"system3"},{ "{#DBNAME}":"CustomerB", "{#TESTNAME}":"system1"},{ "{#DBNAME}":"CustomerB", "{#TESTNAME}":"system2"},{ "{#DBNAME}":"CustomerB", "{#TESTNAME}":"system3"},{ "{#DBNAME}":"CustomerC", "{#TESTNAME}":"system1"},{ "{#DBNAME}":"CustomerD", "{#TESTNAME}":"system1"},{ "{#DBNAME}":"CustomerE", "{#TESTNAME}":"system1"},{ "{#DBNAME}":"CustomerE", "{#TESTNAME}":"system2"},{ "{#DBNAME}":"CustomerE", "{#TESTNAME}":"system3"},{ "{#DBNAME}":"CustomerE", "{#TESTNAME}":"system4"},{ "{#DBNAME}":"CustomerF", "{#TESTNAME}":"system1"},{ "{#DBNAME}":"CustomerG", "{#TESTNAME}":"system1"} ]}
Code:
zabbix_sender -z localhost -i /tmp/out2.txt -vv
Code:
zabbix_sender [1158]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000099"}]
info from server: "processed: 0; failed: 1; total: 1; seconds spent: 0.000099"
sent: 1; skipped: 0; total: 1
Code:
27332:20161115:103919.830 trapper got '{"request":"sender data","data":[{"host":"hostA","testSender","value":"-----SNIP------
27332:20161115:103919.830 In recv_agenthistory()
27332:20161115:103919.830 In process_hist_data()
27332:20161115:103919.830 In process_mass_data()
27332:20161115:103919.830 End of process_mass_data()
27332:20161115:103919.830 End of process_hist_data():SUCCEED
27332:20161115:103919.830 In zbx_send_response()
27332:20161115:103919.831 zbx_send_response() '{"response":"success","info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000117"}'
27332:20161115:103919.831 End of zbx_send_response():SUCCEED
27332:20161115:103919.831 End of recv_agenthistory()
Any help will be much appreciated!

Comment