Watching for Unison errors

monitoringsynchronizationunison

We've implemented a folder sync across two servers sitting in two different data centres using Unison. It's crucial for us that this folder sync work as expected as our SLAs depend on the data being available at both ends.

So far Unison has been working like an ace, no problems.

However, we need to implement a mechanism to ensure that someone is notified if Unison does throw up an error. I know of the standard Unison logs. But in addition to the standard logs I'm looking for another log that would only report errors, not the entire verbose log of everything the Unison service is doing.

This way we can monitor this 'errors-only' log and send out emails or SMSs to notify the correct individuals.

Best Answer

We use a wrapper around Unison that, on failure, creates a file in /tmp based on the pathname of the directory to sync. Then, there is a service check in Nagios that checks for the presence of these files, and sends up an alert if found. This way there is the verbose Unison log for more information, a quick way to know if something went wrong, and automated email/SMS if/when it does. You could also use cron for this if something like Nagios isn't available.