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?
Creating New Wizard: Questions
Creating New Wizard: Questions
Mike Weber
Nagios Training/Consulting
Nagios Training/Consulting
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Creating New Wizard: Questions
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:
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).
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;
"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).
I remember asking once and the answer I got was it is encrypted.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?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Creating New Wizard: Questions
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.
Box293....really helpful stuff you have provided...thanks.
Mike Weber
Nagios Training/Consulting
Nagios Training/Consulting
Re: Creating New Wizard: Questions
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
Re: Creating New Wizard: Questions
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
Re: Creating New Wizard: Questions
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.
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
Nagios Training/Consulting
Re: Creating New Wizard: Questions
Sounds great! I'll go ahead and close this now - see you in a few days!
Former Nagios employee