Home made Configuraiton Wizards - Stage 4 populating fields

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Home made Configuraiton Wizards - Stage 4 populating fields

Post by Box293 »

At stage 4 in the configuration wizard you can specify how often to check the services, see screenshot:
Monitoring Settings.jpg
In my home made configuration wizard, is there a way to specify what default values are populated in these fields?


For example, I have some auditing checks that I only want performed three times a day (say every 28800 minutes).
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mmestnik
Posts: 972
Joined: Mon Feb 15, 2010 2:23 pm

Re: Home made Configuraiton Wizards - Stage 4 populating fields

Post by mmestnik »

If you are asking should I assume it's not part of the HTML generated by php?
Monday.
User avatar
admin
Site Admin
Posts: 256
Joined: Mon Oct 12, 2009 8:21 am

Re: Home made Configuraiton Wizards - Stage 4 populating fields

Post by admin »

You are adventurous! We haven't documented the config wizard API officially yet, so its great to see that you're delving in on your own.

The mods you suggested aren't possible YET. However, we know this would be really useful, so we'll extend the config wizard API to allow your own custom wizards to initialize the default values that are displayed here. It might take a few weeks to get this in and tested, but we'll definitely get it incorporated. :-)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Ethan Galstad
President
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Home made Configuraiton Wizards - Stage 4 populating fields

Post by Box293 »

Thanks for the info, there is no rush to get this feature added as I'm sure there are many more important things on your list at this point in time. :mrgreen:
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
TSCAdmin
Posts: 155
Joined: Wed Apr 14, 2010 3:00 pm
Location: India

Re: Home made Configuraiton Wizards - Stage 4 populating fields

Post by TSCAdmin »

I've just built my own Linux server monitoring wizard (the one provided uses NRPE, and I'd rather use SNMP and different variety of checks, such as bonded network interfaces, fibre cards, etc) ... this part was the only thing I was having difficulty with. Glad to hear this is being worked on :D
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Home made Configuraiton Wizards - Stage 4 populating fields

Post by Box293 »

I've noticed in the 2009R1.2 development snapshot you've made mention of this API change.

How do we make use of this new functionality when creating our own config wizards?

Cheers
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mmestnik
Posts: 972
Joined: Mon Feb 15, 2010 2:23 pm

Re: Home made Configuraiton Wizards - Stage 4 populating fields

Post by mmestnik »

Ethan made the API change and he is going to a Con this week and has another Con coming up, so it will be a few weeks to get this out.

This feature doesn't seam critical enough to effect development of Wizards for 1.2, the API likely works just like the rest of the API and you might even be able to write a prototype of the code. What you are missing just now is the Nouns and Verbs, you should have a good feel for what the rest would look like. When I asked Ethan didn't give me any hints as to how to use this API, this is his last day in the office prior to going over seas.

I'd also like to add that although it's prudent to have a 1.2 branch for your projects I'd feel unpleasant about there being users potentially using anything like that in production. Please make sure any Wizards you release or publish have a 1.1H compatible back-port, as I'd hate for users to upgrade prematurely so they could make use of your applications.

Thank you!! :D
User avatar
admin
Site Admin
Posts: 256
Joined: Mon Oct 12, 2009 8:21 am

Re: Home made Configuraiton Wizards - Stage 4 populating fields

Post by admin »

Okay, here's some code snippets that go in the same callback function you use to output HTML, etc in wizards. Hopefully this will give you enough to try it out on your own. :-)

Code: Select all


		case CONFIGWIZARD_MODE_GETSTAGE3OPTS:
		
			// pass any monitoring variables you want to override...
			$outargs[CONFIGWIZARD_OVERRIDE_OPTIONS]=array(
				"check_interval" => 9,
				"retry_interval" => 10,
				"max_check_attempts" => 11,
				);
		
			break;
		
		case CONFIGWIZARD_MODE_GETSTAGE4OPTS:
		
			// pass any notification variables you want to override...
			$outargs[CONFIGWIZARD_OVERRIDE_OPTIONS]=array(
				"notification_interval" => 12,
				"first_notification_delay" => 13,
				"notification_options" => "none", // "delayed", "immediate", or "none"
				"notification_targets" => array(
					"myself" => "on",
					"contacts" => "",
					"contactgroups" => "on",
					),
				"contact_id" => array( // pre-selected contacts
					311 => "on",
					177 => "on"
					),
				"contactgroup_id" => array( // pre-selected contact groups
					146 => "on"
					),
				);
		
			break;
		
		// THE FOLLOWING MODES ARE POST-CONFIGURATION CALLBACKS
		// THEY CAN BE USED TO DO CONFIGURATION TASKS, ETC AFTER A NEW CONFIGURATION HAS BEEN SUBMITTED
			
		case CONFIGWIZARD_MODE_COMMITERROR:
			echo "COMMITERROR!\n";
			break;
			
		case CONFIGWIZARD_MODE_COMMITCONFIGERROR:
			echo "COMMITCONFIGERROR!\n";
			break;

		case CONFIGWIZARD_MODE_COMMITPERMSERROR:
			echo "COMMITPERMSERROR!\n";
			break;
			
		case CONFIGWIZARD_MODE_COMMITOK:
		
			//echo "COMMITOK!\n";
			//echo "INARGS:\n";
			//print_r($inargs);
			
			$services_serial=grab_array_var($inargs,"services_serial");
			$services=unserialize(base64_decode($services_serial));
			
			//echo "SERVICES:\n";
			//print_r($services);

			// initialize each 'SNMP Traps' service with an OK state
			$servicename="SNMP Traps";
			$hosts=grab_array_var($services,"host");
			foreach($hosts as $hostname => $hoststate){
				echo "HOST/SVC => $hostname,SNMP Traps\n";
				$output="";
				$raw_command="PROCESS_SERVICE_CHECK_RESULT;".$hostname.";".$servicename.";0;Waiting for trap...\n";
				submit_direct_nagioscore_command($raw_command,$output);
				}
			
			break;
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Ethan Galstad
President
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Home made Configuraiton Wizards - Stage 4 populating fields

Post by Box293 »

Thanks for taking time to get this information to us.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked