On Sep 3, 2009, at 13:18, Leandro Quibem Magnabosco <leandro.magnabo...@fcdl-sc.org.br
> wrote:
"Olá" Leonardo,
Please note that Nagios uses mostly scripts to check services/disk/
etc. and that those scripts that 'tell' nagios the status of the
service/daemon/disk/etc.
That said, I think you should not focus on Nagios to be proactive
hence that it's scripts could be used for that.
Let's say you have check_http configured to check www.example.com.
It would connect to www.example.com on port 80 and report if it
suceeds on sending a cmd or not .
If something goes wrong, it would send a critical message back.
This does not mean that the script is necessarily alerting nagios
about the problem, it is alerting whatever called it in the first
place.
What I mean is, you don't *need* nagios to be in the middle of it
and (IMO) you should not try to integrate it into this kind of
solution because it would just make things more complicated.
One simple way to implement that would be improving the scripts that
comes with nagios-plugins.
A "simple" if statement and some coding after it would do the trick.
If the script already has the capability to check the status of
something and be aware of the present status and take active
measures .
Interfere with the "function" that prints the message "CRITICAL" to
make it, for eg., "ssh -T host /etc/init.d/apache2 restart".
I have used the scripts from Nagios in a similar way: a project
("extotest") using Nagios plugins and autotools' autotest to check all
critical services before and after complex firewall ACL changes. It's
similar in that it leverages the good work of many contributors but
doesn't use the Nagios Core as an engine.
In your case, a cronjob might suffice:
#!bash
case $(check_http -opt -opt) in
OK*)
exit 0
;;
*)
exec /etc/init.d/httpd restart
;;
esac
Allan
--
http://tech.chickenandporn.com/tags/nagios
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagios-users mailing list
Nagios-users@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