XO Backup reports in Nagios

You are probably using XO reports when making XenServer backup with Xen Orchestra. You can already send those reports via emails, XMPP or even Slack/MatterMost.

But this time, we decided to also provide you a way to check if your backups were done correctly via Nagios.

Passive checks

To do that, the best way is to use passive checks: it means it's not Nagios that will request your XOA (for backup purpose, it doesn't make sense: how could you know when to check if the backup is finished?).

In fact, it's the opposite: when a backup is done, XOA will send a message to Nagios. Without any news coming from XOA after a time, Nagios can trigger an alarm. And if the backup went wrong, XOA can send the message.

In order to contact Nagios, you must have NSCA running on this Nagios host. The architecture is like this:

NSCA

On Nagios host

Nagios configuration

Just create a host for XOA:

define host{  
        use                     generic-host            ; Name of $
        host_name               xoa
        alias                   Xen Orchestra Appliance
        address                 192.168.0.245
        }

Now, we'll create a dedicated service for XOA backups:

define service{  
        name                            passif-generic
        use                             generic-service
        service_description             xoabackups
        host_name                       xoa
        active_checks_enabled           0
        passive_checks_enabled          1
        is_volatile                     1
        max_check_attempts              1
        check_freshness                 1
        freshness_threshold             86400
        check_command                   no-backup-report!0!No backup message sent in the last 24 hours
}

Basically, this service will just wait for XOA to send backup news in the last 24 hours.

By the way, the check_command is very basic:

define command{  
        command_name    no-backup-report
        command_line    /usr/lib/nagios/plugins/check_dummy 2 "Results of backup job were not reported!"
        }

You are set! The service is ready. If the service doesn't have news from XOA it will be in CRITICAL state like this:

Nagios service ready

NSCA

Check your config file and add a password and a least XOR encryption:

password=mypassword  
decryption_method=1  

In XOA

Just go for the Nagios plugin and configure it properly:

You can even test the plugin:

If your backup is successful, you'll have this:

That's it! Now, all your backups can be reported to Nagios. You are covered :)