Monitorizar backups de oracle con nagios

Imagen de dvastazion

Pues eso, otro script en fase inicial (pero funcional) para añadir a nagios y monitorizar que tenemos backup de nuestra BBDD a través del catálogo de rman.

#!/bin/bash
#Autor:Dvastazion
##########################################
# check_rman_backup v 0.1
#
# Monitorizamos 3 BBDD ORA1/ORA2/ORA3 en oracle 9i a través del catálogo de rman.
# ORA1 tiene full a cinta y a disco semanal e incremental diario
# ORA2 y ORA3 tienen full a cinta semanal e incremental a cinta diario. No tienen backup a disco.
# El script comprueba que tengamos backup de las BBDD inferior a un día o lanzará un warning e inferior a una semana o lanzará un crítical.
# El script sólo chequea una BBDD en un dispositivo por sentencia, ej. "check_rman_backup rman rman RMANCAT ORA1 cinta" sólo
# comprueba la BBDD ORA1 en cinta
#
##########################################
##Salidas a Nagios
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=3
#
#Comprobamos que pasamos todos los parametros necesarios
if [ $# -ne 5 ]; then
        echo "Usage: $0 <usuario> <password> <catalog> <BBDD:ORA1/ORA2/ORA3> <device:cinta/disco>"                                        
        echo                                                                    
        echo "Example: $0 rman rman RMANCAT ORA1 cinta"                          
        exit $UNKNOWN
fi
#
#Asignación de parámetros a variables
usuario=$1
password=$2
catalog=$3
bbdd=$4
device=$5
#
#
#Asignamos ID a la variable elegida para la select. CUIDADO el ID será necesario cambiarlo en el script
if [ $4 ]; then
        if [ $bbdd == ORA1 ]; then
                ID=243286319 ###########<-------CAMBIAR POR ID de nuestra bbdd
        elif [ $bbdd == ORA2 ]; then
                ID=1475908551 ###########<-------CAMBIAR POR ID de nuestra bbdd
        elif [ $bbdd == ORA3 ]; then
                ID=3954036567 ###########<-------CAMBIAR POR ID de nuestra bbdd
        else
                echo "Usage: $0 <usuario> <password> <catalog> <BBDD:ORA1/ORA2/ORA3> <device:cinta/disco>"                                        
                echo                                                                    
                echo "Example: $0 rman rman RMANCAT ORA1 disco"
                exit $UNKNOWN
        fi
fi
#
#
#Asignamos tipo de dispositivo a la variable para la select
if [ $5 ]; then
        if [ $device == cinta ]; then
                device="SBT_TAPE"
        elif [ $device == disco ]; then
                device="DISK"
        else
                echo "Usage: $0 <usuario> <password> <catalog> <BBDD:ORA1/ORA2/ORA3> <device:cinta/disco>"                                        
                echo                                                                    
                echo "Example: $0 rman rman RMANCAT ORA1 disco"
                exit $UNKNOWN
        fi
fi
#
#Formateamos fecha del sistema y la pasamos a UNIXTIME
Date=`date +"%Y/%m/%d"`
Unix_sys_date=`date --date "$Date" +%s`
#
#Lanzamos la select, aislamos la fecha y la pasamos a UNIXTIME
Ult_tag=`echo "select tag, to_char(completion_time, 'YYYY/MM/DD') from rc_backup_piece where device_type='$device' and $ID=DB_ID and TAG is not null;" | sqlplus $usuario/$password@$catalog | tail -7 | head -1`
last_backup_date=`echo $Ult_tag | awk -F\  '{ print $2 }'`
#
if [ $last_backup_date ]; then
        Unix_last_backup_date=`date --date "$last_backup_date" +%s`
fi
#
################DEBUG##############################
#echo "Fecha de sistema: " $Date
#echo "Unix Fecha de sistema:" $Unix_sys_date
#echo "Ultimo TAG en" $4 "en " $5  $Ult_tag
#echo "Unix fecha ultimo backup: " $Unix_last_backup_date
#######################################################
#
#
if [ $4 == ORA1 ]; then
        if [ $5 == cinta ]; then
                if [ $(( Unix_sys_date - Unix_last_backup_date )) -le  604800 ]; then
                        echo "OK, hace menos de una semana del último backup full a cinta"
                        exit $OK
                else
                        echo "Critical, hace más de una semana del último backup full a cinta"
                        exit $CRITICAL
                fi
        fi
        if [ $5 == disco ]; then
                if [ $(( Unix_sys_date - Unix_last_backup_date )) -le  86400 ]; then
                        echo "OK, hace menos de un dia del último backup a disco"
                        exit $OK
                elif [ $(( Unix_sys_date - Unix_last_backup_date )) -gt  604800 ]; then
                        echo "Critical, hace más de una semana del último backup full a disco"
                        exit $CRITICAL
                else
                        echo "warning, hace más de un día del último backup a disco"
                        exit $WARNING
                fi
        fi
fi
#
if [ $4 == ORA2 ] || [ $4 == ORA3 ]; then
        if [ $5 == cinta ]; then
                if [ $(( Unix_sys_date - Unix_last_backup_date )) -le  86400 ]; then
                        echo "OK, hace menos de un dia del último backup a cinta"
                        exit $OK
                elif [ $(( Unix_sys_date - Unix_last_backup_date )) -gt  86400 ] && [ $(( Unix_sys_date - Unix_last_backup_date )) -le  604800 ]; then
                        echo "Warning, hace más de un día del último backup a cinta"
                        exit $WARNING
                elif [ $(( Unix_sys_date - Unix_last_backup_date )) -gt  604800 ]; then
                        echo "CRITICAL, hace más de una semana del último backup a cinta"
                        exit $CRITICAL
                fi
        else
                echo "Revise el código la BBDD " $4 "no tiene backup a disco"
                exit $UNKNOWN
        fi
fi
#

2 comments

18
Ene

moncler jackets
canada goose
coach factory outlet
christian louboutin outlet
ugg boots
canada goose jackets uk
yeezy 350 boost
uggs outlet
ray ban sunglasses discount
coach factorty outlet
michael kors outlet
michael kors outlet
pandora charms
michael kors outlet online
canada goose outlet
moncler jackets
coach factory outlet online
canada goose sale
kate spade
polo outlet
coach outlet
hermens bags
pandora jewelry
canada goose outlet
ugg boots
moncler outlet
nike zoom
moncler jackets outlet
the north face
longchamp outlet
coach factory outlet
timberland outlet
coach factory outlet
ralph lauren outlet
michael kors outlet
cheap uggs
adidas yeezy
north face jackets
canada goose outlet
coach outlet online
louis vuitton outlet
cheap ray ban sunglasses
ralph lauren outlet
mulberry uk
cheap ugg boots
nike shoes
hermes handbags
ugg outlet
oakley sunglasses
ugg shoes
ugg outlet store
coach outlet
fitflops sale clearance
jordan retro 11
adidas nmd
moncler outlet
burberry
cheap nfl jerseys
pandora jewelry
pandora jewelry
nike outlet
air max 97
ugg boots
michael kors canada
canada goose jackets
coach factory outlet
christian louboutin outlet
birkenstocks
ugg boots
ralph lauren uk
coach handbags
ugg outlet
nike outlet
north face outlet online
michael kors outlet
coach outlet online
oakley sunglasses
michael kors outlet
burberry outlet store
ugg shoes
coach factorty outlet
moncler outlet
coach canada
coach factory outlet online
cheap jordans for sale
pandora outlet
air max 2018
ralph lauren outlet
ugg boots
nike shoes
ugg ustralia
michael kors outlet store
air jordan shoes
cheap ray bans
nike outlet store
michael kors outlet
ralph lauren sale clearance
michael kors handbags
harden vol 1
uggs outlet
michael kors outlet clearance
nike outlet online
timberland boots
ugg boots
fitflops
coach outlet
kate spade
adidas yeezy boost
pandora charms uk
coach factory outlet
ralph lauren outlet
nike outlet store
yeezy boost
uggs clearance
supreme clothing
michael kors outlet
cheap mlb jerseys china
coach canada
cheap mlb jerseys
nike store
ugg boots canada
pandora charms sale clearance
canada goose
pandora jewelry outlet
nike air max
adidas superstar
cheap uggs
uggs
yeezy boost
ugg outlet
nike shoes
ultra boost
adidas nmd
coach outlet
supreme clothing
moncler outlet
north face outlet
ugg boots
coach outlet
michael kors outlet clearance
canada goose jackets
fitflops
mbt shoes
oakley sunglasses
jordan retro
oakley sunglasses
coach outlet
canada goose
ray ban sunglasses
moncler jackets
pandora
cheap jordans
ferragamo shoes
adidas yeezy
moncler uk
adidas outlet
moncler outlet
north face jackets
adidas nmd
ugg outlet
canadian goose
nmd shoes
coach outlet store
canada goose outlet
michael kors outlet
ralph lauren outlet
adidas nmd
cat boots
air jordan shoes
canada goose
red bottom shoes
canada goose outlet
ralph lauren
louis vuitton
michael kors outlet clearance
polo ralph lauren outlet online
burberry outlet
polo ralph lauren outlet
mbt
air jordans
ugg outlet
canada goose clothing
ralph lauren outlet
coach outlet
yeezy boost
ray ban sunglasses
pandora charms
canada goose outlet
uggs canada
canada goose jackets
kate spade outlet store
cheap nfl jerseys
ralph lauren outlet
canada goose outlet
pandora charms sale clearance
michael kors handbags
hermes handbags
canada goose coats
canada goose uk
canada goose
north face jackets
pandora charms
longchamp uk
cheap jordans
uggs
hermes bags
coach factory outlet
canada goose uk
cheap jordans
ralph lauren outlet
michael kors outlet
salvatore ferragamo shoes
oakley sunglasses
uggs
kate spade outlet store
supreme clothing
ugg outlet
coach outlet
doudoune moncler
ralph lauren
longchamp outlet
columbia sportswear
coach outlet
pandora jewelry
canada goose uk
coach factory outlet
burberry outlet
cheap uggs
christian louboutin
canada goose outlet
ralph lauren outlet
ugg boots
nike shoes for men
ugg outlet
coach outlet store online clearances
pandora charms
canada goose outlet
ugg boots on sale
michael kors outlet
ugg boots for women
ralph lauren outlet
moncler jackets
nfl jerseys wholesale
canada goose outlet
coach outlet
mbt shoes
kate spade outlet
coach factory outlet
oakley sunglasses
cheap jordans
ugg boots
jordan shoes
pandora outlet
pandora charms sale clearance
coach factory outlet
timberland boots
pandora store
canada goose uk
coach outlet
canada goose sale
fred perry polo
air max 97
coach outlet store
polo ralph lauren
michael kors outlet
coach outlet
burberry outlet
yeezy boost
discount oakley sunglasses
pandora charms
canada goose outlet
adidas shoes
uggs canada
michael kors outlet
adidas outlet
coach outlet store
ugg outlet
canada goose sale
ugg outlet
moncler jackets
oakley sunglasses sale
coach factory outlet
pandora charms sale
kate spade handbags
louis vuitton outlet store
canada goose jackets
valentino shoes outlet
adidas yeezy boost
christian louboutin outlet
polo ralph lauren outlet online
polo ralph lauren outlet
burberry sale
kate spade outlet
canada goose outlet
pandora charms sale
coach outlet store
michael kors outlet clearance
adidas shoes
nmd adidas
pandora outlet
coach outlet
adidas yeezy
coach outlet store
mulberry handbags
michael kors
kate spade bags
cheap jordans
moncler coats
hermes birkin
jordans
kate spade outlet
michael kors outlet
coach outlet
ralph lauren uk
red bottoms shoes
adidas outlet
polo ralph lauren outlet
nmd adidas
fitflops sale clearance
polo ralph lauren outlet online
michael kors outlet clearance
ralph lauren uk
mulberry outlet
pandora charms
ugg outlet
louis vuitton outlet online
louboutin shoes
cheap jordans free shipping
tory burch outlet
ralph lauren sale clearance
adidas campus
coach factory outlet
canada goose uk
canada goose jackets
longchamp outlet online
supreme new york
fitflops sale
longchamp handbags
red bottoms
canada goose sale
ralph lauren outlet
coach outlet
coach factory outlet
north face jackets
philipp plein outlet
gucci outlet
nfl jerseys wholesale
canada goose jackets
coach bags
coach outlet store online
air jordans
polo outlet
canada goose outlet
ugg outlet
canada goose
ugg boots
michael kors handbags
canada goose outlet
ugg outlet
polo ralph lauren outlet online
yeezy boost 350
ugg australia
coach outlet
valentino shoes
tory burch outlet store
pandora charms
ralph lauren outlet
ferragamo outlet
canada goose
nike air max
moncler
cheap oakley sunglasses
adidas shoes
ugg outlet
longchamp handbags
jordan shoes
polo ralph lauren outlet online
ralph lauren outlet
coach outlet
ugg boots on sale
fred perry
michael kors outlet
cheap ray ban sunglasses
ugg outlet online
canada goose outlet
moncler outlet
adidas yeezy
adidas shoes
burberry outlet canada
ray ban sunglasses
ugg boots
moncler
adidas yeezy
canada goose jackets
nike outlet
michael kors uk
mulberry bags
ugg outlet
ugg boots
michael kors canada
north face outlet
louboutin shoes
hermes handbags
louis vuitton outlet
cheap nfl jerseys
ray ban sunglasses
christian louboutin
cheap oakley sunglasses
coach outlet
ugg outlet
canada goose outlet
jordan shoes
adidas superstar
pandora charms
michael kors outlet
michael kors outlet
canada goose jackets
birkenstock sandals
canada goose outlet
ugg outlet
gucci handbags
adidas yeezy boost
pandora jewelry
michael kors outlet online
coach outlet
polo ralph lauren outlet
michael kors factory outlet
fitflops
air max 2018
coach outlet
timberland boots outlet
uggs outlet
philipp plein shirt
ugg outlet
michael kors outlet online
polo ralph lauren outlet
adidas
ugg boots
louis vuitton outlet online
ralph lauren uk
ugg outlet
hermes outlet
north face outlet
air max 2017
kate spade handbag
ugg outlet
cheap ray ban sunglasses
coach outlet
salvatore ferragamo
ray ban sunglasses
coach factory outlet
adidas shoes
michael kors outlet store
yeezy boost
1.03linpingping

18
Ene

moncler jackets
canada goose
coach factory outlet
christian louboutin outlet
ugg boots
canada goose jackets uk
yeezy 350 boost
uggs outlet
ray ban sunglasses discount
coach factorty outlet
michael kors outlet
michael kors outlet
pandora charms
michael kors outlet online
canada goose outlet
moncler jackets
coach factory outlet online
canada goose sale
kate spade
polo outlet
coach outlet
hermens bags
pandora jewelry
canada goose outlet
ugg boots
moncler outlet
nike zoom
moncler jackets outlet
the north face
longchamp outlet
coach factory outlet
timberland outlet
coach factory outlet
ralph lauren outlet
michael kors outlet
cheap uggs
adidas yeezy
north face jackets
canada goose outlet
coach outlet online
louis vuitton outlet
cheap ray ban sunglasses
ralph lauren outlet
mulberry uk
cheap ugg boots
nike shoes
hermes handbags
ugg outlet
oakley sunglasses
ugg shoes
ugg outlet store
coach outlet
fitflops sale clearance
jordan retro 11
adidas nmd
moncler outlet
burberry
cheap nfl jerseys
pandora jewelry
pandora jewelry
nike outlet
air max 97
ugg boots
michael kors canada
canada goose jackets
coach factory outlet
christian louboutin outlet
birkenstocks
ugg boots
ralph lauren uk
coach handbags
ugg outlet
nike outlet
north face outlet online
michael kors outlet
coach outlet online
oakley sunglasses
michael kors outlet
burberry outlet store
ugg shoes
coach factorty outlet
moncler outlet
coach canada
coach factory outlet online
cheap jordans for sale
pandora outlet
air max 2018
ralph lauren outlet
ugg boots
nike shoes
ugg ustralia
michael kors outlet store
air jordan shoes
cheap ray bans
nike outlet store
michael kors outlet
ralph lauren sale clearance
michael kors handbags
harden vol 1
uggs outlet
michael kors outlet clearance
nike outlet online
timberland boots
ugg boots
fitflops
coach outlet
kate spade
adidas yeezy boost
pandora charms uk
coach factory outlet
ralph lauren outlet
nike outlet store
yeezy boost
uggs clearance
supreme clothing
michael kors outlet
cheap mlb jerseys china
coach canada
cheap mlb jerseys
nike store
ugg boots canada
pandora charms sale clearance
canada goose
pandora jewelry outlet
nike air max
adidas superstar
cheap uggs
uggs
yeezy boost
ugg outlet
nike shoes
ultra boost
adidas nmd
coach outlet
supreme clothing
moncler outlet
north face outlet
ugg boots
coach outlet
michael kors outlet clearance
canada goose jackets
fitflops
mbt shoes
oakley sunglasses
jordan retro
oakley sunglasses
coach outlet
canada goose
ray ban sunglasses
moncler jackets
pandora
cheap jordans
ferragamo shoes
adidas yeezy
moncler uk
adidas outlet
moncler outlet
north face jackets
adidas nmd
ugg outlet
canadian goose
nmd shoes
coach outlet store
canada goose outlet
michael kors outlet
ralph lauren outlet
adidas nmd
cat boots
air jordan shoes
canada goose
red bottom shoes
canada goose outlet
ralph lauren
louis vuitton
michael kors outlet clearance
polo ralph lauren outlet online
burberry outlet
polo ralph lauren outlet
mbt
air jordans
ugg outlet
canada goose clothing
ralph lauren outlet
coach outlet
yeezy boost
ray ban sunglasses
pandora charms
canada goose outlet
uggs canada
canada goose jackets
kate spade outlet store
cheap nfl jerseys
ralph lauren outlet
canada goose outlet
pandora charms sale clearance
michael kors handbags
hermes handbags
canada goose coats
canada goose uk
canada goose
north face jackets
pandora charms
longchamp uk
cheap jordans
uggs
hermes bags
coach factory outlet
canada goose uk
cheap jordans
ralph lauren outlet
michael kors outlet
salvatore ferragamo shoes
oakley sunglasses
uggs
kate spade outlet store
supreme clothing
ugg outlet
coach outlet
doudoune moncler
ralph lauren
longchamp outlet
columbia sportswear
coach outlet
pandora jewelry
canada goose uk
coach factory outlet
burberry outlet
cheap uggs
christian louboutin
canada goose outlet
ralph lauren outlet
ugg boots
nike shoes for men
ugg outlet
coach outlet store online clearances
pandora charms
canada goose outlet
ugg boots on sale
michael kors outlet
ugg boots for women
ralph lauren outlet
moncler jackets
nfl jerseys wholesale
canada goose outlet
coach outlet
mbt shoes
kate spade outlet
coach factory outlet
oakley sunglasses
cheap jordans
ugg boots
jordan shoes
pandora outlet
pandora charms sale clearance
coach factory outlet
timberland boots
pandora store
canada goose uk
coach outlet
canada goose sale
fred perry polo
air max 97
coach outlet store
polo ralph lauren
michael kors outlet
coach outlet
burberry outlet
yeezy boost
discount oakley sunglasses
pandora charms
canada goose outlet
adidas shoes
uggs canada
michael kors outlet
adidas outlet
coach outlet store
ugg outlet
canada goose sale
ugg outlet
moncler jackets
oakley sunglasses sale
coach factory outlet
pandora charms sale
kate spade handbags
louis vuitton outlet store
canada goose jackets
valentino shoes outlet
adidas yeezy boost
christian louboutin outlet
polo ralph lauren outlet online
polo ralph lauren outlet
burberry sale
kate spade outlet
canada goose outlet
pandora charms sale
coach outlet store
michael kors outlet clearance
adidas shoes
nmd adidas
pandora outlet
coach outlet
adidas yeezy
coach outlet store
mulberry handbags
michael kors
kate spade bags
cheap jordans
moncler coats
hermes birkin
jordans
kate spade outlet
michael kors outlet
coach outlet
ralph lauren uk
red bottoms shoes
adidas outlet
polo ralph lauren outlet
nmd adidas
fitflops sale clearance
polo ralph lauren outlet online
michael kors outlet clearance
ralph lauren uk
mulberry outlet
pandora charms
ugg outlet
louis vuitton outlet online
louboutin shoes
cheap jordans free shipping
tory burch outlet
ralph lauren sale clearance
adidas campus
coach factory outlet
canada goose uk
canada goose jackets
longchamp outlet online
supreme new york
fitflops sale
longchamp handbags
red bottoms
canada goose sale
ralph lauren outlet
coach outlet
coach factory outlet
north face jackets
philipp plein outlet
gucci outlet
nfl jerseys wholesale
canada goose jackets
coach bags
coach outlet store online
air jordans
polo outlet
canada goose outlet
ugg outlet
canada goose
ugg boots
michael kors handbags
canada goose outlet
ugg outlet
polo ralph lauren outlet online
yeezy boost 350
ugg australia
coach outlet
valentino shoes
tory burch outlet store
pandora charms
ralph lauren outlet
ferragamo outlet
canada goose
nike air max
moncler
cheap oakley sunglasses
adidas shoes
ugg outlet
longchamp handbags
jordan shoes
polo ralph lauren outlet online
ralph lauren outlet
coach outlet
ugg boots on sale
fred perry
michael kors outlet
cheap ray ban sunglasses
ugg outlet online
canada goose outlet
moncler outlet
adidas yeezy
adidas shoes
burberry outlet canada
ray ban sunglasses
ugg boots
moncler
adidas yeezy
canada goose jackets
nike outlet
michael kors uk
mulberry bags
ugg outlet
ugg boots
michael kors canada
north face outlet
louboutin shoes
hermes handbags
louis vuitton outlet
cheap nfl jerseys
ray ban sunglasses
christian louboutin
cheap oakley sunglasses
coach outlet
ugg outlet
canada goose outlet
jordan shoes
adidas superstar
pandora charms
michael kors outlet
michael kors outlet
canada goose jackets
birkenstock sandals
canada goose outlet
ugg outlet
gucci handbags
adidas yeezy boost
pandora jewelry
michael kors outlet online
coach outlet
polo ralph lauren outlet
michael kors factory outlet
fitflops
air max 2018
coach outlet
timberland boots outlet
uggs outlet
philipp plein shirt
ugg outlet
michael kors outlet online
polo ralph lauren outlet
adidas
ugg boots
louis vuitton outlet online
ralph lauren uk
ugg outlet
hermes outlet
north face outlet
air max 2017
kate spade handbag
ugg outlet
cheap ray ban sunglasses
coach outlet
salvatore ferragamo
ray ban sunglasses
coach factory outlet
adidas shoes
michael kors outlet store
yeezy boost
1.03linpingping