Need wizard to create a service as inactive

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
gmackey
Posts: 35
Joined: Wed Mar 22, 2017 1:13 pm
Location: Edmond, OK
Contact:

Need wizard to create a service as inactive

Post by gmackey »

Hello,

I've copied and modified/renamed the "Windows Server" wizard to use only NRPE for the checks, along with various other changes like adding a prompt for host alias. I now need to be able to create one particular service that is inactive by default. The reason for this is that I want the service config to already be there for each host in case it needs to be activated at some point (it's actually only inactive on single-CPU VMs). For each service, I'm familiar with the "type", "host_name", "service_description", "use", "check_command", and "_xiwizard" attributes. Could you help me get the right syntax so the service is inactive when it is added by the wizard? I know this is done by default for copies of services via the CCM but I didn't have any luck trying to wade through all that source code to figure it out. Thanks!

Code: Select all

$objs[] = array(
    "type" => OBJECTTYPE_SERVICE,
    "host_name" => $hostname,
    "service_description" => "CPU Usage - Total",
    "use" => "xiwizard_nrpe_service",
    "check_command" => 'check_nrpe!check_cpu!-a filter="core eq str(total)" warn="load gt ' . $serviceargs["cpu_warning"] . '" crit="load gt ' . $serviceargs["cpu_critical"] . '" time=5m time=10m time=15m show-all',
    "_xiwizard" => $wizard_name,
);
Edit: The value in question appears to be the "is_active" column in the nagios_objects table and needs to be set to 0. I still don't know how to do that for the service in question via a wizard, though, so any help with that is much appreciated.

-Greg
=================================================
Nagios XI 5.6.5 Enterprise
CentOS 6.10 (64-bit) VMware image
SSL implemented and forced, with exception for localhost
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Need wizard to create a service as inactive

Post by tmcdonald »

While this is a cool project, we unfortunately cannot assist with custom development without calling it consulting. Small things like changing text color or fixing a typo are usually fine, but anything going this in-depth into the codebase would need to be arranged as a paid consulting session.
Former Nagios employee
gmackey
Posts: 35
Joined: Wed Mar 22, 2017 1:13 pm
Location: Edmond, OK
Contact:

Re: Need wizard to create a service as inactive

Post by gmackey »

Okay, thanks. Do you happen to have any code samples for interacting directly with the MySQL DB or via ndoutils or whatever is typically in the middle? I was hoping to use Nagios XI methods to do so and avoid directly accessing the DB, and I may try to do that after looking through the grep results for "is_active". I just figured I'd ask to speed things up. Thank you.
=================================================
Nagios XI 5.6.5 Enterprise
CentOS 6.10 (64-bit) VMware image
SSL implemented and forced, with exception for localhost
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Need wizard to create a service as inactive

Post by dwhitfield »

As far as making programming changes, NDO is on github: https://github.com/NagiosEnterprises/ndoutils

is_active is listed at https://assets.nagios.com/downloads/nag ... _Model.pdf

The version on Github is currently different than that of XI. Upgrade is ***definitely NOT supported***. You can take a look at old versions though: https://github.com/NagiosEnterprises/nd ... outils-2-1

I'd be happy to put a feature request in for you. Did you have anything to add about what you are trying to do so that I can give a complete request?
gmackey
Posts: 35
Joined: Wed Mar 22, 2017 1:13 pm
Location: Edmond, OK
Contact:

Re: Need wizard to create a service as inactive

Post by gmackey »

Thank you! I will take a look at those links. I'm leaving for vacation tonight so I'll be out for a while.

I think this feature is specific enough to our needs that it wouldn't be a good candidate for a feature request. Here's the UI and logic behind it:
  • In the wizard, there is an additional label to the right of CPU warning/critical called "# of Cores". There is a dropdown with values of "1" and "2+" that is set to "2+" by default.
  • If the dropdown is left at the default of "2+", the wizard creates two NRPE CPU monitors, one called "CPU Usage - Core" and one called "CPU Usage - Total". The "Core" monitor looks at the 60-minute average for each core while the "Total" monitor looks at 5/10/15-minute averages for all cores combined.
  • If the dropdown is changed to "1", the wizard only creates the "CPU Usage - Core" monitor.
    • This is because a single-core VM doesn't need both of these monitors and we need a 60-minute average since single-core VMs can be monopolized for much longer periods by legitimate processes like Windows Update cleanup (tiworker.exe).
    • I'd rather create an inactive "CPU Usage - Total" monitor in these cases, just in case we add a CPU core to the VM.
We use two CPU monitors so we can catch processes that monopolize most of an entire core for extended periods. In our environment, this typically indicates an issue with the responsible process that needs investigation.
=================================================
Nagios XI 5.6.5 Enterprise
CentOS 6.10 (64-bit) VMware image
SSL implemented and forced, with exception for localhost
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Need wizard to create a service as inactive

Post by dwhitfield »

Maybe I'm misunderstanding what you want, but giving the option to set a service as inactive in a wizard doesn't seem particularly complicated (for the XI devs).

Also, I saw your note about not wanting to go through all the source code. It wasn't clear whether you meant the XI PHP or NDO, which is why I gave the link to the github in case you meant all of XI. Narrowing it down just a bit, although re-reading this again I don't know that changes to NDO are needed...but that documentation might still be useful.

As to whether this is useful for other people or not, I suspect you are probably right. Unfortunately, a feature request is probably all I can do at this point.

If you have all the info you need, then great! If that's the case, is it ok if we go ahead and lock the thread?
gmackey
Posts: 35
Joined: Wed Mar 22, 2017 1:13 pm
Location: Edmond, OK
Contact:

Re: Need wizard to create a service as inactive

Post by gmackey »

dwhitfield wrote:Maybe I'm misunderstanding what you want, but giving the option to set a service as inactive in a wizard doesn't seem particularly complicated (for the XI devs).
I suppose this wouldn't require a change to any existing wizards but rather just making the option available for those who may wish to use it going forward. Would you mind submitting this as a feature request? Thanks!
=================================================
Nagios XI 5.6.5 Enterprise
CentOS 6.10 (64-bit) VMware image
SSL implemented and forced, with exception for localhost
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Need wizard to create a service as inactive

Post by dwhitfield »

I was doing a bit of digging in the feature requests and it looks like setting things to inactive is set for the next major API overhaul. Do you think this is enough to get you where you are going or do you still want me to put in a separate feature request?
gmackey
Posts: 35
Joined: Wed Mar 22, 2017 1:13 pm
Location: Edmond, OK
Contact:

Re: Need wizard to create a service as inactive

Post by gmackey »

That works for me. This is a very low priority for us. Thanks and please feel free to close the thread.
=================================================
Nagios XI 5.6.5 Enterprise
CentOS 6.10 (64-bit) VMware image
SSL implemented and forced, with exception for localhost
Locked