Coder Social home page Coder Social logo

check_burp_backup_age's Introduction

check_burp_backup_age

Nagios local check for burp's timestamps backup age.

Always check github for last version: https://github.com/regilero/check_burp_backup_age

Burp backup project: (http://burp.grke.org/)

Author: regilero (https://github.com/regilero)

Usage

./check_burp_backup_age.py -h
usage: check_burp_backup_age [-h] [-v] -H [HOSTNAME] [-d [DIRECTORY]]
                             [-w [WARNING]] [-c [CRITICAL]]

Local check, Check freshness of last backup for a given host name. Running on
the backup server this program will check the timestamp file of the last
backup for a given host and get the age of this last successful run. This age
is then compared to thresolds to generate alerts.

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program version
  -H [HOSTNAME], --hostname [HOSTNAME]
                        hostname (directory name for burp) [default: None]
  -d [DIRECTORY], --directory [DIRECTORY]
                        base directory path for backups (where are the
                        backups?) [default: /backups]
  -w [WARNING], --warning [WARNING]
                        Warning thresold, time in minutes before going to
                        warning [default: 1560]
  -c [CRITICAL], --critical [CRITICAL]
                        Critical thresold, time in minutes before going to
                        critical [default: 1800]

Note that this is a local check, running on the backup server. So the hostname
argument is not used to perform any distant connection.

Important

  • This is a local check, so use it with NRPE or check_by_ssh or such tools.
  • warning and critical thresolds are expressed in minutes, the default values are:
    • warning: 26 hours so 1560 minutes
    • critical: 30 hours so 1800 minutes

Examples

~# ./check_burp_backup_age.py  -d /data/burp -H foo.example.com
BURP OK - Last backup is fresh enough: 0 day(s) 21 hour(s) 23 minute(s) (1283<1560)

~# ./check_burp_backup_age.py  -d /data/burp -H foo.example.com -w 1200 -c 1500
BURP WARNING - Last backup starts to get old: 0 day(s) 21 hour(s) 23 minute(s) (1283>=1200)

~# ./check_burp_backup_age.py  -d /data/burp -H foo.example.com -w 800 -c 1200
BURP CRITICAL - Last backup is too old: 0 day(s) 21 hour(s) 23 minute(s) (1283>=1200)

~# ./check_burp_backup_age.py  -d /data/burp -H bar.example.com
BURP CRITICAL - Host backup directory /data/burp/bar.example.com does not exists

:~# ./check_burp_backup_age.py  -d /backups -H bar.example.com
BURP CRITICAL - Base backup directory /backups does not exists

check_burp_backup_age's People

Contributors

regilero avatar ymettier avatar

Watchers

 avatar  avatar

Forkers

ymettier

check_burp_backup_age's Issues

BURP CRITICAL - invalid syntax in timestamp file (/data/myhostname/current/timestamp)

Hello,

I get this error :

bash-4.4# python ./check_burp_backup_age.py  -H myhostname -d /data 
BURP CRITICAL - invalid syntax in timestamp file (/data/myhostname/current/timestamp)

Let's see the timestamp file :

bash-4.4# cat /data/myhostname/current/timestamp
0000010 2018-06-30 17:01:13 +0000

OK, let's fix it (I'm in a docker container, where vim is not installed) :

bash-4.4# sed -i -e 's/not 3/not 4/g' check_burp_backup_age.py 

Now check again :

bash-4.4# python ./check_burp_backup_age.py  -H myhostname -d /data 
BURP OK - Last backup is fresh enough: 0 day(s) 16 hour(s) 14 minute(s) (974<1560)

I guess you prefer a better fix than mine, because some burp servers will write the date with 3 items when mine has 4. Like maybe if len[parts] not in [3, 4] instead of if 3 not == len[parts]. Or if l < 3 or l > 4 where l is len[parts]...
I'm not the best pythonist on Earth so maybe you will find a better solution than mine.

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.