Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Network > RHN Satellite Server > Issue <<  41 of 131 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 5422
Last update: 11-09-06
Issue:
How can I monitor the tablespace used by the database on a Red Hat Network (RHN) Satellite and receive notice before it is full?
Resolution:

If using an external Oracle database with the Red Hat Network (RHN) Satellite, let the database administrator set this up.

If using an embedded database with the RHN Satellite, then use cron to execute the following script, which will send an email alert when tablespace fills beyond 90% in any table.

 
#!/bin/bash

#  Example shell script which can be added to roots cron job to check the
# Embedded Satellite disk space usage. If any table is over 90% usage, send
# a notice to the default email address configured within the Satellite.

#
# This script is supplied as a working example and is not supported by Red Hat
#

# Example cron entry:
# 1 */6 * * * /root/check-oracle-space-usage.sh

PATH=/usr/bin:/bin
export PATH

reportusage() {
   su - oracle -c "db-control report"
}

mailitout() {
   #get Satellite email address
   MAILADDRESS=`grep "traceback_mail" /etc/rhn/rhn.conf | awk '{print $3}'`

   SUBJECT="Warning - low space usage on Satellite oracle DB"

   BODY="This is a notice to let you know that you have gone over 90% usage in
one of the Oracle Tablespaces. We recommend to be proactive and increase the
space usage before getting to 100% usage. Please consult the Satellite
documentation on using db-control to increase the size or contact Red Hat
Support for assistance."

   ( echo $BODY; echo ; reportusage ) | mail -s "$SUBJECT" $MAILADDRESS
   exit 0
}

#grab the usage numbers from the db-control report output
NUMBERS=`reportusage | awk ‘{print $5}‘|sed ‘1d‘| sed ‘s/%//g‘`

# run db-control and then use awk and sed to get the % numbers
for num in $NUMBERS
   do
   # if number is over 90% then send warning email
   if [ $num -gt 90 ]
      then mailitout
   fi
done
exit 0

Note: This script has been included in all Satellite versions since 4.1.0. The script is automatically installed in /etc/cron.daily from the rhn-dobby package, so the notification is switched "ON" by default.


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Network > RHN Satellite Server > Issue <<   41  of  131  >>