Not Getting Windows Server Reboot Notifications

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.
bryceee
Posts: 33
Joined: Mon Aug 11, 2014 8:27 pm
Location: Perth, Australia

Not Getting Windows Server Reboot Notifications

Post by bryceee »

Hi Guys,

I have copied over my existing configuration for a Nagios 2.2 version to a Nagios 4.0.7 and have been running it for a few months now.
I am not getting an email notification for when a host(server) is rebooted. I used to in the old server.
I am stumped with this one.
Any ideas?
I am using the generic-host template for all my hosts.

Please find a copy of the config.
I appreciate the help with this.

Bryce

generic-host config

Code: Select all


# Generic host definition template - This is NOT a real host, just a template!

define host{
        name                            generic-host    ; The name of this host template
        notifications_enabled           1               ; Host notifications are enabled
        event_handler_enabled           1               ; Host event handler is enabled
        flap_detection_enabled          1               ; Flap detection is enabled
        process_perf_data               1               ; Process performance data
        retain_status_information       1               ; Retain status information across program restarts
        retain_nonstatus_information    1               ; Retain non-status information across program restarts
        notification_period             24x7            ; Send host notifications at any time
                check_command           check-host-alive
                max_check_attempts      3
                check_interval          1
                notification_interval   30
                notification_options    d,u,r
                contact_groups          admins
        register                        0               ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
        }

host config

Code: Select all

define host {
        use                             generic-host
        host_name                       PERAV01
        alias                           Perth Trend AV Server 1
        address                         10.1.1.4
        }

define service {
        host_name                       PERAV01
        service_description             Check Drive C:
        check_command                   nt_check_disk_c
        use                             generic-service
        }

define service {
        host_name                       PERAV01
        service_description             Standard Win2k8 Services Check
        check_command                   nt_check_win2k8_std
        use                             generic-service
        }

define service {
        host_name                       PERAV01
        service_description             Eventlog Check
        check_command                   nt_eventlog_60
        use                             generic-service
        }

Contacts config

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_period     24x7
        host_notification_period        24x7
        service_notification_options    u,r,c
        host_notification_options       d,r,u
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email                           [email protected]    ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }


define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }

Command Config

Code: Select all

# '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/mailx -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$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }


# This command checks to see if a host is "alive" by pinging it
# The check must result in a 100% packet loss or 5 second (5000ms) round trip
# average time to produce a critical error.
# Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)

# 'check-host-alive' command definition
define command{
        command_name    check-host-alive
        command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
        }


User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Not Getting Windows Server Reboot Notifications

Post by Box293 »

In your old configuration, what sort of email notification were you getting?

For the host up/down check (ping)?
For a particular service for this host (like an uptime check)?
For any service for this host?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
bryceee
Posts: 33
Joined: Mon Aug 11, 2014 8:27 pm
Location: Perth, Australia

Re: Not Getting Windows Server Reboot Notifications

Post by bryceee »

Hi,

I think it was for ping.
I was getting the following emails

PEREROOM02 is DOWN!

***** Nagios *****

Notification Type: PROBLEM
Host: PEREROOM02
State: DOWN
Address: 10.1.1.5
Info: CRITICAL - Host Unreachable (10.1.1.5)

Date/Time: Mon Oct 20 14:13:05 WST 2014

I do notice in the old config commands file i see the following

Code: Select all

# On Debian, check-host-alive is being defined from within the
# nagios-plugins package
bryceee
Posts: 33
Joined: Mon Aug 11, 2014 8:27 pm
Location: Perth, Australia

Re: Not Getting Windows Server Reboot Notifications

Post by bryceee »

okay I shutdown a server and forced checks 3 times and did not get a host down, in the console (GUI) I could see that the sever was down.
I have started up the server and did not get a recovery alert either until i forced a check.
Then i got a recovery email followed by a down email, I know the server is up

I had the server down for 10 min.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Not Getting Windows Server Reboot Notifications

Post by Box293 »

At a glance your configs look OK.

I want to have a look at the objects.cache file which tells us the final settings that are being used for objects.

In the Nagios core box, execute the following command. This is for the host you just tested, in the command provided I have used PERAV01

Code: Select all

cat /usr/local/nagios/var/objects.cache | sed -rn "/define host \{/{:a;N;/}/{/.host_name.PERAV01/p;d};ba}"
Post the output of this so we can see what it's settings are.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
bryceee
Posts: 33
Joined: Mon Aug 11, 2014 8:27 pm
Location: Perth, Australia

Re: Not Getting Windows Server Reboot Notifications

Post by bryceee »

I get the following

Code: Select all

root@PERNAGIOS01:~# cat /usr/local/nagios/var/objects.cache | sed -rn "/define host \{/{:a;N;/}/{/.host_name.PERDC01/p;d};ba}"
define host {
        host_name       PERDC01
        alias   Perth Domain Controller 1
        address 10.1.1.5
        check_command   check-host-alive
        contact_groups  admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  1.000000
        retry_interval  1.000000
        max_check_attempts      3
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,d,u
        notifications_enabled   1
        notification_interval   30.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       1
        retain_status_information       1
        retain_nonstatus_information    1
        }

User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Not Getting Windows Server Reboot Notifications

Post by Box293 »

That output looks correct, I cannot see any options there preventing notifications from being sent.

For your nagios core host PERNAGIOS01, what DNS servers does it use (ip addresses)?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
bryceee
Posts: 33
Joined: Mon Aug 11, 2014 8:27 pm
Location: Perth, Australia

Re: Not Getting Windows Server Reboot Notifications

Post by bryceee »

I am not exactly sure how to do this?

is it still cat/etc/resolv.conf
If it is I get the following

Code: Select all

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.41.30.31
search corporate.example.com.au
We have 8 DC's in our environment how would i add them all in?

Wierd I get the alerts for services find and for switches, and the switches use the same generic host.

Is it worth while adding in the contact group to a host to test?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Not Getting Windows Server Reboot Notifications

Post by Box293 »

bryceee wrote:Is it worth while adding in the contact group to a host to test?
Yes that would be a good idea.

I think what puzzled me is:
bryceee wrote:I have started up the server and did not get a recovery alert either until i forced a check.
Then i got a recovery email followed by a down email, I know the server is up
Made me think there was something in your mail system that caused the delay, like the messages had been sent by nagios but were queued up. That's what got me to check your DNS server settings.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
bryceee
Posts: 33
Joined: Mon Aug 11, 2014 8:27 pm
Location: Perth, Australia

Re: Not Getting Windows Server Reboot Notifications

Post by bryceee »

I will get my colleague who is an exchange guru to check for me if there is a delay on Exchange.

Silly questions how do I add a contact group to a host?
And how could I add the remainder DNS servers in?

Thanks for the help
Locked