Why not use SEC (<a href="http://simple-evcorr.sourceforge.net/">http://simple-evcorr.sourceforge.net/</a>), or something similar, to watch the nagios.log file and match on a regexp pattern. When that pattern is seen, run the script of your choice. I assume that anytime the Nagios process is restarted a log will be generated there.<br clear="all">
<br>-- Eric Cables<br>
<br><br><div class="gmail_quote">On Thu, Jul 15, 2010 at 7:59 AM, Paul M. Dubuc <span dir="ltr"><<a href="mailto:work@paul.dubuc.org">work@paul.dubuc.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Ryan C Ash wrote:<br>
><br>
><br>
><br>
> Paul M. Dubuc wrote<br>
<div class="im">>><br>
>> I would like to have some way of running a command only when Nagios is<br>
>> started, or is restarted from the "Process Commands" menu, or any time<br>
>> Nagios reloads its configuration files. Is there a way to do this? I<br>
>> thought about writing it as a localhost service plugin that simply does<br>
>> nothing if<br>
>><br>
>> $LASTSERVICECHECK$> $PROCESSSTARTTIME$<br>
>><br>
>> but that doesn't seem optimal. It this the best solution? It would be<br>
>> nice if I could write it as an event handler, but events are only for<br>
>> host or service state changes. This is a Nagios process state change.<br>
><br>
</div><div class="im">> We run on redhat linux and I use a common init script in<br>
> /etc/rc.d/init.d/<nagios>. That would be an easy place to add that<br>
> additional script. Currently it maintains our pnp4nagios, nsca<br>
> listener, ndoutils, etc.<br>
<br>
</div>Thanks for your response.<br>
<br>
What I really need is something that will run my script anytime Nagios reads<br>
its config files (possible configuration change) so this is only a partial<br>
solution. Executing the "Restart the Nagios process" process command from the<br>
Process Info screen doesn't create a new Nagios process (it has the same PID<br>
after the restart), but it does cause Nagios to reload the configuration and<br>
resets the $PROCESSSTARTTIME$ macro value. The localhost plugin I describe<br>
above does the job, but I wouldn't be able to guarantee that it would run<br>
promptly after the restart event and there seems to be no way to have it just<br>
run once instead of at intervals. This isn't a problem for my current use so<br>
I can keep doing it this way.<br>
<br>
It would be nice for Nagios to have a process restart (or config changed)<br>
event for which one cold write an event handler script.<br>
<div><div></div><div class="h5"><br>
<br>
------------------------------------------------------------------------------<br>
This SF.net email is sponsored by Sprint<br>
What will you do first with EVO, the first 4G phone?<br>
Visit <a href="http://sprint.com/first" target="_blank">sprint.com/first</a> -- <a href="http://p.sf.net/sfu/sprint-com-first" target="_blank">http://p.sf.net/sfu/sprint-com-first</a><br>
_______________________________________________<br>
Nagios-users mailing list<br>
<a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>
::: Messages without supporting info will risk being sent to /dev/null<br>
</div></div></blockquote></div><br>