I get emails but I can't fill them with any information from the specific alarms

Jorge Gil georgyboy at gmail.com
Tue Dec 29 16:25:47 CET 2009


Hi again!

Thank you for the quick answer, to begin with...


enable_environment_macros was already 1...

I have tried $SERVICESTATE$ ($hoststate$ for the host notification), and i
got "WARNING" in the email body... you cant believe how happy that has made
me!


I copy one service definition


define host{

use generic-switch

host_name N7-Rack2

alias Backbone N7

icon_image multilayer_switch.gif

statusmap_image multilayer_switch.gd2

address 192.168.4.8

parents ns500.bne.es

}

define service{

use generic-service
host_name nagios, BNS31, BNS32, BNS49, BNS50, E1-MUSEO, E1-MUSICA_1,
E1-MUSICA_2, E1-PROCESO_1, E1-PROCESO_2, E1-PROCESO_3, E1-PUBLICACIONES,
E1-Ref_Biblio1, E1-Ref_Biblio2, E1-BELLAS_ARTES, E1-GERENCIA_1,
E1-GERENCIA_2, E1-JARDIN_NORTE, E1-JARDIN_SUR, E1-JORGE_JUAN,
E1-LABORATORIO, E1-MANUSCRITOS, E1-Salon italiano, E1-SALON_LECTURA, E1-UCI,
N7-Rack2, N7-Rack3, ns500.bne.es, Salida LAN1 privado, Salida LAN2 publico,
router alcobendas principal, Rediris, Router interministerial en BNE, Router
interministerial en Cultura, Balanceador minos.bne.es, Bluecoat 1, Bluecoat
2, SW1 Fujitsu, SW2 Fujitsu, SW3 Fujitsu, SW4 Fujitsu


(and a few lines below...)

service_description PING

check_command check_ping!200.0,20%!600.0,60%

normal_check_interval 5

retry_check_interval 1

}

and what i see in the nagios webserver:
  Command Name Command Line check-host-alive $USER1$/check_ping -H
$HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5 check_dhcp $USER1$/check_dhcp
$ARG1$ check_ftp $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$ check_hpjd
$USER1$/check_hpjd
-H $HOSTADDRESS$ $ARG1$ check_http $USER1$/check_http -I $HOSTADDRESS$
$ARG1$ check_imap $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
check_local_disk $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
check_local_load $USER1$/check_load -w $ARG1$ -c $ARG2$
check_local_mrtgtraf $USER1$/check_mrtgtraf
-F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$ check_local_procs
$USER1$/check_procs
-w $ARG1$ -c $ARG2$ -s $ARG3$ check_local_swap $USER1$/check_swap -w $ARG1$
-c $ARG2$ check_local_users $USER1$/check_users -w $ARG1$ -c $ARG2$
check_nt $USER1$/check_nt
-H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$ check_ping $USER1$/check_ping -H
$HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5 check_pop $USER1$/check_pop -H
$HOSTADDRESS$ $ARG1$ check_smtp $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
check_snmp $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$ check_ssh
$USER1$/check_ssh
$ARG1$ $HOSTADDRESS$ check_tcp $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
$ARG2$ check_udp $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
notify-host-by-email printf $hoststate$|mail -s Testhostminusculas2
georgyboy at gmail.com notify-service-by-email echo $SERVICESTATE$|mail -s
Testservicesincomillas georgyboy at gmail.com process-host-perfdata
/usr/bin/printf
"%b"
"$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n"
>> /usr/local/nagios/var/host-perfdata.out process-service-perfdata /usr/bin/printf
"%b"
"$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n"
>> /usr/local/nagios/var/service-perfdata.out

any idea how to get all those dollar values apart of that, please?

thanks so much!
jorge

On 12/29/09, Martin Melin <mmelin at gmail.com> wrote:
>
> If your nagios.cfg sets enable_environment_macros to 0, that would be
> the problem.
>
> Otherwise, possibly HOSTADDRESS does not have a value for this
> service. Have you tried sending just $SERVICESTATE$ instead? (a
> service notification will always have a value for the macro)
>
> Regards
> Martin Melin
>
> On Tue, Dec 29, 2009 at 4:01 PM, Jorge Gil <georgyboy at gmail.com> wrote:
> > Hi all:
> >
> > First of all, thank you very much for your support to other users, I have
> > gone thru hundreds of your emails, but still I couldnt find the solution
> to
> > my case...
> >
> > I have set up email notifications in nagios, and I do get emails, but I
> cant
> > make Nagios send me any information like $hostname$ in the body of the
> > email. When I tried the typical configuration for nagios, like:
> >
> >
> > # 'notify-service-by-email' command definition
> >
> > 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$" | /usr/bin/mail -s
> > "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is
> > $SERVICESTATE$ **" $CONTACTEMAIL$
> >
> > }
> >
> >
> >
> > i wasnt getting emails.
> >
> > Now a simplified version of the command:
> >
> >
> >
> > # 'notify-service-by-email' command definition
> >
> > define command{
> >
> > command_name notify-service-by-email
> >
> > command_line printf "%b" "$HOSTADDRESS$" | /usr/bin/mail -s
> Subject_of_email
> > my_email_address
> >
> > }
> >
> > does send me emails, but it doesnt translate the hostaddress, i get just
> a
> > dollar sign in the body of the email.
> >
> > I have tried to put hostaddress in small letters, with and without
> quotation
> > marks, redone all the possible files that call the alert... and I am
> lost.
> >
> > What can be wrong, please? How can I make Nagios translate those
> variables
> > into the actual information they contain? (for the service checks, they
> > actually work, I see the state change in the Nagios webserver,
> individually
> > for all the hosts that I set up)
> >
> > Thanks a lot,
> >
> > Jorge
> >
> >
> ------------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Verizon Developer Community
> > Take advantage of Verizon's best-in-class app development support
> > A streamlined, 14 day to market process makes app distribution fast and
> easy
> > Join now and get one step closer to millions of Verizon customers
> > http://p.sf.net/sfu/verizon-dev2dev
> > _______________________________________________
> > Nagios-users mailing list
> > Nagios-users at 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
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20091229/14b7601c/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at 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


More information about the Users mailing list