Prevent two specific checks from running simultaneously?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
vicd
Posts: 1
Joined: Sat Mar 05, 2011 8:04 am

Prevent two specific checks from running simultaneously?

Post by vicd »

I have two service checks:
  • #1 doing some "complex" long unit test, and, unfortunately, it does not correctly clean its temp stuff after completion (too bad, but I cannot affect this behavior).
  • #2 checks for free space on the drive, and, if below some threshold, its event handler cleans all the temp dirs, removing also all the garbage produced by #1.


What I want is to make sure these two checks never run at the same moment. I cannot tell whether #1 is running when #2 is attempting a cleanup, so #2 can easily blow up an active run of #1 (and #1 is of more value to us).

Do I have any options here?

Important notes:
1. setting non-overlapping time-periods for both checks proved to be unreliable - time periods only limit the start times, there's no knowledge whether the affected check (#1) is still running or has completed. Moreover, we'd like to keep the more-or-less random check start times.
2. I know that I can set a similar event handler in #1 making the cleanup immediately after the check itself completes. However, I cannot disable #2 at all , and there's still a risk that it will crash a running #1 by erasing its scrap data.

Any ideas are welcome.
Locked