Files
zulip/puppet/zulip-internal/files/nagios_plugins/check_fts_update_log
Zev Benjamin dd678465ae [manual] Move puppet modules to the top level
The new puppet.conf file has to be moved into place manually.

(imported from commit 253d9a95386dae8c803a998ce2dc7e8be40c880a)
2013-10-30 15:42:26 -04:00

30 lines
520 B
Python
Executable File

#!/usr/bin/python
"""
Nagios plugin to check the length of the FTS update log.
"""
import psycopg2
states = {
"OK": 0,
"WARNING": 1,
"CRITICAL": 2,
"UNKNOWN": 3
}
def report(state, num):
print "%s: %s rows in fts_update_log table" % (state, num)
exit(states[state])
conn = psycopg2.connect("host=localhost user=zulip")
cursor = conn.cursor()
cursor.execute("SELECT count(*) FROM fts_update_log")
num = cursor.fetchall()[0][0]
if num > 5:
report('CRITICAL', num)
report('OK', num)