Fix NRPE stats collection

Commit c0b936c739 broke NRPE stats
collection via a cron job due to a misplacement of the conditional
for checking for enablement of the management plugin.

Restore previous code flow for NRPE stats enable/disable.

Change-Id: Ice1058c8f926ff559c0bfac6615315ed6eefb11d
Closes-Bug: 1778849
This commit is contained in:
James Page 2018-07-15 12:04:47 +01:00
parent dcbc4304f0
commit 44e0d79836
1 changed files with 3 additions and 2 deletions

View File

@ -613,12 +613,13 @@ def update_nrpe_checks():
rsync(os.path.join(charm_dir(), 'scripts',
'collect_rabbitmq_stats.sh'), script)
write_file(STATS_CRONFILE, cronjob)
elif os.path.isfile(STATS_CRONFILE):
os.remove(STATS_CRONFILE)
if config('management_plugin'):
rsync(os.path.join(charm_dir(), 'scripts',
'check_rabbitmq_cluster.py'),
os.path.join(NAGIOS_PLUGINS, 'check_rabbitmq_cluster.py'))
elif os.path.isfile(STATS_CRONFILE):
os.remove(STATS_CRONFILE)
# Find out if nrpe set nagios_hostname
hostname = nrpe.get_nagios_hostname()