Page 1 of 2

Config Wizards Customization Question

Posted: Mon May 09, 2011 5:07 pm
by niebais
OS: Centos 5.5
Nagios XI Version: Nagios XI 2009R1.4B

We've been working on some new customized wizards for our company and we are trying to figure something out. We would like to remove the contacts and the hostgroup and servicegroups stages of the wizards. That way the user just selects a few things at the front of the wizard and he isn't bothered by "who is contacted" or the service groups. How can I do this?

Re: Config Wizards Customization Question

Posted: Tue May 10, 2011 9:45 am
by tonyyarusso
I believe you should be able to just delete those stages from the PHP file, then make sure your variables are properly passed between whatever stages remain in the same fashion they were going through those steps, and hardcode the contacts and such that you're taking out. I take it you're working from an existing wizard as a template?

Re: Config Wizards Customization Question

Posted: Tue May 10, 2011 9:48 am
by niebais
That's part of the problem, we only see three stages in the existing template (We're using genericnetdevice as a sample to go off of). We'd like to be able to not show some of other stages, like the service group and host group page, and kind of mock up our own instead.

Re: Config Wizards Customization Question

Posted: Tue May 10, 2011 1:48 pm
by mguthrie
I think this can be done, but I don't remember what the code looks like for it. I'll have to do some snooping around because I think some arguments can be passed to bypass some of the stages, but I need to double check on that...

Re: Config Wizards Customization Question

Posted: Tue May 10, 2011 3:35 pm
by niebais
Thanks, that would be useful.

Re: Config Wizards Customization Question

Posted: Tue May 10, 2011 3:37 pm
by mguthrie
This might be a little bit of a hack, but if it works, it'd be super simple. Try adding

Code: Select all

<input type="hidden" name="nextstep" value="commit" />
To the html output, when you click "next" this might take you to the last step. Or it could throw tons of missing variable errors ; ) If it works let me know. There are some things that can be done to hide the actual form elements for some of the wizard stages, but it doesn't look like we have an actual argument to pass to bypass a stage altogether.

Re: Config Wizards Customization Question

Posted: Wed May 11, 2011 2:45 am
by griffithusg
I would like to do something very similar but instead of just skipping it, actually assign a value to some of these variables. such as hostgroup selection and contact groups.

I would like to make it foolproof to add a host in. :)

Any thoughts on this would be excellentio.

Rob

Re: Config Wizards Customization Question

Posted: Wed May 11, 2011 1:40 pm
by mguthrie
I would like to do something very similar but instead of just skipping it, actually assign a value to some of these variables. such as hostgroup selection and contact groups.
This can be done, let me go dig up a code example of how to do it.

Re: Config Wizards Customization Question

Posted: Wed May 11, 2011 2:04 pm
by mguthrie
Code Examples:

I'm going to write up a Doc on writing custom wizards. There's a doc on the exchange that user Box293 wrote that gives tips ans suggestions, but as of yet we don't have anything official.

Code: Select all


		case CONFIGWIZARD_MODE_GETSTAGE3OPTS:

		//example of force overriding options 		
				$outargs[CONFIGWIZARD_OVERRIDE_OPTIONS]=array(
				"max_check_attempts" => 3,
				);

                    //hide options for this stage
                            $result=CONFIGWIZARD_HIDE_OPTIONS;
You can use the CONFIGWIZARD_OVERRIDE_OPTIONS array to manually override config options. So for the hostgroup override, you'll have to pass something like this:

Code: Select all

			$outargs[CONFIGWIZARD_OVERRIDE_OPTIONS]=array(
				"hostgroups" => "my list of hostgroups",
				);

Re: Config Wizards Customization Question

Posted: Wed May 11, 2011 5:03 pm
by niebais
Well that did direct me to the constants.inc.php file, which has all the constants in it. Thanks!