Creating new plugin -- questions...

Braun Brelin bbrelin at openapp.biz
Thu Mar 10 19:51:10 CET 2005


I'm reading up on passive checks now.  Thanks for the info. 
As regards the sleep() on the daemon, the other problem here is that the
log file basically writes the following stuff...

<date/time> <request for a lock:>  <requester id:>  <current locker id>
.
.
.


If the current locker has held the lock for more than approx 30 seconds,
then it's an alert condition.  basically, i've opened up the log file
within the daemon using a '|/usr/bin/tail -1f <filename>' argument to
open.  

If I put in a sleep() don't I take the risk of potentially missing an
alert? 

Braun Brelin
OpenApp


On Thu, 2005-03-10 at 18:40, Andreas Ericsson wrote:
> Braun Brelin wrote:
> > Hello all,
> > 
> > this is my first time posting to this list.  I'm trying to create a
> > custom plugin that monitors an applications log file in real time. 
> > 
> > I'm unclear as to whether or not I can do this explicitly with a plugin
> > (the real time aspect). 
> > 
> > I'm running a Nagios 2.x management console that's getting data from a
> > production Linux system running nrpe.  The real time monitoring needs to
> > run on the production box.  
> > 
> > I'm trying to create the plugin (using Perl as my language) thus; 
> > 
> > 1.  Create a daemon that actually monitors the log file. 
> > 2.  On a specific event, the daemon will write status information to a
> > data file. 
> > 3.  The plugin will read the data file at a specified interval and send
> > it back through the nrpe daemon to the nagios console.  
> > 
> > Is this the right way to go about it?  I don't quite see how to merge
> > the steps so that the plugin does all of the functionality in one
> > program.  Since the code needs to run in real time, for example, I can't
> > output any of the Nagios error codes since the daemon never quits unless
> > the entire system goes down. 
> > 
> 
> You'll need to create a daemon that continuously reads the logfile and 
> submits a passive check result to nagios upon the error condition line. 
> If you use a plugin called by nrpe you gain absolutely nothing by using 
> a daemon.
> 
> Make sure you put a sleep() somewhere in the daemon btw, or you'll eat 
> CPU like that big pink bunny in the Muppet Show.



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click




More information about the Developers mailing list