LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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
 
LinkBack Search this Thread
Old 03-12-2010, 05:25 PM   #1
shashij
LQ Newbie
 
Registered: Mar 2010
Posts: 9

Rep: Reputation: 0
Nagios alerts are not working


Hi,

I have configured Nagios on SLES 10 SP2. I could configure nagios but 2 things are not working correctly.
1. It doesnít show correct disk utilization for /local partition.
2. It doesnít send Alerts.

I have installed NAGIOS (nagios-3.2.0-11.1, nagios-plugins-1.4.14-11.1 and few other which are required to remove dependency) on server and I have installed nagios (nagios-plugins-1.4.14-11.1, nagios-nrpe-client-2.12-11.1 and few other packages to remove dependency) on client.

Configuration files from NAGIOS server:
nagios.cfg (Since this file is big, I have copied the relevant portion only. Let me know if any specific info is required from this file)=>

log_file=/var/log/nagios/nagios.log
cfg_file=/etc/nagios/objects/commands.cfg
cfg_file=/etc/nagios/objects/contacts.cfg
cfg_file=/etc/nagios/objects/contactgroups.cfg
cfg_file=/etc/nagios/objects/timeperiods.cfg
cfg_file=/etc/nagios/objects/templates.cfg
cfg_file=/etc/nagios/objects/hosts.cfg
cfg_file=/etc/nagios/objects/hostgroups.cfg
cfg_file=/etc/nagios/objects/services.cfg
object_cache_file=/var/lib/nagios/objects.cache
precached_object_file=/var/lib/nagios/objects.precache
resource_file=/etc/nagios/resource.cfg
status_file=/var/lib/nagios/status.dat

contactgroups.cfg =>
define contactgroup{
contactgroup_name admins
alias Nagios Admin
members Shashank
}

contacts.cfg =>
define contact{
contact_name Shashank
alias Shashank
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-host-by-email
host_notification_commands notify-service-by-email
email shashank@test.com
}

hosts.cfg (Only one host shown below)=>
define host{
use generic-host
host_name test2.nagiostest.com
alias Cluster-1
address 192.168.1.55
check_command check-host-alive
max_check_attempts 20
notification_interval 240
notification_period 24x7
notification_options d,u,r
contact_groups admins
}

hostgroups.cfg (Only one cluster shown)=>
define hostgroup{
hostgroup_name Cluster-1
alias Cluster-1
members test1.nagiostest.com,test2.nagiostest.com,test3.nagiostest.com,test4.nagiostest.com,test5.nagiostest .com,testcnt1.nagiostest.com
}


services.cfg =>

define service{
use generic-service
hostgroup_name Cluster-1,Cluster-2,Cluster-3,Cluster-4
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 90
notification_period 24x7
notification_options w,u,c,r
check_command check_ping!100.0,20%!500.0,60%
notifications_enabled 1
}
define service{
use local-service
hostgroup_name Cluster-1,Cluster-2,Cluster-3,Cluster-4
service_description Root Partition
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 90
notification_period 24x7
notification_options w,u,c,r
check_command check_local_disk!20%!10%!/
notifications_enabled 1
}
define service{
use local-service hostgroup_name Cluster-1,Cluster-2,Cluster-3,Cluster-4
service_description /local Partition
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 90
notification_period 24x7
notification_options w,u,c,r
check_command check_local_disk!20%!10%!/local
notifications_enabled 1
}

Commands.cfg (As this is big file, only notification part is mentioned here) =>
# 'notify-host-by-email' command definition
define command{
command_name notify-host-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" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# '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$
}


Any idea why alerts are not working and I donít get correct results for /local disk utilization.


Thanks,
Shashank
 
Old 03-14-2010, 01:48 AM   #2
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
Have you tested the command manually to see what result it is getting ?
 
Old 03-15-2010, 07:35 AM   #3
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by shashij View Post
Hi,

I have configured Nagios on SLES 10 SP2. I could configure nagios but 2 things are not working correctly.
1. It doesnít show correct disk utilization for /local partition.
2. It doesnít send Alerts.

I have installed NAGIOS (nagios-3.2.0-11.1, nagios-plugins-1.4.14-11.1 and few other which are required to remove dependency) on server and I have installed nagios (nagios-plugins-1.4.14-11.1, nagios-nrpe-client-2.12-11.1 and few other packages to remove dependency) on client.

Configuration files from NAGIOS server:
nagios.cfg (Since this file is big, I have copied the relevant portion only. Let me know if any specific info is required from this file)=>

log_file=/var/log/nagios/nagios.log
cfg_file=/etc/nagios/objects/commands.cfg
cfg_file=/etc/nagios/objects/contacts.cfg
cfg_file=/etc/nagios/objects/contactgroups.cfg
cfg_file=/etc/nagios/objects/timeperiods.cfg
cfg_file=/etc/nagios/objects/templates.cfg
cfg_file=/etc/nagios/objects/hosts.cfg
cfg_file=/etc/nagios/objects/hostgroups.cfg
cfg_file=/etc/nagios/objects/services.cfg
object_cache_file=/var/lib/nagios/objects.cache
precached_object_file=/var/lib/nagios/objects.precache
resource_file=/etc/nagios/resource.cfg
status_file=/var/lib/nagios/status.dat

contactgroups.cfg =>
define contactgroup{
contactgroup_name admins
alias Nagios Admin
members Shashank
}

contacts.cfg =>
define contact{
contact_name Shashank
alias Shashank
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-host-by-email
host_notification_commands notify-service-by-email
email shashank@test.com
}

hosts.cfg (Only one host shown below)=>
define host{
use generic-host
host_name test2.nagiostest.com
alias Cluster-1
address 192.168.1.55
check_command check-host-alive
max_check_attempts 20
notification_interval 240
notification_period 24x7
notification_options d,u,r
contact_groups admins
}

hostgroups.cfg (Only one cluster shown)=>
define hostgroup{
hostgroup_name Cluster-1
alias Cluster-1
members test1.nagiostest.com,test2.nagiostest.com,test3.nagiostest.com,test4.nagiostest.com,test5.nagiostest .com,testcnt1.nagiostest.com
}


services.cfg =>

define service{
use generic-service
hostgroup_name Cluster-1,Cluster-2,Cluster-3,Cluster-4
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 90
notification_period 24x7
notification_options w,u,c,r
check_command check_ping!100.0,20%!500.0,60%
notifications_enabled 1
}
define service{
use local-service
hostgroup_name Cluster-1,Cluster-2,Cluster-3,Cluster-4
service_description Root Partition
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 90
notification_period 24x7
notification_options w,u,c,r
check_command check_local_disk!20%!10%!/
notifications_enabled 1
}
define service{
use local-service hostgroup_name Cluster-1,Cluster-2,Cluster-3,Cluster-4
service_description /local Partition
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_interval 90
notification_period 24x7
notification_options w,u,c,r
check_command check_local_disk!20%!10%!/local
notifications_enabled 1
}

Commands.cfg (As this is big file, only notification part is mentioned here) =>
# 'notify-host-by-email' command definition
define command{
command_name notify-host-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" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# '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$
}


Any idea why alerts are not working and I donít get correct results for /local disk utilization.


Thanks,
Shashank
as datopdog says, you have to try the command manually - as the nagios user, and tail -f the nagios log at the same time.
also check mail logs etc etc and try sending a test email as the nagios user to where the alerts would normally go...
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Nagios not sending alerts through email lemay_jeff Linux - Networking 2 04-11-2005 10:28 AM


All times are GMT -5. The time now is 03:40 PM.

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