Windows Service notification issues

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.
LS18
Posts: 7
Joined: Thu Sep 27, 2018 4:56 am

Windows Service notification issues

Post by LS18 »

Hi there,

Firstly let me apologize if this is a simple mistake, I am brand new to using Linux/Nagios! So far I have everything configured and working in regards to monitoring Windows servers with the exception of notifications for SERVICESTATE alerts for things like W3SVC etc.

The issue I am having is that despite using the same generic-service template for my services, anything I attempt to monitor and get alerts from that uses SERVICESTATE doesn't work correctly.

I know the email works as if I send custom service notifications they fire off, as they do automatically for host or process alerts (PROCSTATE for Explorer.exe etc). For services though I seem to get a single soft alert initially then nothing else as per below:
servicesalert.png
servicesalert.png (5.16 KiB) Viewed 2929 times
The attempts register in the web gui as hitting 3/3 but there aren't any notifications sent at this point.

I believe all the config of my definitions and templates are correct:

Code: Select all

define contact {

    name                                   generic-contact
    service_notification_period            24x7 
    host_notification_period               24x7
    service_notification_options           w,u,c,r,f,s
    host_notification_options              d,u,r,f,s 
    service_notification_commands          notify-service-by-email 
    host_notification_commands             notify-host-by-email
    register                               0
}

Code: Select all

define service {

name 			generic-service
active_checks_enabled	1
passive_checks_enabled	1
parallelize_check            1
obsess_over_service          1
check freshness              0
notifications_enabled        1
event_handler_enabled        1
flap_detection_enabled       1
process_perf_data            1
retain_status_information    1
retain nonstatus information 1
notifications_enabled	1
event_handler_enabled	1
flap_detection_enabled	1
process_perf_data	1
retain_status_information	1
retain_nonstatus_information	1
is volatile	0
check_period	24x7
max_check_attempts	3
check interval	10
retry_interval	2
contact_groups	admins
notification_options	w,u,c,r
notification interval	60
notification_period	24x7
register	0
}

Code: Select all

define service {

  use                 generic-service
  host_name           IT01199
  service_description W3SVC
  check command       check_nt!SERVICESTATE!-d SHOWALL -I W3SVC
}

Code: Select all

define command {
command_name 	check_nt 
command_line 	$USER1$/check_nt -H $HOSTADDRESS$ -p 12989 -s passwordhere -v $ARG1$ $ARG2$
}
and as mentioned when these are used elsewhere like on a PROCSTATE/CPULOAD/USEDDISKSPACE it works fine.

Nagios version is 4.4.1 and using NSclient++ 0.5.2.35 for the Windows side.

Any help is appreciated!

Thanks,

LS
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Windows Service notification issues

Post by scottwilkerson »

You have to add a contact to your host/service definition, such as

Code: Select all

define service {

  use                 generic-service
  host_name           IT01199
  service_description W3SVC
  check command       check_nt!SERVICESTATE!-d SHOWALL -I W3SVC
  contacts                 nagiosadmin
}
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
LS18
Posts: 7
Joined: Thu Sep 27, 2018 4:56 am

Re: Windows Service notification issues

Post by LS18 »

Hi Scott,

Thank you for your reply.

I have added the contact field into the service definition but it still doesn't seem to be firing notifications. Is there anything else I could be missing?

I'm a bit confused as to how only SERVICESTATE check_nt commands seem to be the ones effected by this behavior!

Cheers,

LS
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Windows Service notification issues

Post by scottwilkerson »

LS18 wrote:I have added the contact field into the service definition but it still doesn't seem to be firing notifications. Is there anything else I could be missing?
They would not fire until a service returns to a OK state and then goes down while you have contacts added
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
LS18
Posts: 7
Joined: Thu Sep 27, 2018 4:56 am

Re: Windows Service notification issues

Post by LS18 »

Hi Scott,

I've replicated this behavior and the notifications still wont fire even after the services have been returned to an OK state and then downed again.

I've been checking in the objects.cache as well just be be certain that the updates to the definitions are applying etc. but still no luck.

Any other ideas where I may have gone wrong potentially?

Thanks,

Luke
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Windows Service notification issues

Post by scottwilkerson »

Can you share the contact configuration for the contact that is assigned to the service?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
LS18
Posts: 7
Joined: Thu Sep 27, 2018 4:56 am

Re: Windows Service notification issues

Post by LS18 »

Hi Scott,

Of course, please see below:

Code: Select all

define contact {

  contact_name   nagiosadmin
  use            generic-contact
  alias          Nagios Admin
  email          [email protected]
}

Code: Select all

define contactgroup {

  contactgroup_name admins
  alias             Nagios Administrators
  members           nagiosadmin
}

Code: Select all

define contact {

    name                             generic-contact
    service_notification_period      24x7 
    host_notification_period         240 
    service_notification_options     w,u,c,r,f,s
    bost_notification_options        d,u,r,f,s 
    service_notification_commands    notify-service-by-email 
    host_notification_commands       notify-host-by-email
    register                         0
}
Thanks,

LS
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Windows Service notification issues

Post by scottwilkerson »

This all looks correct as long as you have a timeperiod defined as 240

Code: Select all

host_notification_period         240
Do the logs show the notifications for the services sending now that you added the contact to the services?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
LS18
Posts: 7
Joined: Thu Sep 27, 2018 4:56 am

Re: Windows Service notification issues

Post by LS18 »

Sorry not sure why that one is listed as 240, both are listed as:

Code: Select all

service_notification_period      24x7 
host_notification_period         24x7 
In the actual template.cfg. I still don't get any notifications sent out though with or without the contacts specifically added to the service as you suggest (I've got one setup using this and another without just to test). All I see in the logs is a single alert:
alert.png
alert.png (1.4 KiB) Viewed 2879 times
but then that is it, I don't receive an email for this being down once it turns to a hard 3/3 or if I start it again and it recovers. I've gone over this again and again but I just can't see what I have missed!

Thanks,

LS
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Windows Service notification issues

Post by scottwilkerson »

And the host is UP?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked