Checking if a service definition exists

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
absoord
Posts: 1
Joined: Thu Jan 29, 2015 9:04 am

Checking if a service definition exists

Post by absoord »

Hi,

We're running Nagios Core 3.2.3 on Ubuntu 12.04 LTS. We currently need some mechanism to check if a concrete service is defined in the Nagios configuration file. For example, from some client host (let's call it 'mailserv') I want to check if there's some service definition for 'mailserv' that has 'My passive check' as the service description. Is there some way to achieve this? If not natively, is there a way we could easily emulate this behavior?

Thanks.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Checking if a service definition exists

Post by tmcdonald »

I might not be understanding fully what you want, but a good place to start might be the objects.cache file in the .../nagios/var/ directory. It has full definitions for all objects in your running Nagios environment. It also takes all the template options and compiles them, sort of "flattening out" the object so to speak, so there is no need to look at the template an object may be using.
Former Nagios employee
Locked