Page 1 of 1
Creating New Wizard: Questions
Posted: Fri Oct 03, 2014 9:29 am
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?
Re: Creating New Wizard: Questions
Posted: Fri Oct 03, 2014 3:23 pm
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.
Re: Creating New Wizard: Questions
Posted: Tue Oct 07, 2014 11:43 am
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.
Re: Creating New Wizard: Questions
Posted: Tue Oct 07, 2014 4:46 pm
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.
Re: Creating New Wizard: Questions
Posted: Wed Oct 08, 2014 10:07 am
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?
Re: Creating New Wizard: Questions
Posted: Thu Oct 09, 2014 4:42 am
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.
Re: Creating New Wizard: Questions
Posted: Thu Oct 09, 2014 8:57 am
by tmcdonald
Sounds great! I'll go ahead and close this now - see you in a few days!