Home Directory Plugins Databases PostgresQL check_postgresql_unused_db

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

check_postgresql_unused_db

Current Version
1.0
Last Release Date
2013-07-18
Compatible With
  • Nagios 3.x
License
GPL
Hits
32610
Files:
FileDescription
check_postgres_unused_db.shcheck_postgres_unused_db.sh
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This plugin finds the number of unused databases, that is, the databases that have created or not been accessed or modified a certain time ago.
It uses plpythonu language to create a function named "check_pg_unused_db_f" in the db to find out the directory status of the databases and uses the following query:

SELECT OID, datname, replace(check_pg_unused_db_f('"$TIME_MODE"', OID::int ),' ','_') as check_time FROM pg_database WHERE datallowconn and NOT datistemplate and datname NOT IN ('postgres')

If check_time is greater than the described value for unused criteria, it counts to increment one and if the count is greater than critical or warning value it gives alert.

The following parameters are used to define the unused database :-
-m --mode mode of time to check with current time to mark as unused (c = create, a = access, m = modified; default : a)
-t --time number of times after that database should be marked as unused
-x --units units of measurement to compare (s = seconds; m = minutes; h = hours; D = days; M = months; Y = year)