Changeset 291

Show
Ignore:
Timestamp:
11/08/11 20:10:17 (2 years ago)
Author:
depesz
Message:

1. use variables for queries - to make it obvious that header is built using the same query as normal data collection
2. indent variable definitions
3. make find use "-exec ... +" instead of "-print0 | xargs -0 " to make it a bit more portable, work with less forks and data i/o
4. make it use more standarized place for logs (/var/log)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tools/system_monitoring-sample-config.cfg

    r287 r291  
    11# Global configuration, log directory 
    2 GLOBAL.logdir=/home/depesz/monitoring 
    3 GLOBAL.pidfile=/home/depesz/monitoring/pidfile 
     2GLOBAL.logdir=/var/log/system_monitoring/ 
     3GLOBAL.pidfile=/var/log/system_monitoring/pidfile 
    44GLOBAL.env.PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 
    55GLOBAL.env.PGUSER=postgres 
    66GLOBAL.env.PGDATABASE=template1 
    77 
    8 GLOBAL.var.psql=psql -qAX -F"   " -c 
     8GLOBAL.var.psql               = psql -qAX -F"   " -c 
     9GLOBAL.var.activity_query     = select now(), * from pg_stat_activity where current_query <> $$<IDLE>$$ 
     10GLOBAL.var.locks_query        = select * FROM pg_locks 
     11GLOBAL.var.database_query     = SELECT *, pg_database_size(oid) as size FROM pg_database 
     12GLOBAL.var.indexes_query      = SELECT *, pg_relation_size(indexrelid) as size FROM pg_stat_all_indexes 
     13GLOBAL.var.indexes_io_query   = SELECT * FROM pg_statio_all_indexes 
     14GLOBAL.var.tables_query       = SELECT *, pg_table_size(relid) as size, pg_total_relation_size(relid) as total_size FROM pg_stat_all_tables 
     15GLOBAL.var.tables_io_query    = SELECT * FROM pg_statio_all_tables 
    916 
    1017# Checks configuration 
     
    4047 
    4148check.pg_stat_activity.type=periodic 
    42 check.pg_stat_activity.exec=@psql 'COPY ( select now(), * from pg_stat_activity where current_query <> $$<IDLE>$$ ) TO STDOUT' 
    43 check.pg_stat_activity.header=!@psql 'select now(), * from pg_stat_activity where false' | sed -ne '1p' 
     49check.pg_stat_activity.exec=@psql 'COPY ( @activity_query ) TO STDOUT' 
     50check.pg_stat_activity.header=!@psql '@activity_query LIMIT 0' | sed -ne '1p' 
    4451check.pg_stat_activity.interval=30 
    4552 
    4653check.pg_locks.type=periodic 
    47 check.pg_locks.exec=@psql 'COPY ( select * from pg_locks ) TO STDOUT' 
    48 check.pg_locks.header=!@psql "select * from pg_locks where false" | sed -ne '1p' 
     54check.pg_locks.exec=@psql 'COPY ( @locks_query ) TO STDOUT' 
     55check.pg_locks.header=!@psql '@locks_query limit 0' | sed -ne '1p' 
    4956check.pg_locks.interval=30 
    5057 
    5158check.pg_stat_database.type=periodic 
    52 check.pg_stat_database.exec=@psql 'COPY ( select * from pg_stat_database ) TO STDOUT' 
    53 check.pg_stat_database.header=!@psql 'select * from pg_stat_database where false' | sed -ne '1p' 
     59check.pg_stat_database.exec=@psql 'COPY ( @database_query ) TO STDOUT' 
     60check.pg_stat_database.header=!@psql '@database_query LIMIT 0' | sed -ne '1p' 
    5461check.pg_stat_database.interval=300 
    5562 
    5663check.pg_stat_all_indexes.type=periodic 
    57 check.pg_stat_all_indexes.exec=@psql 'COPY ( select * from pg_stat_all_indexes ) TO STDOUT' 
    58 check.pg_stat_all_indexes.header=!@psql 'select * from pg_stat_all_indexes where false' | sed -ne '1p' 
     64check.pg_stat_all_indexes.exec=@psql 'COPY ( @indexes_query ) TO STDOUT' 
     65check.pg_stat_all_indexes.header=!@psql '@indexes_query LIMIT 0' | sed -ne '1p' 
    5966check.pg_stat_all_indexes.interval=300 
    6067 
    6168check.pg_stat_all_tables.type=periodic 
    62 check.pg_stat_all_tables.exec=@psql 'COPY ( select * from pg_stat_all_tables ) TO STDOUT' 
    63 check.pg_stat_all_tables.header=!@psql 'select * from pg_stat_all_tables where false' | sed -ne '1p' 
     69check.pg_stat_all_tables.exec=@psql 'COPY ( @tables_query ) TO STDOUT' 
     70check.pg_stat_all_tables.header=!@psql '@tables_query LIMIT 0' | sed -ne '1p' 
    6471check.pg_stat_all_tables.interval=300 
    6572 
    6673check.pg_statio_all_indexes.type=periodic 
    67 check.pg_statio_all_indexes.exec=@psql 'COPY ( select * from pg_statio_all_indexes ) TO STDOUT' 
    68 check.pg_statio_all_indexes.header=!@psql 'select * from pg_statio_all_indexes where false' | sed -ne '1p' 
     74check.pg_statio_all_indexes.exec=@psql 'COPY ( @indexes_io_query ) TO STDOUT' 
     75check.pg_statio_all_indexes.header=!@psql '@indexes_io_query LIMIT 0' | sed -ne '1p' 
    6976check.pg_statio_all_indexes.interval=300 
    7077 
    7178check.pg_statio_all_tables.type=periodic 
    72 check.pg_statio_all_tables.exec=@psql 'COPY ( select * from pg_statio_all_tables ) TO STDOUT' 
    73 check.pg_statio_all_tables.header=!@psql 'select * from pg_statio_all_tables where false' | sed -ne '1p' 
     79check.pg_statio_all_tables.exec=@psql 'COPY ( @tables_io_query ) TO STDOUT' 
     80check.pg_statio_all_tables.header=!@psql '@tables_io_query LIMIT 0' | sed -ne '1p' 
    7481check.pg_statio_all_tables.interval=300 
    7582 
     
    7784check.cleanup.type=periodic 
    7885check.cleanup.interval=300 
    79 check.cleanup.exec=find . -type f -name '*.log' -mmin +60 -print0 | xargs -0 gzip 
     86check.cleanup.exec=find . -type f -name '*.log' -mmin +60 -exec gzip {} + 
    8087check.cleanup.ignore=1 
    8188