Hi,
When trying to understand the use of TRIGGER.VALUE (which I haven't found yet, because using {TRIGGER.VALUE} in my mail alert just prints a huge useless number..) I noticed a bit of code which may be slightly wrong.
In functions.c: update_triggers() there is this piece of code:
The problems I see are:
Regards
When trying to understand the use of TRIGGER.VALUE (which I haven't found yet, because using {TRIGGER.VALUE} in my mail alert just prints a huge useless number..) I noticed a bit of code which may be slightly wrong.
In functions.c: update_triggers() there is this piece of code:
Code:
result = DBselect("select distinct t.triggerid,t.expression,t.status,t.dep_level,t.priority,t.value,t.description from triggers t,functions f,items i where i.status<>%d and i.itemid=f.itemid and t.status=%d and f.triggerid=t.triggerid and f.itemid=" ZBX_FS_UI64,
ITEM_STATUS_NOTSUPPORTED,
TRIGGER_STATUS_ENABLED,
itemid);
while((row=DBfetch(result)))
{
ZBX_STR2UINT64(trigger.triggerid,row[0]);
strscpy(trigger.expression,row[1]);
strscpy(trigger.description,row[6]);
trigger.status = atoi(row[2]);
trigger.priority = atoi(row[4]);
trigger.value = atoi(row[5]);
trigger.url = row[6];
trigger.comments = row[7];
- There is no need to retrieve the value of t.status, as the SQL query imposes "t.status = TRIGGER_STATUS_ENABLED", so we already know this value

- t.dep_level (a.k.a row[3]) isn't used anywhere, so it's not necessary to retrieve it.
- row[6] is used twice, once as "description" and once as "url", one of the uses must be wrong...
- there is no row[7] in the result (we only fetch 7 values in the SQL query), therefore the value put in "trigger.comments" must be meaningless.
Regards
Comment