Page 1 of 1

Home made Configuration Wizards - Skipping Stage 4

Posted: Thu Apr 15, 2010 10:45 pm
by Box293
admin wrote:... so we'll extend the config wizard API to allow your own custom wizards to initialize the default values that are displayed here.
I've been thinking about this and there are times when I would prefer not to get asked for the values, instead I would like to control these through service templates that I have provided as part of the configuration wizard.

For example, I have 6 monitoring tests. Normally when added via a wizard the minutes and amount of checks are applied directly to each service. If I suddenly want to increase or descrease the intensity of the monitoring I will need to go and adjust all six services.

When using a service template against each one of these services and not having the check times and number of checks defined on each of the 6 services, I can change the service template and all 6 services would be adjusted in one configuration change.

So it would be good to be able to define in the configuration wizard some sort of "do not prompt user for check times and number of checks values". Some soft of programming flag. Additionaly the author I could provide a message at this step explaing something like "the author of this wizard has chosen to use templates to define the check times and number of checks. If you would like to adjust these please go and edit the service template xxxxx".

I hope this makes sense.

Re: Home made Configuration Wizards - Skipping Stage 4

Posted: Fri Apr 16, 2010 2:13 pm
by mmestnik

Configuration Wizards - no values for interval or attempts

Posted: Fri Apr 30, 2010 6:59 am
by Box293
http://go.nagios.com/forum/344/1487
TSCAdmin wrote:What would be nice is the ability to apply the configuration to the hosts within a host-group, instead of a list of individual hosts.
I have a problem that might be similar to what you are saying.

My problem is that I can't seem to make the wizard NOT apply values to check_interval, retry_interval, max_check_attempts, notification_interval.

Taking a snippet from the snmp-trap.php

Code: Select all

				$objs[]=array(
					"type" => OBJECTTYPE_SERVICE,
					"host_name" => $hostname,
					"service_description" => "SNMP Traps",
					"use" => "xiwizard_snmptrap_service",
					"check_interval" => 1,
					"retry_interval" => 1,
					"max_check_attempts" => 1,
					"notification_interval" => 1,
					"icon_image" => "snmptrap.png",
					"_xiwizard" => $wizard_name,
					);
If I delete these 4 rows the default values of 5,1,5,60 are applied to the service when the wizard creates it.

If I modify the lines this way:

Code: Select all

"check_interval" => ,
"retry_interval" => ,
"max_check_attempts" => ,
"notification_interval" => ,
Then I get strange stuff after uploading the wizard.

If I modify the lines this way:

Code: Select all

"check_interval" => "",
"retry_interval" => "",
"max_check_attempts" => "",
"notification_interval" => "",
Then I get "0" applied to the 4 fields and the config wizard fails applying with this error:

Error: Invalid max_attempts, check_interval, retry_interval, or notification_interval value for service

My goal is not to have anything populated in these fields. I am using templates to control these settings.

How am I able to acheieve this?

Cheers

Re: Configuration Wizards - no values for interval or attempts

Posted: Sat May 01, 2010 5:25 pm
by mmestnik
Box293 wrote:I think I understand what you are saying about things being left unset. For instance if I made a configuration wizard that did not apply these values and instead it used templates. This would all work well until someone a) deleted the template or b) was editing the template itself and removed the interval values.

From what I can gather if the fields were not populated in the template then this would cause apply configuration to fail?

Unless there was some way in the config wizard to perform a validation check before applying configuration.

The author could provide instructions / warnings in the wizard about the specific template being used.
I think you managed to argue your self in circles. The template's values are used if and only if the value is left unset. To then complain that if a template is deleted or changed causes a problem confuses me. If you didn't want to use the template then you didn't want to leave the value unset.

I feel that templates should be used, for exactly reasons A and B. Firstly the use of a template allows values to be changed en-mass from a central location. The removal of a template would cause the configuration to fail on all it's users, thus prompting the template to be re-created to suite the needs of it's users.

I think the real solution for stage 4 is to have a selection for template or to name/define a new template and that these settings should not be set individually per service.

Re: Home made Configuration Wizards - Skipping Stage 4

Posted: Sun May 02, 2010 7:28 am
by Box293
Yes I agree, templates have their pros and cons.

The thing I am keen on is the ability to not populate the check_interval, retry_interval, max_check_attempts, notification_interval when the configuration wizard is run.

Re: Home made Configuration Wizards - Skipping Stage 4

Posted: Mon May 03, 2010 9:49 am
by mmestnik
Template values can not be unset, you will have to create a template that does not have these defined. For these setting's it's an error for them to be not set and your config won't load.

Re: Home made Configuration Wizards - Skipping Stage 4

Posted: Tue May 04, 2010 3:01 am
by Box293
I don't think I've explained this properly.

When the configuration wizard is run, and a service is created by it, I am unable to not populate the check_interval, retry_interval, max_check_attempts, notification_interval fields with my home made configuration wizard.

I have already created the service template that has all the specific values for check_interval, retry_interval, max_check_attempts, notification_interval and I do not want these fields populated in the service that is created by the config wizard, this is the purpose of the template.

Here is extact from a config wizard:

Code: Select all

case "ping":
	$objs[]=array(
	"type" => OBJECTTYPE_SERVICE,
	"host_name" => $hostname,
	"service_description" => "Ping",
	"use" => "xiwizard_dell_om_ping_service",
	"_xiwizard" => $wizard_name,
	);
break;
You can see that I am selecting the template with "use" => "xiwizard_dell_om_ping_service"

And you can see in a previous post how I've tried to overcome this. http://support.nagios.com/forum/viewtop ... =301#p1495

If these fields are populated in the service that the configuration wizard creates then the values in the template will not be applied.

Re: Home made Configuration Wizards - Skipping Stage 4

Posted: Tue May 04, 2010 10:25 am
by mmestnik
This is just being blocked by the Configuration Wizard's Stage 4. When there is a way to skip Stage 4 then this problem with just solve it's self. You shouldn't ask for the same thing twice, but you can instead attach more reasons/information to a request.

Re: Home made Configuration Wizards - Skipping Stage 4

Posted: Tue Aug 03, 2010 7:08 am
by Box293
Box293 wrote:My goal is not to have anything populated in these fields.
Have there been any changes to Nagios XI to allow this?


I've noticed the addition of

Code: Select all

define("CONFIGWIZARD_OVERRIDE_OPTIONS","override_options"); // options to override

I am able to hide the options from the user in the wizard using CONFIGWIZARD_MODE_GETSTAGE3OPTS and CONFIGWIZARD_MODE_GETSTAGE4OPTS (demonstrated in My group creation tool).

http://exchange.nagios.org/directory/Ad ... ol/details