On 01/16/2015 08:17 PM, Markus Quaritsch wrote:

well, honestly its just a one-liner and an interim solution (which is
now active for about half a year ;-). but here it is, feel free to
extend it

echo "select TrackKey, FROM_UNIXTIME(LastUpdate) as LastSeen, Counter, 
CounterLimit, Counter / CounterLimit * 100 as Percentage
from quotas_tracking left join quotas_limits on quotasLimitsID = 
quotas_limits.ID
where Counter / CounterLimit > 0.5 and TIMESTAMPDIFF(HOUR, FROM_UNIXTIME(LastUpdate), 
CURRENT_TIMESTAMP()) <= 1 order by counter desc;" | mysql -u <user> -p<pwd> 
<database>

parameters:
   0.5 ... if counter is above 50% of the limit
   timestampdiff() <= 1 ... seen in the last hour

if there are no results the output is empty, otherwise cron sends the
result per mail ;-)

as I said, not nice but it works...

This script has saved me much time and effort. I am happy to get a chance to us it.

Thank you for sharing the script.

--
P.V.Anthony


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Users mailing list
[email protected]
http://lists.policyd.org/mailman/listinfo/users_lists.policyd.org

Reply via email to