PHP Notice on import

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sigmainformatique
Posts: 74
Joined: Mon Apr 23, 2018 8:11 am

PHP Notice on import

Post 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 !
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: PHP Notice on import

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sigmainformatique
Posts: 74
Joined: Mon Apr 23, 2018 8:11 am

Re: PHP Notice on import

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: PHP Notice on import

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sigmainformatique
Posts: 74
Joined: Mon Apr 23, 2018 8:11 am

Re: PHP Notice on import

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: PHP Notice on import

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
sigmainformatique
Posts: 74
Joined: Mon Apr 23, 2018 8:11 am

Re: PHP Notice on import

Post by sigmainformatique »

Well... The problem is, that there is a lot of files before..

not exactly convenient... ;-)
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: PHP Notice on import

Post 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 :)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked