Nagios Core - No alert on service check

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
jer_conn
Posts: 3
Joined: Tue Apr 20, 2021 3:44 pm

Nagios Core - No alert on service check

Post 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.
Attachments
Service State for RAID Daily Status (note that the time periods have been adjusted to try to prompt an alert sooner)
Service State for RAID Daily Status (note that the time periods have been adjusted to try to prompt an alert sooner)
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Nagios Core - No alert on service check

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
jer_conn
Posts: 3
Joined: Tue Apr 20, 2021 3:44 pm

Re: Nagios Core - No alert on service check

Post 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.
jer_conn
Posts: 3
Joined: Tue Apr 20, 2021 3:44 pm

Re: Nagios Core - No alert on service check

Post by jer_conn »

It worked! Thank you!
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Nagios Core - No alert on service check

Post by benjaminsmith »

Hi,

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

Thank you for using the Nagios Community Forum.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked