323
323
check_cmd="/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -p 8000 -e ' 200 OK' -u '/nagios/postgres'",
326
# Builds a nagios check command to verify `store-poller` log file age
327
# according the service configuration.
328
environment = hookenv.Config()['environment']
329
log_path = os.path.join(LOG_DIR, 'store-poller.log')
330
max_age_seconds = int(config['store_poller_nagios_file_age_max_minutes']) * 60
331
check_cmd = "/usr/lib/nagios/plugins/check_file_age -w {0} -c {0} -f {1}".format(
336
# If `store-poller` cronscript is enabled in this unit, ensure the log file
337
# exists. Otherwise 'negate' standard check (verifies cronscript is not running).
326
338
config_unit = config.get('store_poller_unit')
327
339
local_unit = int(hookenv.local_unit().split('/')[-1])
329
340
if local_unit == config_unit:
330
environment = hookenv.Config()['environment']
331
log_path = os.path.join(LOG_DIR, 'store-poller.log')
332
# Create the file now, so the nagios check doesn't fail right after
333
# we've completed the deployment.
334
341
host.write_file(log_path,"", "www-data", "www-data", perms=0o660)
335
max_age_seconds = int(config['store_poller_nagios_file_age_max_minutes']) * 60
336
nrpe_compat.add_check(
337
shortname="store_poller_check",
338
description="Store poller check.",
339
check_cmd="/usr/lib/nagios/plugins/check_file_age -w {0} -c {0} -f {1}".format(
343
check_cmd = "negate {}".format(check_cmd)
345
nrpe_compat.add_check(
346
shortname="store_poller_check",
347
description="Store poller check.",
344
351
nrpe_compat.write()