From b07d95c28d90b8168fd02a81c3e2d2ed9fc5ba35 Mon Sep 17 00:00:00 2001 From: Brad Marshall Date: Thu, 20 Nov 2014 12:16:45 +1000 Subject: [PATCH] [bradm] Add network namespace checks --- hooks/quantum_hooks.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hooks/quantum_hooks.py b/hooks/quantum_hooks.py index 422aae48..ebfda445 100755 --- a/hooks/quantum_hooks.py +++ b/hooks/quantum_hooks.py @@ -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()