Re: Configurar envio de e-mail

Everton Pestana <[email protected]> Sun, 31 Jul 2011 19:45:52 -0300
Newsgroups gmane.network.nagios.user.brazil
Message-ID <CAE96p_8wdLA+RLn9iiVN2N=z=KBTz3VFQ1AF0sHM_D_UD25USw@mail.gmail.com>
Leonardo,

Como voc=EA j=E1 possui o sendmail configurado =E9 so proceder da seguinte =
forma:

Instale o mailx caso ele n=E3o esteja instalado ainda.

Adicione as seguintes entradas no commands.cfg:

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

define command {
command_name notify-service-by-email
command_line /usr/bin/printf =93%b=94 =93***** 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=94 | /usr/bin/mailx=
 -s
=93** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is
$SERVICESTATE$ **=94 $CONTACTEMAIL$
register 1

Agora no Contacts.cfg vc deve ter a entrada dos comandos de notifica=E7=E3o
conforme exemplo abaixo:

define contact {
contact_name usuario
contactgroups *
host_notifications_enabled 1
service_notifications_enabled 1
host_notification_period 24=D77
service_notification_period 24=D77
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 [email protected]
register 1
}

No arquivo de configura=E7=E3o do servi=E7os services.cfg voce dever=E1 esp=
ecificar
o usu=E1rio tamb=E9m ex:

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

Como voc=EA pode observar acima eu uso um template service-check-inertval-1=
min
que cont=E9 as op=E7=F5es 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=D77
check_freshness 0
freshness_threshold 600
notification_interval 60
notification_period 24=D77
notification_options w,c
notifications_enabled 1
contact_groups admins
register 0

Depois de salvas as configura=E7=F5es =E9 s=F3 dar um reload.

S=F3 cuidado na hora de configurar o tempo e o tipo de notifica=E7=E3o para=
 que
ela n=E3o vire um spam.

abs.

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


Em 31 de julho de 2011 12:07, Jose Oliveira <[email protected]> escreveu:

> Leonardo
>
> O Nagios s=F3 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=E7=F5es de smart host s=E3o relativamente f=E1ceis de fazer no =
sendmail.
> Postfix eu n=E3o conhe=E7o mas dizem que =E9 mais f=E1cil ainda...
>
> Somente depois disto, volte ao Nagios...
>
> []s
>
>
> Em 30 de julho de 2011 13:13, Leonardo Lima
> <[email protected]>escreveu:
>
> > Bom dia Pessoal,
> >
> > Sou novo no Nagios .
> >
> >
> > Como fa=E7o para configurar o envio de e-mail pelo nagios. utilizo nagi=
os +
> > centreon. tenho instalado o postfix e o sendmail....
> >
> > N=E3o estou conseguindo fazer a configura=E7=E3o certa. Tenho um servid=
or
> > exchange gostaria de utilizar o mesmo para entregar as mensagens como
> > procedo com essa configura=E7=E3o ?
> >
> >
> > obrigado desde j=E1 pela aten=E7=E3od 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
> > --
> > [email protected] mailing list
> > https://lists.sourceforge.net/lists/listinfo/nagios-users-br
> > Wiki: http://nagios-br.sf.net/wiki
> >
>
>
>
> --
> Abra=E7os
>
> Jos=E9 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
> --
> [email protected] 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
-- =

[email protected] mailing list
https://lists.sourceforge.net/lists/listinfo/nagios-users-br
Wiki: http://nagios-br.sf.net/wiki