NagiosXI Wizard related query. & issues..

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vishfx
Posts: 134
Joined: Tue Apr 24, 2018 12:30 pm

NagiosXI Wizard related query. & issues..

Post by vishfx »

Hi NagiosXI Team,

a) How can we skip stage3 & stage4 and override hosts/services settings at finalstage ?
Please share more details about usage of the below :
• GETSTAGE3OPTS: [optional] Allows “check settings” to be hidden and/or overridden
• GETSTAGE4OPTS: [optional] Allows “alert settings” to be hidden and/or overridden

b)
We are building Host & Service Dependency dynamically in the Wizard.
However, Host & Service Dependency file doesn't seem to get created.


Below is the Wizard snippet for Service Dependencies creation :

Code: Select all

case CONFIGWIZARD_MODE_GETOBJECTS:
.
.
.
.
.
$objs[] = array(
                                    "type"                          => OBJECTTYPE_SERVICEDEPENDENCY,
                                    //"dependent_host_name"         => $hostname,   
                                    "dependent_service_description" => $host_services_string,
                                    "host_name"                     => $hostname_sd,
                                    "service_description"           => $cf_service_description_string,
                                    "inherits_parent"               => "1",
                                    "dependency_period"             => "24x7",
                                    "notification_failure_criteria" => "w",
                                    "execution_failure_criteria"    => "w",
                                );
.
.
.
.

$outargs[CONFIGWIZARD_NAGIOS_OBJECTS]=$objs;								
The output array for service dependency seems to be as expected.
Do you see any issue here ?
Is there a better way to debug this in a better way so that we know exactly where the failure occurs ?

Below is the output array which gets generated and is seen in the browser when printing in php :

Code: Select all

	[1569] => Array
        (
            [type] => 8
            [dependent_service_description] => redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_cpu_sys,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_swap_kb,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_swap_percent,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/disk_system_inode_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/system_mem_kb,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/disk_system_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/disk_persistent_percent,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/system_mem_percent,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/disk_system_percent,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_mem_percent,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_swap_kb,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/system_mem_kb,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/disk_persistent_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/system_load_1_m,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/disk_system_inode_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/disk_persistent_inode_percent,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/disk_system_inode_percent,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_mem_kb,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_mem_percent,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/system_load_1_m,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/disk_persistent_inode_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/system_healthy,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/disk_persistent_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/disk_ephemeral_percent,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/disk_persistent_percent,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_load_1_m,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_mem_kb,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/system_healthy,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/disk_ephemeral_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/system_cpu_wait,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/disk_persistent_inode_percent,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/disk_persistent_inode_percent,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_healthy,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_load_1_m,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/system_cpu_wait,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/disk_ephemeral_inode_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/system_cpu_user,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/disk_ephemeral_percent,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_healthy,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/disk_ephemeral_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/disk_ephemeral_inode_percent,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/system_cpu_user,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/system_swap_percent,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_cpu_wait,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/system_cpu_sys,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/disk_ephemeral_inode_percent,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_cpu_wait,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/disk_ephemeral_inode_percent,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/system_cpu_sys,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/system_swap_kb,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_cpu_user,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/disk_system_percent,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/system_swap_percent,redis/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_cpu_user,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_swap_percent,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/disk_system_percent,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/system_mem_percent,mysql/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_cpu_sys,healthwatch-forwarder/248b9939-ad6e-42ad-ae13-46d5ddcb81ce/disk_system_inode_percent,healthwatch-forwarder/f7a5b0e5-997f-469c-8be4-4ef83b8b2d13/system_swap_kb
            [host_name] => p-healthwatch-7231fb18cbfd08fb64d0
            [service_description] => router/a76a8598-8c3d-4c60-b38d-b858219d54cd/system_healthy,router/743fd1ff-46ec-4e0a-81e2-eeabb207e6f7/system_healthy
            [inherits_parent] => 1
            [dependency_period] => 24x7
            [notification_failure_criteria] => w
            [execution_failure_criteria] => w
        )
Kindly assist.

Regards,
Vish.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NagiosXI Wizard related query. & issues..

Post by ssax »

Is this in regards to a wizard that you are writing or one that we provide?
vishfx
Posts: 134
Joined: Tue Apr 24, 2018 12:30 pm

Re: NagiosXI Wizard related query. & issues..

Post by vishfx »

Hi,

We are writing a custom wizard.

Regards,
Vish.
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: NagiosXI Wizard related query. & issues..

Post by jomann »

Unfortunately support can't really help with development and we don't support custom development. I can however give you a couple pointers.

For your 1st question, you should be able to do something like this in the opts stages:

Code: Select all

$output .= "Some output";
$result = CONFIGWIZARD_HIDE_OPTIONS;
$outargs[CONFIGWIZARD_HIDDEN_OPTIONS] = array(
                CONFIGWIZARD_HIDE_HOSTGROUPS,
                CONFIGWIZARD_HIDE_SERVICEGROUPS,
                CONFIGWIZARD_HIDE_PARENT_HOSTS,
);
You can experiment with those settings, you can do just the hide options result to hide everything.

For question 2, there really isn't a better place. The keys should match the values in the config definition you'd write in the Nagios Core config files. Since the wizard config array will be written into a hard config (and then placed in the /usr/local/nagios/etc/import directory) as a random named file and imported when apply config is ran shortly after.

Code: Select all

$outargs[CONFIGWIZARD_SKIP_OBJECTS_RECONFIGURE] = true;
The above code you can put in the very last stage, if you'd like it not to reconfigure after you run the wizard.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
vishfx
Posts: 134
Joined: Tue Apr 24, 2018 12:30 pm

Re: NagiosXI Wizard related query. & issues..

Post by vishfx »

Thanks Jonmann.

I tried whatever you suggested.
What I observed that hosts & services cfg files do get generated in "import" folder , but do not see "servicedependencies.cfg" getting generated.
Any other pointers ?

Below is the exact snippet I tried :

Code: Select all

case CONFIGWIZARD_MODE_GETOBJECTS:
…..
//SOME FURTHER PROCESSING TO Fetch and prepare the service dependencies
…..
$objs[] = array(
		"type"	 					=> OBJECTTYPE_SERVICEDEPENDENCY,
		"config_name"					=> "TEST_test_svc_dependencies",
		"dependent_host_name"			=> "test-912d1770ffc415619c58",	
		"dependent_service_description"                          => "test/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_cpu_sys,test/55e24743-2fa1-47f3-b43a-bcdc3b283a72/system_swap_kb,test/09b8edcd-9158-4ae1-8065-42ee9b987ef6/system_swap_percent",
		"host_name" 					=> "cf-d9e5d142a1824d66533f",
		"service_description" 			               => "test/0003dc5d-c6ab-4a6b-a6b9-8a0390ea1436/system_healthy,test/a8fdc4ca-55f0-453c-a9db-d577d76203b5/system_healthy,test/cef347b8-d92c-4f8a-9b50-65ce540113a6/system_healthy",		
		"inherits_parent"				=> "1",
		"dependency_period"				=> "24x7",
		"notification_failure_criteria" => "w,u,c,p,",
		"execution_failure_criteria"    => "w,u,c,p,"
	);

$outargs[CONFIGWIZARD_SKIP_OBJECTS_RECONFIGURE] = true;										
$outargs[CONFIGWIZARD_NAGIOS_OBJECTS]=$objs;
break;
Regards,
Vish.
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: NagiosXI Wizard related query. & issues..

Post by jomann »

Because you're skipping the reconfigure you'll see the file in the import. Once you apply config in XI it will import the configuration file into the CCM and then it will re-write your configs in /usr/local/nagios/etc including your dependency configs.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
vishfx
Posts: 134
Joined: Tue Apr 24, 2018 12:30 pm

Re: NagiosXI Wizard related query. & issues..

Post by vishfx »

Yes Jomann, am aware of this process.

But from above snippet, can you tell me why "servicedependencies.cfg" is not getting generated in "import" folder.
Do you see any issue with the parameters ?

Regards,
Vish.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NagiosXI Wizard related query. & issues..

Post by scottwilkerson »

I just had a look at the underlying code for the config wizards, and we do not have logic in there to handle the writing of OBJECTTYPE_SERVICEDEPENDENCY as we have never created a wizard to perform this activity.

In this case, I think the only way to handle this is to have your custom wizard write out an actual config file to the /usr/local/nagios/etc/import/ directory.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
vishfx
Posts: 134
Joined: Tue Apr 24, 2018 12:30 pm

Re: NagiosXI Wizard related query. & issues..

Post by vishfx »

Thanks Scott.

We will take that route.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NagiosXI Wizard related query. & issues..

Post by scottwilkerson »

vishfx wrote:Thanks Scott.

We will take that route.
Let us know if you have further issues.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked