generic command wrapper?

Andreas Ericsson ae at op5.se
Thu Jan 6 17:02:11 CET 2005


Ben wrote:
> Of course, but I've been able to have several hundred active processes 
> for months now without a single reboot. (Gotta love beefy hardware.)
> 
> Anyway, I only plan to have about 40 or 50 service instances use this 
> wrapper, with 5 minutes between checks.
>

Your best bet would be to implement some sort of scheduling 
lock-mechanism then. Like so (in pseudo-code);

pid = getpid();
append_to_file(lockfile, pid);
while(1) {
   running_check = readfirstline(lockfile);
   if(running_check == pid) {
     status = do_the_checking();
   }
   else sleep_some(); /* to keep from using 100% CPU */
}

delete_pidline_from(lockfile);

exit(status);

Whatever you do, don't write it in shell. In case you make any mistakes 
with the scheduling you might run out of pids. No hardware in the world 
will save you from that.

> On Jan 6, 2005, at 7:23 AM, Andreas Ericsson wrote:
> 
>> Ben wrote:
>>
>>> I'd rather have locking and just allow for long execution times, 
>>> because that just seems like it might allow for less configuration 
>>> locations.
>>
>>
>> You are ofcourse aware of the possibility that you in that case can 
>> create so many processes that your system crashes?
>>
>>> On Jan 6, 2005, at 5:55 AM, Andreas Ericsson wrote:
>>>
>>>> Ben wrote:
>>>>
>>>>> I need to run a proprietary vendor tool to make a service check, but
>>>>> unfortunately this tool is pretty awful and cannot be run more than 
>>>>> once
>>>>> at a time. Is there any generic tool out there that somebody has 
>>>>> written
>>>>> which would let me wrap a file lock and some timeout protection 
>>>>> around a generic shell command?
>>>>
>>>>
>>>>
>>>> You don't need locking so much as a spooler. Be warned though that 
>>>> spooling management commands is considered terribly poor practice, 
>>>> and you would need to passively submit the results, since the 
>>>> spooler can't possibly return the proper status immediately.
>>>>
>>>> -- 
>>>> Andreas Ericsson                   andreas.ericsson at op5.se
>>>> OP5 AB                             www.op5.se
>>>> Lead Developer
>>
>>
>> -- 
>> Andreas Ericsson                   andreas.ericsson at op5.se
>> OP5 AB                             www.op5.se
>> Lead Developer
> 
> 
> 

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list