All,
We have been using Zabbix 2.2 for years and finally updated to 3.2, and now we are having issues with the JSON length that we try to send to Zabbix. I haven't been able to determine but what is the maximum length that one can send to Zabbix through java code. Below is sample java code I use to send a json message along with th esample message.
Excuse the lack of declarations in the code. This forum apparently doesn't like multiple equal declarations even within code blocks.
Sample Code:
Sample Message:
Oddly enough, if I remove the last key/value entry, then Zabbix receives it perfectly fine regardless of whether it's Zabbix 2.2 or 3.2. So there is clearly a limiting factor there but I am unsure what it is exactly.
We need to do this through java code and not the standalone utility. So if someone provide a better method or a wait to increase the Json limit without decompiling/recompiling server code, I would really appreciate it.
Bear in mind there are hundred of these agents running and recording data, so we need a solution that is easy to distribute.
We have been using Zabbix 2.2 for years and finally updated to 3.2, and now we are having issues with the JSON length that we try to send to Zabbix. I haven't been able to determine but what is the maximum length that one can send to Zabbix through java code. Below is sample java code I use to send a json message along with th esample message.
Excuse the lack of declarations in the code. This forum apparently doesn't like multiple equal declarations even within code blocks.
Sample Code:
Code:
Socket zabbixSocket = new Socket(zabbixServer, port);
zabbixSocket.setSoTimeout(30000);
out zabbixSocket.getOutputStream();
is new DataInputStream(zabbixSocket.getInputStream());
int length = data.length;
out.write(new byte[] { 'Z', 'B', 'X', 'D', '\1',
(byte) (length & 0xFF), (byte) ((length & 0x00FF) >> 8),
(byte) ((length & 0x0000FF) >> 16),
(byte) ((length & 0x000000FF) >> 24), '\0', '\0', '\0', '\0' });
out.write(data);
out.flush();
is.read
...
Sample Message:
Code:
"request":"sender data",
"data":[
{
"host":"myserver.abc.com",
"key":"tnail-avail",
"value":"1"
},
{
"host":"myserver.abc.com",
"key":"tnail-valid",
"value":"1"
},
{
"host":"myserver.abc.com",
"key":"tnail-ms",
"value":"0"
},
{
"host":"myserver.abc.com",
"key":"tnail-version",
"value":"7.3.0000"
}]
We need to do this through java code and not the standalone utility. So if someone provide a better method or a wait to increase the Json limit without decompiling/recompiling server code, I would really appreciate it.
Bear in mind there are hundred of these agents running and recording data, so we need a solution that is easy to distribute.
Comment