LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-06-2010, 03:15 PM   #1
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Rep: Reputation: 30
nagios alerts help


Hi,
I have trying to get my nagios alerts sorted out but i keep get blank anyway here is what i want to do.
config

define command{
command_name notify-service-by-mail
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: $HOSTNOTES$\n\n$SERVICEOUTPUT$\n\nURL: $HOSTNOTESURL$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
the part highlighted in red i need it to show when an email is send out but it doesnt.
here is the resource.cfg

$HOSTNOTESURL:notes_url$
$HOSTNOTES:notes$

and the serviceextinfo.cfg

define serviceextinfo {
host_name slave1
service_description Mysql - Is IO Replication Running
notes This is a slave to cluster1/2 master
notes_url http://wiki.com
}
and the
office.cfg
define service{
use generic-service
host_name slave1
service_description Mysql - Is IO Replication Running
check_command check_nrpe!check_mysql_repl_io
}

and the email look like this
***** Nagios *****

Notification Type: PROBLEM

Service: Mysql - Replication Delay Slave behind Master
Host: slave8
Address: 192.168.1.8
State: CRITICAL

Date/Time: Wed Oct 6 15:44:47 BST 2010

Additional Info:

CRITICAL: Could not connect to MySQL

URL:

Can someone please explain how i can get this to work, i have been on google for ages with no luck.
thanks
 
Old 10-07-2010, 09:10 AM   #2
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 111Reputation: 111
did you add entry of serviceextinfo file in nagios.cfg.

Code:
cfg_file=/usr/local/nagios/etc/object/serviceextinfo.cfg
Regards,
 
Old 10-07-2010, 10:02 AM   #3
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
You are mixing HOST up with SERVICE. Moreover, there's no need to define the macro in the resource.cfg (besides, you define wrongly too)

What Nagios version are you running? If Nagios 3, you can add the notes, notes_url directive directly in the host or service definition. In this case, you must add to MySQL service definition and change macro in notify-servie-by-mail to $SERVICENOTES$ and $SERVICENOTESURL$.
 
Old 10-08-2010, 02:07 AM   #4
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Original Poster
Rep: Reputation: 30
@quanta I have done what you said still no difference and yes I am using nagios 3, I added notes and notes url to the service mysql and changed the email notify to $SERVICENOTES and $SERVICEURLHOST. But it still didn't work
And yes I put the definition in my nagios.cfg
 
Old 10-08-2010, 02:29 AM   #5
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
The URL still empty?

Did you check the config file: nagios -v /path/to/nagios.cfg
Did you check the nagios.log?

Below is my config:
Code:
define service{
    use                        generic-service
    hostgroup_name            yy
    service_description        NTP_Time
    check_command            check_nrpe!check_ntp_time
    notifications_enabled    1    
    notes_url                http://xx/nagios/cgi-bin/extinfo.cgi?type=2&host=$HOSTNAME$&service=$SERVICEDESC$
}
Code:
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: $SERVICEOUTPUT$\n\nURL: $SERVICENOTESURL$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ 
    }
and the email look like:
Quote:
***** Nagios *****

Notification Type: RECOVERY

Service: NTP_Time
Host: localhost
Address: 127.0.0.1
State: OK

Date/Time: Fri Oct 8 10:40:32 ICT 2010

Additional Info: NTP OK: Offset -0.3954037428 secs

URL: http://xx/nagios/cgi-bin/extinfo.cgi...rvice=NTP_Time
 
1 members found this post helpful.
Old 10-08-2010, 03:37 AM   #6
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Original Poster
Rep: Reputation: 30
@quanta you are the man thanks alot its working i was adding the notes and notes_url to the servicegroup and that was the problem.
 
Old 10-08-2010, 05:26 AM   #7
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
@mahmoud: you're welcome!

Moreover, if you want to insert the URL in multiple services, you can put the notes_url directive into a service template (/usr/local/nagios/etc/objects/templates.cfg). You can do the same with host template.
 
Old 01-07-2014, 07:19 AM   #8
emrahgultekin
LQ Newbie
 
Registered: Jan 2014
Posts: 6

Rep: Reputation: Disabled
About Nagios

Hello Quanta
I can't get some lines in notification mail
Service , status and Additional Info is EMPTY
How can i fix this?
Please help me


Here is mey codes

#HOST DEFINITION
define host{
use generic-host
host_name cerkezmusellim
alias cerkezmusellim
address 88.247.137.245
max_check_attempts 3
notification_interval 10
notification_period 24x7
notification_options d,r,u
contact_groups Fap-admins
}



# SERVICE DEFINITIONS
define service{
use generic-service
host_name cerkezmusellim
service_description HTTP_80
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 10
retry_check_interval 1
contact_groups Win-admins
notification_options u,c,r
notification_interval 30
notification_period 24x7
check_command check_tcp!80!10!20
}




Quote:
Originally Posted by quanta View Post
@mahmoud: you're welcome!

Moreover, if you want to insert the URL in multiple services, you can put the notes_url directive into a service template (/usr/local/nagios/etc/objects/templates.cfg). You can do the same with host template.
 
Old 01-07-2014, 08:41 AM   #9
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,211

Rep: Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474
Quote:
Originally Posted by emrahgultekin View Post
Hello Quanta
I can't get some lines in notification mail Service , status and Additional Info is EMPTY How can i fix this?
Please help me
The first step to fixing this would be to read the LQ Rules. You have not only re-opened a thread that's been closed for 4 years, but have hijacked it with your own question. Both of which are not good things.

Also, if you actually READ the answers in this thread, you'll find the solution.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios alerts are not working shashij Linux - Software 2 03-15-2010 07:35 AM
Nagios Notifications - Only Flapping Alerts Being Sent Out! kevin82287 Linux - Software 1 10-20-2009 01:05 PM
Nagios mail Alerts hoshie66 Linux - Server 2 09-17-2009 08:25 AM
Nagios Server Alerts deibertine Linux - Newbie 2 04-03-2009 07:00 PM
Nagios Alerts on Linux sachinh Linux - Newbie 1 11-05-2008 03:32 PM


All times are GMT -5. The time now is 10:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration