Incorrect Nagios "Host UP" alerts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
anandkrishn33
Posts: 2
Joined: Wed Oct 12, 2016 10:13 pm

Incorrect Nagios "Host UP" alerts

Post by anandkrishn33 »

Hi All,

good day!

Im new to this forum.I have a question/issue which has been troubling lately.Nagiso is sending incorrect HOST UP alerts but the hosts are never DOWN.I have configured my nagios as below.Please help.


contacts.cfg -

Code: Select all

       define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        service_notification_options    w,u,c,r,f,s
        host_notification_options       d,u,r,f,s
commands.cfg:

Code: Select all

define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios  *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOS
TADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /product/sendEmail-v1.56/sendEmail -f nagios@****** -s ******:25 -
u "***** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ *****" -t $CONTACTEMAIL$
}

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$\nAddres
s: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /product/sendEmail-v1.56/sendEmail -f nagios@****** -s ******:25 -u "***** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ *****" -t $CONTACTEMAIL$
}

Code: Select all

# 'check_ping' command definition
define command{
        command_name    check_ping
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 300000.0,100% -c 300000.0,100%
        }
hosts.cfg:

Code: Select all

define host{
use                             linux-server
host_name                       HOST1
alias                           HOST1
address                         ******
check_period                    24x7
check_interval                  5
retry_interval                  1
max_check_attempts              10
check_command                   check_ping
notification_period             24x7
notification_interval           30
contact_groups                  admins
}
Last edited by dwhitfield on Thu Oct 13, 2016 10:11 am, edited 1 time in total.
Reason: code blocks FTW
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Incorrect Nagios "Host UP" alerts

Post by dwhitfield »

What version of Nagios Core are you using? Did you install it from repos or did you compile? On what OS (and version) is Nagios running? What is the OS (and version) of the machine you are monitoring? Thanks!
User avatar
nozlaf
Posts: 172
Joined: Sun Nov 09, 2014 9:50 pm
Location: Victoria, Australia

Re: Incorrect Nagios "Host UP" alerts

Post by nozlaf »

if you have check_host_freshness set to 1 and you are doing a lot of checks or have a performance issue with your nagios server, nagios may think the host is down because the check has not been executed fast enough
so check the value of

Code: Select all

 check_host_freshness 
if it is set to 1 see if setting it to 0 makes the issue go away, if it does and you need check host freshness because you use passive host checks consider implementing a ramdisk or other performance magic bullet
Looking forward to seeing you all at #NagiosCon2019?
-Dedicated Lover of Nconf,PNP4Nagios and Nagvis
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Incorrect Nagios "Host UP" alerts

Post by dwhitfield »

Thanks @nozlaf!

On the performance front, you should find https://assets.nagios.com/downloads/nag ... uning.html useful in general.

On ramdisk specifically, you should find https://labs.nagios.com/2012/01/30/nagi ... g-disk-io/ useful.

Also, if you could answer the questions from my earlier post, that would be helpful going forward. Thanks!
anandkrishn33
Posts: 2
Joined: Wed Oct 12, 2016 10:13 pm

Re: Incorrect Nagios "Host UP" alerts

Post by anandkrishn33 »

Hi guys thanks for the replies:)

OS -
Linux u1632956000126 2.6.32-431.29.2.el6.x86_64 #1 SMP Sun Jul 27 15:55:46 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

NAGIOS:
Nagios® Core™
Version 4.2.0

check_host_freshness is for passive checks only ? When i tried setting it up , it is nt allowing.Im not using any passive checks , just normal active 5 min checks.

previously I had this :

Code: Select all

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user
        service_notification_commands   notify-service-by-email,notify-host-by-email
        host_notification_commands      notify-host-by-email,notify-service-by-email
        service_notification_options    w,u,c,r,f,s
        host_notification_options       d,u,r,f,s
Now i removed to :

Code: Select all

      define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        service_notification_options    w,u,c,r,f,s
        host_notification_options       d,u,r,f,s

there was double notification for each of host and service checks.
Last edited by dwhitfield on Fri Oct 14, 2016 10:45 am, edited 1 time in total.
Reason: adding code blocks
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Incorrect Nagios "Host UP" alerts

Post by dwhitfield »

Apologize for the battery of questions, but I want to make sure I have all the information I need.

I'm guessing you installed from source, since I'm not aware of packages for 4.2.0. Is that correct?

Passive checks are definitely going to give you better performance, but right now I don't see a ton of reason why performance would be the issue. I want to rule that out. Is the ping check the only check you are running? Is it just the one host you are checking? What's the RAM and CPU situation? Is Nagios running in a VM?

How close are these machines on the network? What is the network performance like? We can do do some testing on this later if we need to.

Lastly, did you take a look at the performance documentation in my last post?
Locked