Personal tools
You are here: Home DB2 Scripts DB2 Nagios Plugins to monitor DB2 events Checking if a database is available
Navigation
Log in


Forgot your password?
 
Document Actions

Checking if a database is available

by Felipe Alkain de Souza last modified 2010-08-06 17:38

This script checks DB2 database connectivity

What
When 2010-08-06
from 17:37 to 17:37
Add event to calendar vCal
iCal

#!/usr/bin/ksh
##############################################################
# Author: Felipe Alkain de Souza
#
# Script Name: check_db_connections.sh
#
# Functionality: This script checks DB2 database connectivity
#
# Usage: ./check_db_connections.sh <db_name>
#
##############################################################

. $HOME/sqllib/db2profile

### Nagios RCs Variables
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3

### Check if the databases are online

db2 connect to $1 > /dev/null

if [ $? -ne 0 ]
then
        echo "$STATE_CRITICAL&DB2 -  The database $1 did not conee!"
        exit $STATE_CRITICAL
       
else
        echo "$STATE_OK&DB2 - The database $1 is available!"
        exit $STATE_OK
fi
db2 connect reset

Security Awareness
Would you like your company to implement gamification into your security awareness program?





Polls