PDA

View Full Version : Custom defined items causing server to be unreachable


[JiF]Mike
02-11-2004, 16:58
I have the agent running on 3 servers. One of my servers has a few custom items to check that I defined in the config file. These custom items call a simple sh script that checks for the number of players on a game server and returns that number. However if the checked game server is not running, I get an unreachable status of the server doing the checking. If I shutdown the agent and comment out that custom line in the config file (or deactivate it via the zabbix web page) the server is again reachable. While in this unreachable state though, no other values are recorded. It's been kind of a pain in the butt, and I don't really understand why one item simply not returning any value would cause the entire server to appear unreachable, when in fact it is. I'm guessing I could change my sh script to always return a 0 value if no value is returned, but I'm not real good at writing scripts to do such things. :) Is there any other solution? Might I have somethiing configured wrong? This isn't a huge problem, just more of an annoyance. Thank you.

Alexei
02-11-2004, 17:12
Return 0 when the game server is down. The problem is that your script doesn't return anything back to ZABBIX agent, therefore the agent thinks that your script failed. Why call failed script over and over again? ZABBIX is smart, so it protects himself by setting item status to UNREACHABLE. Everything is fine. Life is good!:)

[JiF]Mike
02-11-2004, 19:03
If it just disabled that one item I wouldn't mind. However no item data is recorded as it thinks the entire server is unreachable. This is kind of pointless now though. After I posted I thought it was time to learn a little about script programming, so I dove into a few tutorials. I've programmed in other languages so I just needed to get the structures down. It's a little odd and still easily confuses me, but now I have it returning a negative one when the server is down. So a trigger now informs me when the server is down. So far it seems to be working fairly well even with the downed servers. :) Here's a link (http://www.mike3d.net/zabbix/charts.php?graphid=5&keep=1) to the graph, it's very handy for trend analysis. If anyone else would like to set this up, I'd be happy to share my scripts, though they are very simple.

Alexei
08-11-2004, 12:04
My previous post was not fully correct.

Indeed, ZABBIX does change status of User Parameter to UNSUPPORTED in case if it receives empty (zero length) string from executed command.

However, if the command returns empty line ('\n') then agent sends it to ZABBIX server and ZABBIX server will set host status to UNREACHABLE. This has to be fixed, and it will be fixed very soon.

Alexei
10-11-2004, 00:14
Let me know if you're interested in the fix, so I could publish it here.

[JiF]Mike
10-11-2004, 20:13
Yes I am interested.

Alexei
10-11-2004, 20:56
src/zabbix_agent/sysinfo.c:

2188,2192d2187
< if(c[0]=='\n')
< {
< return NULL;
< }
<
2237,2241d2231
< if(c[0]=='\n')
< {
< return NULL;
< }
<