Quem puder me ajudar agradeço...<br>
<br>
Estou com um problema no meu tratador de evento.<br>
<br>
Meu services.cfg<br>
<br>
# Monitorando de teste<br>
<br>
define service{<br>
use
service-padrao<br>
host_name
linux-firewall-bh<br>
service_description
teste<br>
check_command
check_ping!100.0,20%!500.0,60%<br>
event_handler restart-httpd<br>
}<br>
<br>
MEu checkcommands.cfg<br>
<br>
define command{<br>
command_name restart-httpd<br>
command_line
/usr/local/nagios/libexec/eventhandlers/restart-httpd
$SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$<br>
}<br>
<br>
meu script ...<br>
<br>
#!/bin/sh<br>
#<br>
# Event handler script for restarting the web server on the local machine<br>
#<br>
# Note: This script will only restart the web server if the service is<br>
# retried 3 times (in a "soft" state) or if the web service somehow<br>
# manages to fall into a "hard" error state.<br>
#<br>
<br>
<br>
# What state is the HTTP service in?<br>
case "$1" in<br>
OK)<br>
# The service just came back up, so don't do anything...<br>
;;<br>
WARNING)<br>
# We don't really care about warning states, since the service is probably still running...<br>
;;<br>
UNKNOWN)<br>
# We don't know what might be causing an unknown error, so don't do anything...<br>
;;<br>
CRITICAL)<br>
# Aha! The HTTP service appears to have a problem - perhaps we should restart the server...<br>
<br>
# Is this a "soft" or a "hard" state?<br>
case "$2" in<br>
<br>
# We're in a "soft" state, meaning that Nagios is in the middle of retrying the<br>
# check before it turns into a "hard" state and contacts get notified...<br>
SOFT)<br>
<br>
# What check attempt are we on? We don't want to restart the web server on the first<br>
# check, because it may just be a fluke!<br>
case "$3" in<br>
<br>
# Wait until the check has been tried 3 times before restarting the web server.<br>
# If the check fails on the 4th time (after we restart the web server), the state<br>
# type will turn to "hard" and contacts will be notified of the problem.<br>
# Hopefully this will restart the web server successfully, so the 4th check will<br>
# result in a "soft" recovery. If that happens no one gets notified because we<br>
# fixed the problem!<br>
3)<br>
echo -n "Restarting HTTP service (3rd soft critical state)..."<br>
# Call the init script to restart the HTTPD server<br>
<br>
/bin/touch /teste/teste3<br>
;;<br>
esac<br>
;;<br>
<br>
# The HTTP service somehow managed to turn into a hard error without getting fixed.<br>
# It should have been restarted by the code above, but for some reason it didn't.<br>
# Let's give it one last try, shall we? <br>
# Note: Contacts have already been notified of a problem with the service at this<br>
# point (unless you disabled notifications for this service)<br>
HARD)<br>
echo -n "Restarting HTTP service..."<br>
# Call the init script to restart the HTTPD server<br>
/bin/touch /teste/teste3<br>
;;<br>
esac<br>
;;<br>
esac<br>
exit 0<br>
<br>
Tela de log...<br>
<br>
<img src="http://10.71.198.174/nagios/images/critical.png" alt="Host Down" title="Host Down" align="left">[10-17-2006 11:33:24] HOST ALERT: linux-firewall-bh;DOWN;HARD;5;CRITICAL - Plugin timed out after 10 seconds<br clear="all">
<img src="http://10.71.198.174/nagios/images/hostevent.gif" alt="Host Event Handler" title="Host Event Handler" align="left">[10-17-2006 11:33:14] HOST EVENT HANDLER: linux-firewall-bh;DOWN;SOFT;4;restart-httpd<br clear="all">
<img src="http://10.71.198.174/nagios/images/critical.png" alt="Host Down" title="Host Down" align="left">[10-17-2006 11:33:14] HOST ALERT: linux-firewall-bh;DOWN;SOFT;4;CRITICAL - Plugin timed out after 10 seconds<br clear="all">
<img src="http://10.71.198.174/nagios/images/hostevent.gif" alt="Host Event Handler" title="Host Event Handler" align="left">[10-17-2006 11:33:04] HOST EVENT HANDLER: linux-firewall-bh;DOWN;SOFT;3;restart-httpd<br clear="all">
<img src="http://10.71.198.174/nagios/images/critical.png" alt="Host Down" title="Host Down" align="left">[10-17-2006 11:33:04] HOST ALERT: linux-firewall-bh;DOWN;SOFT;3;CRITICAL - Plugin timed out after 10 seconds<br clear="all">
<img src="http://10.71.198.174/nagios/images/hostevent.gif" alt="Host Event Handler" title="Host Event Handler" align="left">[10-17-2006 11:32:54] HOST EVENT HANDLER: linux-firewall-bh;DOWN;SOFT;2;restart-httpd<br clear="all">
<img src="http://10.71.198.174/nagios/images/critical.png" alt="Host Down" title="Host Down" align="left">[10-17-2006 11:32:54] HOST ALERT: linux-firewall-bh;DOWN;SOFT;2;CRITICAL - Plugin timed out after 10 seconds<br clear="all">
<img src="http://10.71.198.174/nagios/images/hostevent.gif" alt="Host Event Handler" title="Host Event Handler" align="left">[10-17-2006 11:32:44] HOST EVENT HANDLER: linux-firewall-bh;DOWN;SOFT;1;restart-httpd<br clear="all">
<img src="http://10.71.198.174/nagios/images/critical.png" alt="Host Down" title="Host Down" align="left">[10-17-2006 11:32:44] HOST ALERT: linux-firewall-bh;DOWN;SOFT;1;CRITICAL - Plugin timed out after 10 seconds<br>
<br>
e nada !!! Não cria o arquivo teste3 dentro da pasta /teste<br>
<br>
mas seu eu rodar o script na mão passando os parametros ele vai EX:<br>
<br>
/restart-httpd CRITICAL SOFT 3<br>
<br>
Onde estou errando?<br>
<br>
<br>
<br clear="all"><br>-- <br>Rafael Brito Gomes<br>Sistema de Informação<br>Universidade Salvador<br><br>Linux User - 430086<br><br>Meu Blog<br><a href="http://rafaelgomes.wordpress.com/">http://rafaelgomes.wordpress.com/</a>
<br><br>Blog do Sinot<br><a href="http://sinot.wordpress.com/">http://sinot.wordpress.com/</a><br><br>Calourada Livre da Unifacs<br><a href="http://wiki.unifacs.br/gnufacs/twiki/bin/view/Gnufacs/ProgCalourada20062">http://wiki.unifacs.br/gnufacs/twiki/bin/view/Gnufacs/ProgCalourada20062
</a>