Page 1 of 1

Timeperiod xi_timeperiod_24x7 forced in wizard

Posted: Mon Sep 09, 2019 11:56 am
by sigmainformatique
Hi Nagiosmen,

I have made two wizards for our enterprise : one for linux, one for windows.
These two wizards are dereivated from XI standards linux/windows wizards.

My issue is that timeperiod xi_timeperiod_24x7 is forced in hosts/services generated wherereas nothing in the wizard code mention it :

Code: Select all

# pwd
/usr/local/nagiosxi/html/includes/configwizards/linux-server-sigma
# grep -r timeperiod *
#
In my company, timeperiod are inherited in host templates.

- How can I modifiy my wizard in order to leave timeperiod blank in the hosts/services created.
- How can I massively delete timeperiods when they have been previously set to xi_timerperiod_24x7?

Regards

Re: Timeperiod xi_timeperiod_24x7 forced in wizard

Posted: Mon Sep 09, 2019 2:40 pm
by benjaminsmith
Hello @sigmainformatique,
In my company, timeperiod are inherited in host templates.
- How can I modifiy my wizard in order to leave timeperiod blank in the hosts/services created.
Have you tried including the template in the wizard itself? You'll have to place the template in the template directory and then specify it in config.xml.

See: Guidelines for Writing Custom Wizards
How can I massively delete timeperiods when they have been previously set to xi_timerperiod_24x7?
If you have the Enterprise Edition, you can use the Bulk Mods Tool. Go to Configure > CCM > Tools > Bulk Modifications Tool > Change Single Config Option and choose Check Period.

Re: Timeperiod xi_timeperiod_24x7 forced in wizard

Posted: Wed Sep 11, 2019 10:49 am
by sigmainformatique
Hi,

Thank you for your response.

Putting a templates/linux-server.cfg with an empty xiwizard_linuxserver_host template did not solve the problem.

Code: Select all

#########################################
## TEMPLATES
#########################################

define host {
        name                    xiwizard_linuxserver_host
        register                0

}
It's logical, as hosts parameters have precedence over the host's templates parameters.
In this case, that is WIZARD that directly force notification period directly on host.

I think this is set in later stages of the wizard (with check frequency, retry...).

Any way to remove that from the wizard?

Perhaps I could unset this from $objs object in the wizard?

Code: Select all

$obj = array(
                    "type"            => OBJECTTYPE_HOST,
                    "use"             => "$host_template, graphexplorer", //"xiwizard_linuxserver_host",
                    "host_name"       => $hostname,
                    "address"         => $hostaddress,
                    "icon_image"      => $icon,
                    "statusmap_image" => $icon,
                    "_xiwizard"       => $wizard_name,
                    "contact_groups"  => $contact_group,
                    "max_check_attempts" => 3,

                );
Note that in our wizard code, template inheritance is managed by choices made in the wizard by user. Work like a charm, except for this notification perdiod and parameters "forced" in later stages.

Re: Timeperiod xi_timeperiod_24x7 forced in wizard

Posted: Wed Sep 11, 2019 4:28 pm
by benjaminsmith
Hello,

Well, after some digging, this is by design. You cannot set the notification period and check period using the templates as they will be overwritten by default values xi_timeperiod_24x7. You can however set those directly in your wizard. For examples, please check out some of the wizards on the Nagios Exchange.

https://exchange.nagios.org/directory/A ... on-Wizards

Let me know if you have any other questions.

Re: Timeperiod xi_timeperiod_24x7 forced in wizard

Posted: Wed Sep 25, 2019 11:45 am
by sigmainformatique
Hi,

We will modify it direclty with SQL queries in Nagiosql database, and a scheduled procedure.
You can close this thread.

Regards

Re: Timeperiod xi_timeperiod_24x7 forced in wizard

Posted: Wed Sep 25, 2019 11:57 am
by benjaminsmith
Hello,
We will modify it direclty with SQL queries in Nagiosql database, and a scheduled procedure.
You can close this thread.
We'll close this out. If you have any new questions, feel free to open another post.