Creating New Wizard: Questions

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
mikew
Posts: 243
Joined: Sun Feb 05, 2012 7:05 pm

Creating New Wizard: Questions

Post by mikew »

I am working on creating a wizard that will implement hundreds of servers into a pre-designed structure of hostgroups, service templates and host templates. I have a couple questions as I have been looking at the bulk host import wizard and taking some ideas from that to create the new one.

The wizard I am working on will allow you to add mulitple hostgroups to one host so that you can add OS metrics and application metrics based on each host. Here are the questions:

1. What is the main core file that handles host configuration pertaining to hostgroups, host template, etc. that is used when adding a bulk number of new hosts using something like .csv importing?

2. Is there a specific core function that has to be called to add an array of hostgroups to a new host via cloning method?
Mike Weber

Nagios Training/Consulting
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Creating New Wizard: Questions

Post by Box293 »

From what I understand ...

Inside this: "case CONFIGWIZARD_MODE_GETOBJECTS:" is where the host items are created. They are added to an $objs array that is passed to the backend which creates all the objects.

From the bulkhostimport.ini.php file:

Code: Select all

$newhost = array(
      "type" => OBJECTTYPE_HOST,
      "use" => grab_array_var($host_template, "use", "generic-host"),
      "host_name" => $hostname,
      "address" => $address,
      "alias" => $hostalias,
      "hostgroups" => $hostgroup,
      "parents" => $parenthost
      );

and a little further down

$objs[] = $newhost;
This line:
"hostgroups" => $hostgroup,

Defines the hostgroups the host needs to be a member of, this is just a comma delimited list of hostgroups.

However this adds it to the host object itself. I am unsure of how to add the host to a hostgroup in the hostgroup definition (not the host object definition).
mikew wrote:What is the main core file that handles host configuration pertaining to hostgroups, host template, etc. that is used when adding a bulk number of new hosts using something like .csv importing?
I remember asking once and the answer I got was it is encrypted.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
mikew
Posts: 243
Joined: Sun Feb 05, 2012 7:05 pm

Re: Creating New Wizard: Questions

Post by mikew »

So we have this mostly working, but one issue that I have is it seems to want to always add the hostgroup linux-server to everything...any ideas on that.

Box293....really helpful stuff you have provided...thanks.
Mike Weber

Nagios Training/Consulting
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Creating New Wizard: Questions

Post by tmcdonald »

If you wanna PM me the wizard (if you can) I'll take a look. Not a developer by any means but I've messed with wizards and components a fair bit.
Former Nagios employee
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Creating New Wizard: Questions

Post by tmcdonald »

Received the component. Can you give an example CSV or just the data so I can replicate this on my end? I tried with both checking and unchecking the option to replace the parents/hostgroup, and couldn't get it to include linux-servers. Are you sure there wasn't a change to the templates that would include linux-servers?
Former Nagios employee
User avatar
mikew
Posts: 243
Joined: Sun Feb 05, 2012 7:05 pm

Re: Creating New Wizard: Questions

Post by mikew »

We worked on this from our end and have figured out the problem. The problem was in selecting the host that we working with was corrupt.

Anyway thanks for looking at it. I will be sharing this and other rapid deployment options at the Nagios Conference.
Mike Weber

Nagios Training/Consulting
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Creating New Wizard: Questions

Post by tmcdonald »

Sounds great! I'll go ahead and close this now - see you in a few days!
Former Nagios employee
Locked