Page 1 of 1

Nagios Core - No alert on service check

Posted: Tue Apr 20, 2021 4:08 pm
by jer_conn
I'm new to Nagios, so I apologize if anything I'm asking seems silly.

I'm running Nagios Core (4.4.6) to monitor a homemade Ubuntu Linux router with a RAID 1 array. Nagios is running on that machine, so monitoring the localhost. I've successfully set up and received notifications for the status of the RAID array (using https://exchange.nagios.org/directory/P ... id/details) when I purposely set one of the partitions as faulty. I am now trying to set up a "daily update" alert for the RAID array to confirm that it is being checked and is healthy. The service check is set up separately from the previous RAID check (that will alert me anytime there is a problem), but using the same command script. Here's what I've done:

1) Defined the service in localhost.cfg

Code: Select all

define service {

    host_name                   localhost
    service_description      RAID Daily Status
    check_command          check_md_raid
    max_check_attempts   1
    check_interval             1,440
    active_checks_enabled 1
    check_period                checkhours
    notification_interval     1,440
    notification_period       24x7
    notification_options      w,c,r,u
    notifications_enabled    1
    contacts                        nagiosadmin
    contact_groups              admins
}
2) Defined checkhours as a specific 5 hour time period every day in timeperiods.cfg

3) Sent a Custom Service Notification to check that the notification can be sent for that service

What am I missing that I need to do? Any help is appreciated.

Re: Nagios Core - No alert on service check

Posted: Thu Apr 22, 2021 1:35 pm
by benjaminsmith
Hi,

The notification handlers will only be called on hard state changes, so if the service stays in OK, then you would not receive a notification. There are quite a few options to keep a check on things. You can set up another instance to monitor the monitoring application or you can create a simple bash script that runs once a day and sends a custom notification.

Code: Select all

#!/bin/sh
# This is a sample shell script showing how you can submit the SEND_CUSTOM_SVC_NOTIFICATION command
# to Nagios. Adjust variables to fit your environment as necessary.

now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'

/bin/printf "[%lu] SEND_CUSTOM_SVC_NOTIFICATION;envirosensor;Water Level;3;Ethan;The NOC is currently flooding.  Help!\n" $now > $commandfile   
See: https://assets.nagios.com/downloads/nag ... and_id=135

--Benjamin

Re: Nagios Core - No alert on service check

Posted: Thu Apr 22, 2021 2:10 pm
by jer_conn
Thank you! I'll follow up after trying this (I'm not able to get to that machine right now), but I don't see why it wouldn't work. I thought the hard state not changing may be the problem, but I had no idea how to get around it, and I wasn't able to find the solution you posted when searching.

Re: Nagios Core - No alert on service check

Posted: Thu Apr 22, 2021 3:21 pm
by jer_conn
It worked! Thank you!

Re: Nagios Core - No alert on service check

Posted: Fri Apr 23, 2021 9:51 am
by benjaminsmith
Hi,

Great! We'll go ahead and close this out.

Thank you for using the Nagios Community Forum.