4 ms·
This brings up a tangential problem I've yet to solve: how do you warn that something didn't happen when it should? E.g. you have a script that does backups. Y
by porker 12y ago
This brings up a tangential problem I've yet to solve: how do you warn that something didn't happen when it should?
E.g. you have a script that does backups. You log the script's output, but one day something fails and the script is no longer executed.
Some form of dead man's handle is needed; the only way I can think of is to set up a monitoring service to check your log store for these entries every X hours.
Any alternatives?
- rwbhn 12y agoMonitor that the newest backup is less than N hours old.
- caw 12y agoAlternatively, if you bother to have proper exit codes for your backup scripts, you could verify exit != 0, and alert on that. I have cron on all of my systems email STDERR to me, STDOUT is redirected to the normal logs. One you clean up your crons, you really only get email once a month or so when something breaks.
- porker 12y agoDo you use something like http://habilis.net/cronic/ http://habilis.net/cronic/ ?
- caw 12y agoNope, just instead of this 0 1 * * * backup >/var/log/foo 2>&1 I do this 0 1 * * * backup >/var/log/foo My errors are emailed to me via standard cron conventions. Normal logging is available for me if I care to look at it.
- tlack 12y agoI've had this same issue over and over again in my career. I've toyed with the idea of writing a daily "sanity checker" in crontab that verifies various concepts of system health. Examples: Did the latest batch of data transfer to S3? Did we delete old customer accounts today? Did we get any signups (because if not, something may be broken, but not triggering an exception report etc)? Did we send out daily report emails? But I could see this easily becoming a pointless exercise, and I doubt I'd have the time to keep the sanity checker updated with the latest requirements. In fact, the sanity checker would probably become insane pretty quickly. Perhaps the platform itself should do this for you, in some way. Idea: while coding, indicate that this procedure should be running periodically, ie: Monitor.registerPeriodicTask('email-reports', 'daily') and then the system would log every time it occurs, with a generic task that would run periodically and scan for things that should have occurred, but haven't in some while.