mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 16:01:58 +00:00
The new puppet.conf file has to be moved into place manually. (imported from commit 253d9a95386dae8c803a998ce2dc7e8be40c880a)
30 lines
520 B
Python
Executable File
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)
|