Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_rsnapshot.pl
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
This plugin is designed for scenarios where multiple backups are defined in different rsnaphost configuration files.
For example, to setup nagios to monitor backups defined in an rsnapshot configuration file 'backup-1.conf', where nagios and rsnapshot run on different machines:
1) Install this plugin on the rsnapshot server.
2) Edit the plugin to set '$conf_dir' to the location of our rsnapshot config files
3) Enable a mechanism for checking this remotely i.e. for e.g. for NRPE, add a line like:
command[check_rsnapshot_backup-1]=/usr/local/bin/check_rsnapshot.pl --conf backup-1.conf
to your nrpe.cfg.
4) Define appropriate nagios servicegroups/hostgroups i.e.:
define hostgroup {
hostgroup_name rsnapshot-servers
alias rsnapshot servers
members backupserver1.my.domain.com
}
define servicegroup {
servicegroup_name rsnapshot-service
alias rsnaphost backup service
}
5) Add a nagios service definition for each rsnapshot configuration you wish to monitor:
define service {
use service-template
hostgroup_name rsnapshot-servers
service_description rsnapshot backup: backup-1.conf
service_groups rsnapshot-service
check_command check-nrpe!check_rsnapshot_backup-1
}
Reload NRPE/nagios configurations and hopefully all will be working.
Rather than analysing on-disk data for file numbers like some plugins do , in this case we are checking for errors reported in the log file for the last instance of each backup interval run, along with warnings for backups which
have been running for >24 hours or backups which have not completed cleanly (i.e. a lockfile remains but no backup is running)
The configuration file to be used should be passed on the command line using the '--conf' argument. If the specified config file does not exist, the plugin will prepend the value of $conf_dir to this path, consequently it is
not necessary to fully qualify the path to the configuration file if $conf_dir is correctly set.
The number of snapshots found for each interval can also optionally be checked by adding the '--missing' argument. This checks that the number of on-disk snapshosts for each interval matchches those defined in the configuration.
This is optional since it can take some months to build up a full set of snapshots depending on rotation policies.
Since this plugin is parsing the configuration and log files, it is potentially fragile should these formats change. It has been developed and tested against rsnapshot 1.3.1 running on Solaris 10, but should work ok on
any unixy platform.
For example, to setup nagios to monitor backups defined in an rsnapshot configuration file 'backup-1.conf', where nagios and rsnapshot run on different machines:
1) Install this plugin on the rsnapshot server.
2) Edit the plugin to set '$conf_dir' to the location of our rsnapshot config files
3) Enable a mechanism for checking this remotely i.e. for e.g. for NRPE, add a line like:
command[check_rsnapshot_backup-1]=/usr/local/bin/check_rsnapshot.pl --conf backup-1.conf
to your nrpe.cfg.
4) Define appropriate nagios servicegroups/hostgroups i.e.:
define hostgroup {
hostgroup_name rsnapshot-servers
alias rsnapshot servers
members backupserver1.my.domain.com
}
define servicegroup {
servicegroup_name rsnapshot-service
alias rsnaphost backup service
}
5) Add a nagios service definition for each rsnapshot configuration you wish to monitor:
define service {
use service-template
hostgroup_name rsnapshot-servers
service_description rsnapshot backup: backup-1.conf
service_groups rsnapshot-service
check_command check-nrpe!check_rsnapshot_backup-1
}
Reload NRPE/nagios configurations and hopefully all will be working.
Rather than analysing on-disk data for file numbers like some plugins do , in this case we are checking for errors reported in the log file for the last instance of each backup interval run, along with warnings for backups which
have been running for >24 hours or backups which have not completed cleanly (i.e. a lockfile remains but no backup is running)
The configuration file to be used should be passed on the command line using the '--conf' argument. If the specified config file does not exist, the plugin will prepend the value of $conf_dir to this path, consequently it is
not necessary to fully qualify the path to the configuration file if $conf_dir is correctly set.
The number of snapshots found for each interval can also optionally be checked by adding the '--missing' argument. This checks that the number of on-disk snapshosts for each interval matchches those defined in the configuration.
This is optional since it can take some months to build up a full set of snapshots depending on rotation policies.
Since this plugin is parsing the configuration and log files, it is potentially fragile should these formats change. It has been developed and tested against rsnapshot 1.3.1 running on Solaris 10, but should work ok on
any unixy platform.
Reviews (1)
bypbrunnen, April 25, 2018
Really like this for checking the state of rsnapshot. Two quick things that will save you some time getting this working.
1. On debian, make sure to install 'libnagios-plugin-perl' on deb8 and prior or 'libmonitoring-plugin-perl' on deb9 and newer.
2. There is a minor parser bug as it doesn't account for consecutive tabs. This is easily corrected and fixes issue I was having not detecting a value for some parameters. The change is in sub parse_config, line 259 to make the tab split match one or more tabs.
Line 259:
- my @fields = split( /\t/, $_ );
+ my @fields = split( /\t+/, $_ );
Thanks again for a great plugin!
-Cheers, Peter.
1. On debian, make sure to install 'libnagios-plugin-perl' on deb8 and prior or 'libmonitoring-plugin-perl' on deb9 and newer.
2. There is a minor parser bug as it doesn't account for consecutive tabs. This is easily corrected and fixes issue I was having not detecting a value for some parameters. The change is in sub parse_config, line 259 to make the tab split match one or more tabs.
Line 259:
- my @fields = split( /\t/, $_ );
+ my @fields = split( /\t+/, $_ );
Thanks again for a great plugin!
-Cheers, Peter.