Leonardo,

Como você já possui o sendmail configurado é so proceder da seguinte forma:

Instale o mailx caso ele não esteja instalado ainda.

Adicione as seguintes entradas no commands.cfg:

define command {
command_name notify-host-by-email
command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type:
$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress:
$HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” |
/usr/bin/mailx -s “** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is
$HOSTSTATE$ **” $CONTACTEMAIL$
register 1
}

define command {
command_name notify-service-by-email
command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type:
$NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress:
$HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time:
$LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n” | /usr/bin/mailx -s
“** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is
$SERVICESTATE$ **” $CONTACTEMAIL$
register 1

Agora no Contacts.cfg vc deve ter a entrada dos comandos de notificação
conforme exemplo abaixo:

define contact {
contact_name usuario
contactgroups *
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24×7
service_notification_period 24×7
host_notification_options d,r,s
service_notification_options w,c,r,s
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
email usua...@linuxservice.com.br
register 1
}

No arquivo de configuração do serviços services.cfg voce deverá especificar
o usuário também ex:

define service {
host_name http://www.ig.com.br-187.31.64.25
service_description Site Response Time – HTTP
use service-check-interval-1min,grafico
check_command check_http!-p 80 -H $HOSTADDRESS$ -f follow -t5
contacts usuario
register 1
}

Como você pode observar acima eu uso um template service-check-inertval-1min
que conté as opções de periodos de notificacao, etc:

define service {
name service-check-interval-1min
max_check_attempts 3
check_interval 1
retry_interval 1
check_period 24×7
check_freshness 0
freshness_threshold 600
notification_interval 60
notification_period 24×7
notification_options w,c
notifications_enabled 1
contact_groups admins
register 0

Depois de salvas as configurações é só dar um reload.

Só cuidado na hora de configurar o tempo e o tipo de notificação para que
ela não vire um spam.

abs.

Everton
www,linuxservice.com.br
www.portaldamonitoracao.com


Em 31 de julho de 2011 12:07, Jose Oliveira <jotag...@gmail.com> escreveu:

> Leonardo
>
> O Nagios só encaminha o pedido de envio da mensagem para o postfix ou
> sendmail, o que voce escolher.
>
> Recomendo que escolha um. Nao sei se o Linux vai gostar de ter os dois...
>
> Teste se o postfix ou sendmail conseguem mandar email corretamente.
> Configurações de smart host são relativamente fáceis de fazer no sendmail.
> Postfix eu não conheço mas dizem que é mais fácil ainda...
>
> Somente depois disto, volte ao Nagios...
>
> []s
>
>
> Em 30 de julho de 2011 13:13, Leonardo Lima
> <llima....@bancomaxima.com.br>escreveu:
>
> > Bom dia Pessoal,
> >
> > Sou novo no Nagios .
> >
> >
> > Como faço para configurar o envio de e-mail pelo nagios. utilizo nagios +
> > centreon. tenho instalado o postfix e o sendmail....
> >
> > Não estou conseguindo fazer a configuração certa. Tenho um servidor
> > exchange gostaria de utilizar o mesmo para entregar as mensagens como
> > procedo com essa configuração ?
> >
> >
> > obrigado desde já pela atençãod e todos
> >
> >
> ------------------------------------------------------------------------------
> > Got Input?   Slashdot Needs You.
> > Take our quick survey online.  Come on, we don't ask for help often.
> > Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> > http://p.sf.net/sfu/slashdot-survey
> > --
> > Nagios-users-br@lists.sourceforge.net mailing list
> > https://lists.sourceforge.net/lists/listinfo/nagios-users-br
> > Wiki: http://nagios-br.sf.net/wiki
> >
>
>
>
> --
> Abraços
>
> José Geraldo de Oliveira
> Linux user #492561
> Certified LPIC-1
>
> ------------------------------------------------------------------------------
> Got Input?   Slashdot Needs You.
> Take our quick survey online.  Come on, we don't ask for help often.
> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> http://p.sf.net/sfu/slashdot-survey
> --
> Nagios-users-br@lists.sourceforge.net mailing list
> https://lists.sourceforge.net/lists/listinfo/nagios-users-br
> Wiki: http://nagios-br.sf.net/wiki
>
------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
-- 
Nagios-users-br@lists.sourceforge.net mailing list
https://lists.sourceforge.net/lists/listinfo/nagios-users-br
Wiki: http://nagios-br.sf.net/wiki

Reply via email to