[manual] Move puppet modules to the top level

The new puppet.conf file has to be moved into place manually.

(imported from commit 253d9a95386dae8c803a998ce2dc7e8be40c880a)
This commit is contained in:
Zev Benjamin
2013-10-29 19:20:04 -04:00
parent 8ca76ba13f
commit dd678465ae
210 changed files with 12 additions and 13 deletions

View File

@@ -0,0 +1,32 @@
#!/usr/bin/python
import dateutil.parser
import pytz
import subprocess
from datetime import datetime, timedelta
states = {
"OK": 0,
"WARNING": 1,
"CRITICAL": 2,
"UNKNOWN": 3
}
def report(state, msg):
print "%s: %s" % (state, msg)
exit(states[state])
if subprocess.check_output(['psql', '-h', 'localhost', 'zulip', 'zulip', '-t', '-c',
'SELECT pg_is_in_recovery()']).strip() != 'f':
report('OK', 'this is not the primary')
try:
with open('/var/lib/nagios_state/last_postgres_backup', 'r') as f:
last_backup = dateutil.parser.parse(f.read())
except IOError:
report('UNKNOWN', 'could not determine completion time of last Postgres backup')
if datetime.now(tz=pytz.utc) - last_backup > timedelta(hours=25):
report('CRITICAL', 'last Postgres backup completed more than 25 hours ago: %s' % (last_backup,))
report('OK', 'last Postgres backup completed less than 25 hours ago: %s' % (last_backup,))