SQL query not working in alert rule

Hi,
i created a sql query which is working fine in mysql. When i put the same query in an alert rule, the rule seems not to be working. Can anybody help me to find out what is going wrong here? Below is the sql query that i build an is working in mysql:

SELECT * FROM eventlog WHERE (datetime >= DATE_ADD(NOW(), INTERVAL -300 SECOND) ) AND ( eventlog.message LIKE “%HTTP Status code%” ) AND ( eventlog.message NOT LIKE “%200%” )

Thank you in advance.
Best regards,

Remon

I think you need to write a query that returns a single item and then a query rule that evaluates that item, but I could be wrong.

What are you expecting the Alert rule to do?

perhaps something like

select count(message) as qtyStatusNoOk where ( ....)

and then your alert checks for qtyStatusNotOk > 0 ?

I haven’t actually played with this, but hope this might help

i added some extra columns:
SELECT * FROM devices,eventlog WHERE (devices.device_id = ? AND devices.device_id = eventlog.device_id) AND (eventlog.datetime >= DATE_ADD(NOW(), INTERVAL -300 SECOND) ) AND eventlog.message LIKE “%HTTP Status code%” AND eventlog.message NOT LIKE “%200%”

It’s working now. Thanks for the feedback.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.