Page 1 of 1

PHP Notice on import

Posted: Wed Oct 17, 2018 7:39 am
by sigmainformatique
Hello

We are working on a Nagios upgrade, importing Nagios files to NagiosXI.

And we encounter some unexplained PHP errors...

Code: Select all

--- ccm_import.php -------------------
> Setting import directory: /usr/local/nagios/etc/import/
> Importing config files into the CCM
  - Importing: /usr/local/nagios/etc/import/xi_tpl_host.cfg .. PHP Notice:  Undefined index: host_name in /usr/local/nagiosxi/html/includes/components/ccm/classes/import.class.php on line 551
PHP Notice:  Undefined index: host_name in /usr/local/nagiosxi/html/includes/components/ccm/classes/import.class.php on line 911
PHP Notice:  Undefined index: host_name in /usr/local/nagiosxi/html/includes/components/ccm/classes/import.class.php on line 551
PHP Notice:  Undefined index: host_name in /usr/local/nagiosxi/html/includes/components/ccm/classes/import.class.php on line 905
PHP Notice:  Undefined index: host_name in /usr/local/nagiosxi/html/includes/components/ccm/classes/import.class.php on line 551
PHP Notice:  Undefined index: host_name in /usr/local/nagiosxi/html/includes/components/ccm/classes/import.class.php on line 905
PHP Notice:  Undefined index: host_name in /usr/local/nagiosxi/html/includes/components/ccm/classes/import.class.php on line 551
PHP Notice:  Undefined index: host_name in /usr/local/nagiosxi/html/includes/components/ccm/classes/import.class.php on line 905
SUCCESS
--------------------------------------
Is there a way to know which host name troubles import ? (as there are a lot of hosts in my file)

Thanks !

Re: PHP Notice on import

Posted: Wed Oct 17, 2018 12:58 pm
by cdienger
Feel free to PM me and @Nagios Support a copy of the xi_tpl_host.cfg and we can take a look into this.

Re: PHP Notice on import

Posted: Thu Oct 18, 2018 3:45 am
by sigmainformatique
cdienger wrote:Feel free to PM me and @Nagios Support a copy of the xi_tpl_host.cfg and we can take a look into this.
Thanks ! File Sent.

Re: PHP Notice on import

Posted: Thu Oct 18, 2018 2:56 pm
by cdienger
This file contains a lot of invalid host entries. host_name is one of the requirements for a valid host definition(https://assets.nagios.com/downloads/nag ... .html#host) and none of them have this.

That said, it looks like whatever generated this config file had issues creating it. I would probably be best to skip importing this config file and manually and just manually create the host in XI.

Re: PHP Notice on import

Posted: Mon Oct 22, 2018 5:48 am
by sigmainformatique
Hello,

These are no host definitions... If this was the case, there would be a lot of errors, not a few, and not PHP Notice..

These are host templates conf, as defined in this page :
https://assets.nagios.com/downloads/nag ... tance.html
(every "host" is set with "register 0") and used later in our import.

Are "host_name" still mandatory ?

Regards,

Julien

Re: PHP Notice on import

Posted: Mon Oct 22, 2018 1:14 pm
by cdienger
Thanks for the extra info. The 'use' option defined on many of the definitions makes it so host_name isn't always needed. I did miss that before.

That said, I'd like to get a copy of the import directory as well as all the steps you took to produce the error so we can try and reproduce it here. Please also verify which version of XI you are attempting to import the files to.

Re: PHP Notice on import

Posted: Fri Oct 26, 2018 4:06 am
by sigmainformatique
Well... The problem is, that there is a lot of files before..

not exactly convenient... ;-)

Re: PHP Notice on import

Posted: Fri Oct 26, 2018 11:26 am
by cdienger
I followed up with senior tech regarding this and notices will not impact anything and can be ignored. You can disable notices by editing the /etc/php.ini file and adding/change the error_reporting line like so:

error_reporting = E_ALL & ~E_DEPRECATED

hopefully that's a little more convenient :)