2020-11-22 17:53:57 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
from subprocess import check_output
|
|
|
|
|
2021-02-12 19:37:36 +00:00
|
|
|
from flask import Flask
|
|
|
|
|
2020-11-22 17:53:57 +00:00
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
@app.route('/status')
|
|
|
|
def statuspage():
|
2021-06-11 14:49:12 +00:00
|
|
|
everything_fine = True
|
2020-11-22 17:53:57 +00:00
|
|
|
try:
|
|
|
|
check_output(['/usr/lib/nagios/plugins/check_procs', '-C', 'icinga2', '-c', '1:'])
|
|
|
|
except:
|
2021-06-11 14:49:12 +00:00
|
|
|
everything_fine = False
|
2020-11-22 17:53:57 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
check_output(['/usr/lib/nagios/plugins/check_procs', '-C', 'postgres', '-c', '1:'])
|
|
|
|
except:
|
2021-06-11 14:49:12 +00:00
|
|
|
everything_fine = False
|
2020-11-22 17:53:57 +00:00
|
|
|
|
2021-06-11 14:49:12 +00:00
|
|
|
if everything_fine:
|
2020-11-22 17:53:57 +00:00
|
|
|
return 'OK', 200
|
2021-02-12 19:37:36 +00:00
|
|
|
|
|
|
|
return 'Something is wrong!', 500
|