Alert threshold for checkevents

I've tested this version with alert threshold during 4 days, it seems to work properly !