-
Type:
Incident report
-
Resolution: Won't fix
-
Priority:
Major
-
None
-
Affects Version/s: 2.0.3
-
Component/s: Server (S)
-
None
-
Environment:Debian 64bit ( 2.6.32-5-amd64 #1 SMP Sun Sep 23 10:07:46 UTC 2012 x86_64 GNU/Linux)
I created a discovery rule based with an ICMP check an 7 TCP checks. The rule itself works fine and detects all devices on the network.
Based on the result, if a TCP-Port is open or not, I'd like to create a host entry and add this entry to different groups (depending on the open TCP ports).
I found, that the SQL-statement in actions.c does not return the required results (function check_discovery_condition).
So I changed the source-code as follows:
else if (CONDITION_TYPE_DCHECK == condition->conditiontype) { if (EVENT_OBJECT_DSERVICE == event->object) { ZBX_STR2UINT64(condition_value, condition->value); result = DBselect( "select d1.dcheckid" " from dservices d1" " where d1.dcheckid=" ZBX_FS_UI64 /* " and dserviceid=" ZBX_FS_UI64, */ " and (select d2.dhostid from dservices d2 where" " d1.dhostid = d2.dhostid and" " d2.dserviceid=" ZBX_FS_UI64 " ) ", condition_value, event->objectid);
IMHO the problem was, that in the former SQL-statement always the LAST of the entries for the hostid in zabbix.dservices was referenced. Unfortunately the result of the check (if you use more than one check) returned no value.
That's why I changed the SQL to include a substatement searching for the dhostid which belongs to the event->objectid.
I also checked the actions.c of version 2.0.4 and found no difference to 2.0.3
Please excuse the way I included the code, but for me it's the first time to enter such a bug record.