[bradm] Add network namespace checks

This commit is contained in:
Brad Marshall 2014-11-20 12:16:45 +10:00
parent 72ac421aba
commit 1b0a5d3206

View File

@ -236,9 +236,6 @@ def update_nrpe_config():
)
elif os.path.exists(sysv_init):
cronpath = '/etc/cron.d/nagios-service-check-%s' % service
checkpath = os.path.join(os.environ['CHARM_DIR'],
'files/nrpe-external-master',
'check_exit_status.pl'),
cron_template = '*/5 * * * * root \
/usr/local/lib/nagios/plugins/check_exit_status.pl -s /etc/init.d/%s \
status > /var/lib/nagios/service-check-%s.txt\n' % (service, service)
@ -252,6 +249,18 @@ status > /var/lib/nagios/service-check-%s.txt\n' % (service, service)
/var/lib/nagios/service-check-%s.txt' % service,
)
cronpath = '/etc/cron.d/nagios-netns-check'
cron_template = '*/5 * * * * root \
/usr/local/lib/nagios/plugins/check_netns.sh \
> /var/lib/nagios/netns-check.txt\n'
f = open(cronpath, 'w')
f.write(cron_template)
f.close()
nrpe.add_check(
shortname="netns",
description='Network Namespace check {%s}' % current_unit,
check_cmd='check_status_file.py -f /var/lib/nagios/netns-check.txt'
)
nrpe.write()