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

Directory Tree

check_postgresql_unused_db

Current Version
1.0
Last Release Date
2013-07-18
Compatible With
  • Nagios 3.x
License
GPL
Hits
36213
Files:
FileDescription
check_postgres_unused_db.shcheck_postgres_unused_db.sh
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
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)