bundles/icinga2: less code for icinga statusmonitor
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
1e13e632c9
commit
05670ac2bb
1 changed files with 4 additions and 9 deletions
|
@ -8,23 +8,18 @@ app = Flask(__name__)
|
|||
|
||||
@app.route('/status')
|
||||
def statuspage():
|
||||
everything_fine = True
|
||||
try:
|
||||
check_output(['/usr/lib/nagios/plugins/check_procs', '-C', 'icinga2', '-c', '1:'])
|
||||
|
||||
# check_output will raise an exception if there is a non-zero status
|
||||
icinga_is_fine = True
|
||||
except:
|
||||
icinga_is_fine = False
|
||||
everything_fine = False
|
||||
|
||||
try:
|
||||
check_output(['/usr/lib/nagios/plugins/check_procs', '-C', 'postgres', '-c', '1:'])
|
||||
|
||||
# check_output will raise an exception if there is a non-zero status
|
||||
postgres_is_fine = True
|
||||
except:
|
||||
postgres_is_fine = False
|
||||
everything_fine = False
|
||||
|
||||
if icinga_is_fine and postgres_is_fine:
|
||||
if everything_fine:
|
||||
return 'OK', 200
|
||||
|
||||
return 'Something is wrong!', 500
|
||||
|
|
Loading…
Reference in a new issue