How can enable notify via send email
How can enable notify via send email
Dear all
Hi
I have installed nagios on redhat 6.4 now i have a question i want enable notification alarms via email if a warning or critical appear in nagios it send email to me i have read many documents but clearly in any of them not which service do i have to on my os and where in nagios and os set email config
I want use local email not gmail or yahoo or ....
Warm regards
Babak
Hi
I have installed nagios on redhat 6.4 now i have a question i want enable notification alarms via email if a warning or critical appear in nagios it send email to me i have read many documents but clearly in any of them not which service do i have to on my os and where in nagios and os set email config
I want use local email not gmail or yahoo or ....
Warm regards
Babak
Re: How can enable notify via send email
Take a look at the documentation available on RHEL's site, https://access.redhat.com/documentation ... tions.html
This provides all of the information necessary to get notifications setup. Let us know if you run into any issues.
This provides all of the information necessary to get notifications setup. Let us know if you run into any issues.
Former Nagios Employee
Re: How can enable notify via send email
thanksrkennedy wrote:Take a look at the documentation available on RHEL's site, https://access.redhat.com/documentation ... tions.html
This provides all of the information necessary to get notifications setup. Let us know if you run into any issues.
but you know better than me for example this path that said in step1 there is not in nagios server (/etc/nagios/gluster/gluster-contacts.cfg) on nagios server we have just one contact.cfg file on this path: /usr/local/nagios/etc/object/ and in this file there is not these configs :
Code: Select all
define contact {
contact_name Contact1
alias ContactNameAlias
email email-address
service_notification_period 24x7
service_notification_options w,u,c,r,f,s
service_notification_commands notify-service-by-email
host_notification_period 24x7
host_notification_options d,u,r,f,s
host_notification_commands notify-host-by-email
}
define contact {
contact_name Contact2
alias ContactNameAlias2
email email-address
service_notification_period 24x7
service_notification_options w,u,c,r,f,s
service_notification_commands notify-service-by-email
host_notification_period 24x7
host_notification_options d,u,r,f,s
host_notification_commands notify-host-by-email
}
Re: How can enable notify via send email
Can you post the file /usr/local/nagios/etc/objects/contacts.cfg for us to look at?
Former Nagios Employee
Re: How can enable notify via send email
i have attached contact.cfg filerkennedy wrote:Can you post the file /usr/local/nagios/etc/objects/contacts.cfg for us to look at?
warm regards
Babak
- Attachments
-
contacts.cfg- (2.09 KiB) Downloaded 458 times
Re: How can enable notify via send email
Use that file for reference, and you can add your own contact in such as -
Then, under your service assign 'baber' as a contact -
Code: Select all
define contact{
contact_name baber ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Baber ; Full name of user
email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
Code: Select all
define service {
host_name google.com
service_description HTTP
check_period xi_timeperiod_24x7
check_command check_http
contacts baber
Former Nagios Employee
Re: How can enable notify via send email
thanksrkennedy wrote:Use that file for reference, and you can add your own contact in such as -Then, under your service assign 'baber' as a contact -Code: Select all
define contact{ contact_name baber ; Short name of user use generic-contact ; Inherit default values from generic-contact template (defined above) alias Baber ; Full name of user email [email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ****** }Code: Select all
define service { host_name google.com service_description HTTP check_period xi_timeperiod_24x7 check_command check_http contacts baber
but it is not working
i have do these steps :
1- edit contact.cfg file and attached that
2-add contacts nagiosadmin line to template.cfg
Code: Select all
define host{
name linux-server ; The name of this host template
use generic-host ; This template inherits other values from the generic-host template
check_period 24x7 ; By default, Linux hosts are checked round the clock
check_interval 5 ; Actively check the host every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each Linux host 10 times (max)
check_command check-host-alive ; Default command to check Linux hosts
notification_period workhours ; Linux admins hate to be woken up, so we only notify during the day
; Note that the notification_period variable is being overridden from
; the value that is inherited from the generic-host template!
notification_interval 120 ; Resend notifications every 2 hours
notification_options d,u,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
contacts nagiosadmin
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
3- also add this lione
contacts nagiosadmin
to one of my linux host in .cfg file
Code: Select all
define service{
use local-service
host_name redhat6.4
service_description DNS
check_command check_nrpe!check_dns
contacts nagiosadmin
}
line to template.cfg attached template.cfg file
5 -in /etc/nagios/objects/commands.cfg file add $NOTIFICATIONCOMMENT$\n after $SERVICEOUTPUT$\n option in notify-service-by-email
Code: Select all
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 $NOTIFICATIONCOMMENT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
warm regards
- Attachments
-
templates.cfg- (12.96 KiB) Downloaded 457 times
-
contacts.cfg- (2.28 KiB) Downloaded 525 times
Re: How can enable notify via send email
Your templateuse local-service does not have any notification_options assigned to it, you will need these in order to have them triggered.
Former Nagios Employee
Re: How can enable notify via send email
not workingrkennedy wrote:Your templateuse local-service does not have any notification_options assigned to it, you will need these in order to have them triggered.
i have attached all 4 config files
what is my problem ?
- Attachments
-
- config files.zip
- (5.84 KiB) Downloaded 294 times
Re: How can enable notify via send email
Please attach the file /usr/local/nagios/var/objects.cache for us to look at, and let us know which host / service AND contact you're not receiving notifications for.
Former Nagios Employee