Changeset 145

Show
Ignore:
Timestamp:
05/20/10 14:31:23 (4 years ago)
Author:
ssteinpreis
Message:

Added database and machine name to email subject line

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/table_growth/table_growth_report.sh

    r26 r145  
    1010 
    1111LOGFILE=/home/postgres/logs/table_growth.rpt 
    12 psql -d pagila -c "select 'Top 10 Tables Growth For:-  '||to_char(current_date - '1 month'::interval,'Mon-YYYY') as Month; select table_owner, schema_name, table_name, pg_size_pretty(growth_size::bigint) as Growth_size_MB from otools.table_growth where sum_flag = 2 and to_char(capture_time,'mm/yyyy')=to_char((current_date - '1 month'::interval),'mm/yyyy') order by growth_size desc limit 10;" > $LOGFILE 
     12DNAME=your_real_postgres_db_name 
     13 
     14/opt/pgsql90alpha4/bin/psql -d ${DNAME} -c "select 'Top 10 Tables Growth For:-  '||to_char(current_date - '1 month'::interval,'Mon-YYYY') as Month; select table_owner, schema_name, table_name, pg_size_pretty(growth_size::bigint) as Growth_size_MB from otools.table_growth where sum_flag = 2 and to_char(capture_time,'mm/yyyy')=to_char((current_date - '1 month'::interval),'mm/yyyy') order by growth_size desc limit 10;" > $LOGFILE 
    1315 
    1416if [ -s "$LOGFILE" ]; then 
    15   mailx -s "Tablegrowth Monitor Report" dba@example.com < $LOGFILE 
     17  M_HOSTNAME=$(hostname)'.'$(cat /etc/resolv.conf | grep domain | cut -f2 -d' ') 
     18  mailx -s "Tablegrowth Monitor Report for ${DNAME} on ${M_HOSTNAME}" dba@omniti.com < $LOGFILE 
    1619fi 
    1720rm $LOGFILE