Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Notification for table space warning

Status
Not open for further replies.

andytheautomator

Technical User
Nov 20, 2003
32
US
Hello,

I'd like to setup an email that comes to me whenever the table space utilization reaches 80%. I can't seem to find where I would set this up and I know nothing about the command line statements for DB2. Any help would be greatly appreciated. We're on Version 8.1

Thanks,
 
Hi there,

if you're on AIX you could do it like this:

----------------------------------------------------
#!/usr/bin/ksh

MAX=90
FATALMAX=97

su - <db2sid> -c "db2 list tablespaces show detail" | awk -v MAX=$MAX '
/Name/{NAME=$3}
/Total pages/{TOTAL=$4}
/Used pages/{USED=$4;
FULL=100*USED/TOTAL;
if(FULL > MAX && FULL < 100){
CMD=sprintf("echo \"Warning: Tablespace %s is at %d Percent !\" | mail -s \"Tablespace Alert !\" user@company", NAME, FULL);
system(CMD);
}
}'



su - <db2sid> -c "db2 list tablespaces show detail" | awk -v FATALMAX=$FATALMAX '
/Name/{NAME=$3}
/Total pages/{TOTAL=$4}
/Used pages/{USED=$4;
FULL=100*USED/TOTAL;
if(FULL > FATALMAX && FULL < 100){
CMD=sprintf("echo \"Critical: Tablespace %s is at %d Percent !\" | mail -s \"Tablespace Alert !\" user@company", NAME, FULL);
system(CMD);
}
}'
----------------------------------------------------

Put this script into crontab and schedule it every 5 minutes or so ...

Regards
Thomas
 
Use SNAPSHOT_TBS_CFG table function to calculate percentages and send an email ... MSOffice VB macro than can connect to your email server should be able to do this ..

Alternatively, use the Health Monitor ...

Sathyaram

For db2 resoruces visit More DB2 questions answered at &
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top