HI, I’d like to understand what the edifferents beetwen these definition are. :?
Admin email is obvous , I use the e-mail every day and it is clear, but I don’t understant what te admin _pager is because I reed an e-mail address in definition field.
Well what are the advantages to choose one or others? :?
Thank’s
you can define different formats depending to what kind of device you are sending the notification.
Pagers never really made it in Italy (servizio teledrin) but you could use it for an SMS notification where you don’t want all the info you probably inserted into the standard email.
Ciao, Luca
Thank’s;
Do you know where can I find some information to configure sms service? I try to set notification by e-mail but it seems doesn’t work.
well, I try to explain hoe I configure my “nagios_configuation.cfg”. I think to forget something but, I have some difficult to find my error.
First of all I whant to clearify how my network layout is.
I install nagios on a host where CENTOS run, it is a server machine for development.
From this I’d like to monitor few host, and on one of these there is mail server installed.
My problem is how to send e-mail notification of nagios from nagios host to e-mail administrator.
I read every official documentation a lot, but I think to forget some row of declaration somewhere.
In /root_nagios/etc I edit a lot of files but where I can find som einformation about notification mode are belove:
1)contactgroups.cfg:
My file is very simple; I what to send everything to same administrator:
[size=100]define contactgroup{
contactgroup_name Nag_Admin
alias amministratore_nagios
members nagiossupervisor
}
[/size]
so I define “nagiossupervisor” in contact.cfg
- contact.cfg
[size=100]define contact{
contact_name nagiossupervisor
alias nagiossupervisor
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email valid_address_mail@valid_domain
}
[/size]
In this case I want receive every kind of notification
So I edit hosts.cfg, services.cfg and hostgroups.cfg to define who send notification to and what kind of notification send.
This belove is a piece of file:
3)hosts.cfg
**[size=100]
Generic host definition template
define host{
name generic-host ; The name of this host template - referenced in other host definitions, used for template recursion/res
;olution
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information acro ss program restarts
check_command check-ping
max_check_attempts 8
process_perf_data 0
retain_nonstatus_information 1
notification_interval 240
notification_period 24x7
notification_options d,u,r
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
#server sviluppo
define host{
use generic-host
host_name SV_Sviluppo
alias server sviluppo
parents IBNET
address XXX.XXX.XXX.XXX
}
[/size]
==>hostgroup.cfg
**
define hostgroup{
hostgroup_name interni
alias server interni
contact_groups Nag_Admin
members SV_Sviluppo,SV_Golia,SV_DNS,SV_Stargate,SV_Cosmos,SV_Galaxy,SV_Neutrino,SV_Quasar
}
and on nagios.cfg I enable notification option:
[size=100]
…
enable_notifications=1
…
[/size]
Finally when I see the nagios web interface I select, from menu on the left, Notification menu and I can see every mail sended for every problems selected for, but I never receive any e-mail
I edit misccommands.cfg too.
this is declaration of mail notification:
**
‘notify-by-email’ command definition
define command{
command_name notify-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$" | /bin/mail -s " $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}
‘notify-by-epager’ command definition
define command{
command_name notify-by-epager
command_line /usr/bin/printf “%b” “Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$” | /bin/mail -s “$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$” $CONTACTPAGER$
}
‘host-notify-by-email’ command definition
define command{
command_name host-notify-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” | /bin/mail -s “Host $HOSTSTATE$ alert for $HOSTNAME$!” $CONTACTEMAIL$
}
‘host-notify-by-epager’ command definition
define command{
command_name host-notify-by-epager command_line /usr/bin/printf “%b” “Host ‘$HOSTALIAS$’ is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$” | /bin/mail -s “$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$” $CONTACTPAGER$
**
Edited Wed Apr 27 2005, 06:20AM ]
if you give the commands in the command line do they work?
use a command like:
/usr/bin/printf “test” “test message” | /bin/mail -s “testagain” [email protected]
For SMS services we use an SMS gateway which receives emails in a format like [email protected]
Ciao, Luca
Also, try disabling notifications for the service, by using the web interface, and then enable it again. Now fail the service and it should work.
[quote=“luca”]if you give the commands in the command line do they work?
use a command like:
/usr/bin/printf “test” “test message” | /bin/mail -s “testagain” [email protected]
[/quote]
I try this , but I don’t receive any e-mail.
I try to capture mail log when I send a message and this is what I see
…
Apr 28 17:07:23 sviluppo sendmail[631]: j3SF7Ngh000631: [email protected], ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30045, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Well I read connection refused, but in this case I don’t know how to bypass this wall
I try to followed this suggest, but nothing change. I think because above.
Yup, that would do it. Have you configured sendmail or something? It normally works, right out of the box.
Perhaps try using “mail” as a normal user, like nagios, instead of as root.
the mail server is trying to relay to itself… is the DNS service working? If not add to /etc/hosts the server name of the Mail server and change the email address you send the message to [email protected]
(you possibily need to configure your mail server to accept emails for this different address)
Ciao, Luca
It’s the /etc/resolv.conf file that contains the nameserver entry for your DNS.
What does your file contain? Can you resolve something like google.com on your nagios machine?