Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_postgresql_unused_db
1.0
2013-07-18
- Nagios 3.x
GPL
36171
File | Description |
---|---|
check_postgres_unused_db.sh | check_postgres_unused_db.sh |
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!
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)
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)
Reviews (0)
Be the first to review this listing!