Hi Everyone,
Intro:
I was trying to customize the host template form of Icingaweb2. I created my own select element “components” in that form. Then I also created a column my director database in “Icinga Hosts Table” for that specific element. I also updated the query as well which is adding this form in the relevant table for this new field as well.
Problem
Now the problem is when I add, modify or delete a host template, everything works fine but when I onboard a host using that template, it gives a deployment error. Right now, I cannot seem to figure out what is the problem or where the process getting broken.
One thing to be noted that the host and template get pushed into the director Db successfully and we would see the updated Icinga Host table.
I have been looking into this problem for a while now and need urgent help. So, any help or support will be highly appreciated from you guys. Thank you very much in advance.
Information:
- Director version (
1.9.0
): - Icinga Web 2 version (
2.11.2
): - Icinga 2 version (
r2.13.6-1
): - Operating System and version (
Ubuntu --20.04
): - Webserver, PHP versions (
Apache/2.4.41
,PHP 7.4.3
):
Deployment Error:
information/cli: Icinga application loader (version: r2.13.6-1)
information/cli: Loading configuration file(s).
information/ConfigItem: Committing config item(s).
information/ApiListener: My API identity: nodename
critical/config: Error: Attribute ‘components’ does not exist.
Location: in [stage]/zones.d/director-global/host_templates.conf: 3:5-3:19
[stage]/zones.d/director-global/host_templates.conf(1): template Host “New_Template” {
[stage]/zones.d/director-global/host_templates.conf(2): check_command = “ping4”
[stage]/zones.d/director-global/host_templates.conf(3): components = “Component1”
[stage]/zones.d/director-global/host_templates.conf(4): groups = [ “Hostgroup1” ]
[stage]/zones.d/director-global/host_templates.conf(5): }
critical/config: 1 error
critical/cli: Config validation failed. Re-run with ‘icinga2 daemon -C’ after fixing the config.
FYI, in the host_templates.conf file, the components field exists. Also when I run the command icinga2 daemon -C from the terminal, it shows on deployment errors. I have tried checking debug logs but they don’t show relevant information.
Code for Component Element:
$this->addElement(‘select’, ‘components’, array(
‘label’ => $this->translate(‘Component’),
‘description’ => $this->translate(‘Choose a Component’),
‘required’ => false,
‘multiOptions’ => $components,
‘class’ => ‘autosubmit’,
));
If you require anymore information from my end, please let me know. Thanks