Page 1 of 1

Error sql zmfilter

Posted: Tue Mar 10, 2020 5:53 pm
by brenusmannix
Hello,
I'm a newby and french guy so..
I have a error in zmfilter: Can't execute filter 'SELECT E.*, unix_timestamp(E.StartTime) as Time, M.Name as MonitorName, M.DefaultRate, M.DefaultScale FROM Events as E INNER JOIN Monitors as M on M.Id = E.MonitorId LEFT JOIN Storage as S on S.Id = E.StorageId WHERE (E.EndTime IS NOT NULL) AND ( E.AlarmFrames > -60 seconds ) AND ( E.Emailed = 0 ) ORDER BY E.Id DESC LIMIT 0,1', ignoring: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'seconds ) AND ( E.Emailed = 0 ) ORDER BY E.Id DESC LIMIT 0,1' at line 9.
When i try this request in phpmyadmin (ZM, filters) same result until i write [E.AlarmFrames > '-60 seconds'] !
Also when i try this filter with List Matches it's work!
What i've done wrong?
Thanks

Re: Error sql zmfilter

Posted: Wed Mar 11, 2020 1:16 pm
by iconnor
AlarmFrames is an integer count... you seem to have specified -60 seconds. Perhaps you meant StartDate/Time

Re: Error sql zmfilter

Posted: Wed Mar 11, 2020 5:09 pm
by brenusmannix
I think not because the filter i've used works, i receive an email, and LIST MATCHES works but in the log i have an error in mariadb because sql don't understand "-60 secondes" or "-60 secondes" whithout single quotation.
I don't understand why this filter works in LIST MATCHES and don't with sql in zmfilter.

Re: Error sql zmfilter

Posted: Thu Mar 12, 2020 12:38 pm
by brenusmannix
Hi iconnor,
Of course you're right!
I needed a small nap to understand!

Thanks a lot.

Re: Error sql zmfilter

Posted: Fri Dec 03, 2021 1:42 pm
by Gascoigne
You're right. The filter that you used isn't good. I made the same mistake a couple of weeks ago. I also received an email that told me about the error I got in MariaDB because SQL got the -60 second quotation. I tried to use another filter that I found on google. Well, that also didn't work, and I kept getting the same email. After that, I tried to make a sql server copy database to another server. I tried to use the same filters as I used on the original servers, and you know, everything worked just fine!