Page 1 of 1

Missing Information from Nagios Core Alerts

Posted: Thu Aug 06, 2015 11:00 am
by neworderfac33
It's me again.

A lot of my alerts currently look like the following:
-------------------------------------------------------
Notification Type: PROBLEM

Service: Application - Notepad
Host:
Address: 10.15.18.115
State: WARNING

Date/Time: Thu Aug 6 16:53:55 BST 2015

Additional Info:

No data was received from host!
-------------------------------------------------------
As you can see, there's nothing showing for the Host ID, even though I have a host_name entry containing my server name in both the define host{} sections of my windows.cfg.

define host{
use windows-server
host_name FICTITIOUSHOSTNAME
alias FICTITIOUSALIAS
address 99.99.99.99
hostgroups windows-servers
}


Any thoughts, anybody?

Re: Missing Information from Nagios Core Alerts

Posted: Thu Aug 06, 2015 12:23 pm
by tgriep
Can you post the notify-service-by-email command settings so we can review them?
It can be found in the commands.cfg file.

Can you post how the service check is defined for your example alert?

Re: Missing Information from Nagios Core Alerts

Posted: Fri Aug 07, 2015 4:23 am
by neworderfac33

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" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Here's the windows-server part of templates.cfg

Code: Select all

define host{
        name                    windows-server  ; The name of this host template
        use                     generic-host    ; Inherit default values from the generic-host template
        check_period            24x7            ; By default, Windows servers are monitored round the clock
        check_interval          5               ; Actively check the server every 5 minutes
        retry_interval          1               ; Schedule host check retries at 1 minute intervals
        max_check_attempts      10              ; Check each server 10 times (max)
        check_command           check-host-alive        ; Default command to check if servers are "alive"
        notification_period     24x7            ; Send notification out at any time - day or night
        notification_interval   30              ; Resend notifications every 30 minutes
        notification_options    d,r             ; Only send notifications for specific host states
        contact_groups          admins          ; Notifications get sent to the admins by default
        hostgroups              windows-servers ; Host groups that Windows servers should be a member of
        register                0               ; DONT REGISTER THIS - ITS JUST A TEMPLATE
        }

Here're the hosts and service definition from windows.cfg

Code: Select all

define host{
        use                  windows-server
        host_name       FIRSTSERVER
        alias                FIRSTSERVER
        address            88.88.88.88
        hostgroups       windows-servers
        }

define host{
        use                  windows-server
        host_name       SECONDSERVER
        alias                SECONDSERVER
        address            99.99.99.99
        hostgroups       windows-servers
        }


define hostgroup{
    hostgroup_name  windows-servers
    alias           Windows Servers
}


define service{
       use                      generic-service
      #host_name                FIRSTSERVER, SECONDSERVER
       hostgroup_name           windows-servers
       service_description      Drive Space - C
       check_command            check_nt!USEDDISKSPACE!-l c -w 5 -c 10
       }


Re: Missing Information from Nagios Core Alerts

Posted: Fri Aug 07, 2015 10:40 am
by jolson
Host: $HOSTALIAS$
Try changing the above to:

Code: Select all

Host: $HOSTNAME$
Does that make a difference regarding the results you receive?

Re: Missing Information from Nagios Core Alerts

Posted: Mon Aug 10, 2015 9:34 am
by neworderfac33
No, I'm afraid it didn't - the hostname is still missing from the alerts.

However, the diskspace alerts that I'm receiving from my two test servers are slightly different:

The first one shows the entry "alias" against Host and the subject of the message is ** PROBLEM Service Alert: alias/Drive Space - C is CRITICAL **

***** Nagios *****
Notification Type: PROBLEM
Service: Drive Space - C
Host: alias
Address: 88.88.88.88
State: CRITICAL
Date/Time: Mon Aug 10 14:33:18 BST 2015
Additional Info:
c:\ - total: 39.90 Gb - used: 24.99 Gb (63%) - free 14.91 Gb (37%)

The second one one shows nothing against Host and the subject of the message is ** PROBLEM Service Alert: /Drive Space - C is CRITICAL ** (without the "alias")

***** Nagios *****
Notification Type: PROBLEM
Service: Drive Space - C
Host:
Address: 99.99.99.99
State: CRITICAL
Date/Time: Mon Aug 10 15:01:43 BST 2015
Additional Info:
c:\ - total: 39.90 Gb - used: 28.61 Gb (72%) - free 11.29 Gb (28%)

It seems that the two servers are configured differently, but neither of them is sending out the correct alerts!

Cheers

Pete

Re: Missing Information from Nagios Core Alerts

Posted: Mon Aug 10, 2015 2:01 pm
by jdalrymple
Are there any special characters in the hostnames in question? Do any hosts work properly?

Re: Missing Information from Nagios Core Alerts

Posted: Tue Aug 11, 2015 3:44 am
by neworderfac33
Good afternoon!

Problem now appears to be solved - i just retyped the define hosts sections of windows.cfg

Maybe I copied in some rogue character, but both hosts are now returning the correct alias and IP address.

Thank you for taking the time to look at my post - much appreciated.

Pete

Re: Missing Information from Nagios Core Alerts

Posted: Tue Aug 11, 2015 9:23 am
by hsmith
Thank you for the follow up. Is it all right if I lock this thread?