NCPA - Passive Services and Status Unknown

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.
Post Reply
UnicornsandKittens
Posts: 4
Joined: Wed Jul 17, 2024 6:24 am

NCPA - Passive Services and Status Unknown

Post by UnicornsandKittens »

I'm running a Nagios Instance that's supposed to only receive passive Checks.
So, there are no active Checks, no flap Detection and so on. It's a passive only Environment.
Hosts go down or come up as they like. We don't care if Hosts are down or not. But if they are up, we want to know the Status of their Services.

Current Behavior:
Hosts send their passive Checks and the Status is OK, Critical or Warning. That's fine.
Hosts go down and the last Result remains. So anything that was OK, Critical or a Warning remains in that State, which at this Point is not true anymore.

Target Behavior:
Any Service Status of any Hosts that are down since x (Time in Seconds, Minutes, etc.), should be changed to Unknown. As this is the only true State of Information as long as the Host is down.

This should be achieved by keeping the Environment passive.

Kind Regards
UnK
swolf

Re: NCPA - Passive Services and Status Unknown

Post by swolf »

Hi @UnicornsandKittens, thanks for reaching out!

I think you can solve this by adding freshness checking onto your services. This would have the effect of creating "active checks", but you'd want to follow something close to the documentation, where you run a command like $USER1$/check_dummy 3 "No recent result - service state is unknown" as your "active check". This command won't be e.g. making network calls or doing expensive computations on the Nagios Core server, so you'd retain most of the benefits of your passive environment.

Let me know if that helps or if you need anything clarified
-Sebastian
UnicornsandKittens
Posts: 4
Joined: Wed Jul 17, 2024 6:24 am

Re: NCPA - Passive Services and Status Unknown

Post by UnicornsandKittens »

Hi Sebastian,

thanks for the quick reply.

Although it breaks the desired logic, I'm testing this configuration, to see if the result is achieved.

Yes, Services are now shown as Unknown when the Host is offline, but the Unknown Services disappear after a while, which is not the desired behavior.

I would adapt the following in nagios.cfg;
# MAX CHECK RESULT FILE AGE
max_check_result_file_age=3600

to 36000 or 360000

Actually I want checks never to disappear, even if the Host is down since months or years.


Kind Regards
UnK
bbahn
Posts: 379
Joined: Thu Jan 12, 2023 5:42 pm

Re: NCPA - Passive Services and Status Unknown

Post by bbahn »

Hello @UnicornsandKittens,

You can set

Code: Select all

max_check_result_file_age=0
and that will make Nagios process all check result files, even if they're older than your hardware.
Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.
UnicornsandKittens
Posts: 4
Joined: Wed Jul 17, 2024 6:24 am

Re: NCPA - Passive Services and Status Unknown

Post by UnicornsandKittens »

Thank you.
I wasn't sure abount commenting out or setting the Value to 0.

But the Behavior remains.

I'm not checking Hosts, all Hosts are grey (fine)
Some Checks are submitted as Critical (fine)
Some Checks are older than an Hour and should have the Status Unknown (desired Behavior, never occurs)
All Checks older than x are discarded (Not desired and problematic in several Ways.)


Parts of my config (that matter to my Understanding) for Referrence:

passiveservice.cfg
define service {
use generic-service
hostgroup_name clients
service_description num_check
active_checks_enabled 0 ; changes Behavior
passive_checks_enabled 1
check_command check_null
check_freshness 0 ; seems to have no effect
check_period 24x7
}

host.cfg
define host {

use client
host_name deepthought
alias 42
passive_checks_enabled 1
hostgroups lst_wien
check_period 24x7
max_check_attempts 1
check_interval 60
retry_interval 3
check_freshness 1 ;seems to have no effect
contact_groups admins
notification_interval 60
notification_period 24x7
notification_options d,u,r
}

Nagios.cfg
# MAX CHECK RESULT FILE AGE
max_check_result_file_age=0 ; seems to have no effect

# SERVICE CHECK EXECUTION OPTION
execute_service_checks=1

# PASSIVE SERVICE CHECK ACCEPTANCE OPTION
accept_passive_service_checks=1

# HOST CHECK EXECUTION OPTION
execute_host_checks=0

# PASSIVE HOST CHECK ACCEPTANCE OPTION
accept_passive_host_checks=1

# SERVICE FRESHNESS CHECK OPTION
check_service_freshness=0 ; changes Behavior

# SERVICE FRESHNESS CHECK INTERVAL
service_freshness_check_interval=3600


Posted is my last "working" config, that doesn't discard Results.. The current State is that Results remain as they are, when no new Results are received.
The Options in red are those, that I change, with the supposed Behavior of having Results becoming Unknown after 1 Hours, but actually having them deleted.
Post Reply