Permalink
Browse files

Add Nagios check plugin for rsnapshot backups

  • Loading branch information...
1 parent 3983141 commit 4edbd268afefc2da3c7a9cc5df274219f531fe07 @barryo committed Sep 28, 2012
Showing with 1,085 additions and 1 deletion.
  1. +6 −1 README.md
  2. +1,079 −0 check_rsnapshot.php
View
@@ -31,7 +31,8 @@ License
Unless stated otherwise at the top of the script of its help output, all scripts
are:
- Copyright (c) 2011, Barry O'Donovan <barry@opensolutions.ie>
+ Copyright (c) 2004 - 2012, Barry O'Donovan <info@opensolutions.ie>
+ Copyright (c) 2004 - 2012, Open Source Solutions Limited <info@opensolutions.ie>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -70,6 +71,10 @@ site at http://www.barryodonovan.com/.
Overview of Available Plugins
-----------------------------
+### check_rsnapshot.php
+
+A script to check backups made via rsnapshot. See https://github.com/barryo/nagios-plugins/wiki/check_rsnapshot.php.
+
### check_barracuda_lb_active.pl
A script to check if a given Barracuda load balance in high availability state
Oops, something went wrong.

7 comments on commit 4edbd26

Hi Barry,

I would love to use your nagios-plugin for monitoring our rsnapshot backup-jobs.

The problem is I'm getting an error message all the time, saying there is an undefined index: "retain" referenced in the cmdargs-array. I cant program PHP but it seems like it is just not defined in the array

Here are some line of the output:

Warning: Invalid argument supplied for foreach() in /tmp/check_rsnapshot.php on line 402
PHP Notice: Undefined index: retain in /tmp/check_rsnapshot.php on line 402

Notice: Undefined index: retain in /tmp/check_rsnapshot.php on line 402
PHP Warning: Invalid argument supplied for foreach() in /tmp/check_rsnapshot.php on line 402

Warning: Invalid argument supplied for foreach() in /tmp/check_rsnapshot.php on line 402
PHP Notice: Undefined index: retain in /tmp/check_rsnapshot.php on line 402

Notice: Undefined index: retain in /tmp/check_rsnapshot.php on line 402
PHP Warning: Invalid argument supplied for foreach() in /tmp/check_rsnapshot.php on line 402

Could you pheraps help me with that?

Best regards,
Jonathan

Owner

Hi Barry,

thank you for your quick response! There was indeed no parameter 'retain' in the rsnapshot configuration, there's only been the decrepeated parameter 'interval' instead.

I substituted 'interval' with 'retain' but the error message stays the same. Here's configfile, wich path is given as argument to check_rsnapshot.

####### MINIMAL RSNAPSHOT.CONF

config_version 1.2
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /usr/bin/rsync
cmd_ssh /usr/bin/ssh
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du
cmd_rsnapshot_diff /usr/bin/rsnapshot-diff

####### Do not touch

verbose 2
loglevel 3

####### snapshot task configuration ############# snapshot task configuration

snapshot_root /tmp/TestBackupVerzeichnis/rsnapshot
retain hourly 4
retain weekly 26
retain monthly 6
logfile /tmp/rsnapshot.log
lockfile /var/run/rsnapshot.rsync.pid
backup /tmp/TestVerzeichnis/ Test/

Added by Nagios check_rsnapshot.php and is required for directory creation checks

plugin first run at 2012-11-09 13:02:14

NAGIOS FIRSTRUN 1352466134

Best regards,
Jonathan

Owner

Hi,

the config is tab delimited and it does work for rsnapshot. I'll send you the original file in a few a minutes.

Thanks for your efforts!

Jonathan

The script is actually working now, the features that are not working are minifilesize-check and the minfiles-check. The rsnapshot-config cotains the following lines:

NAGIOS /tmp/TestVerzeichnis/ MINSIZE 100MB 90MB

NAGIOS /tmp/TestVerzeichnis/ MINFILES 220 210

But if I call the script in debug-mode it tells me, that the checks are ignored...Any Idea?

Jonathan

Owner

Jonathan,

Apologies, I'm not ignoring you, I've just been up the walls.

I'm fairly sure this is working in our production environment.

Have you used tabs to separate the fields in the #NAGIOS lines above?

  • Barry
Please sign in to comment.