diff --git a/files/nagios/client/check_lock.cfg b/files/nagios/client/check_lock.cfg new file mode 100644 index 0000000000..c79e9ba467 --- /dev/null +++ b/files/nagios/client/check_lock.cfg @@ -0,0 +1 @@ +command[check_lock]=/usr/lib/nagios/plugins/check_lock diff --git a/files/nagios/client/scripts/check_lock b/files/nagios/client/scripts/check_lock new file mode 100755 index 0000000000..1a58e95ef8 --- /dev/null +++ b/files/nagios/client/scripts/check_lock @@ -0,0 +1,17 @@ +#!/usr/bin/python + +import fcntl +import sys + +try: + f = open('/mnt/koji/.nagios_test', 'r') + f.close() + f = open('/mnt/koji/.nagios_test', 'w') +except IOError: + print "Could not create file" + sys.exit(2) + +fcntl.flock(f, fcntl.LOCK_EX) +f.close() +print "File Locked Successfully" +sys.exit(0) diff --git a/tasks/nagios_client.yml b/tasks/nagios_client.yml index 63c3b826f2..56093f0882 100644 --- a/tasks/nagios_client.yml +++ b/tasks/nagios_client.yml @@ -22,6 +22,7 @@ with_items: - check_postfix_queue - check_raid.py + - check_lock # create dirs # puppet used to make /var/spool/nagios (owned by nagios.nagios) mode 750 @@ -50,6 +51,7 @@ - check_disk.cfg - check_swap.cfg - check_postfix_queue.cfg + - check_lock.cfg notify: - restart nrpe tags: