Page 1 of 2

Missing host_name in service.cfg after update - riccardo

Posted: Thu Oct 05, 2017 10:02 am
by riccardo.spisa
Moderator Edit: This thread has been split from another - https://support.nagios.com/forum/viewto ... =6&t=45870
In the future, please create a new thread and link to the old one instead of adding on.


hi all,
I have the same problem.
Actually, I'm stuck in an obsolete version for several months.

Thanks
R.S.

Re: Missing host_name in service.cfg after update - riccardo

Posted: Thu Oct 05, 2017 10:04 am
by kyang
@riccardo.spisa

Could you try repeating the same process and see if it's a different error message? or the same?

When you clicked verify, did it succeed?

What version of XI are you on? Did you do an upgrade?

Re: Missing host_name in service.cfg after update - riccardo

Posted: Thu Oct 05, 2017 10:19 am
by riccardo.spisa
Hi,
same error, same version.

I also try to execute a new OVF deploy, I ran the export by command "scripts/backup_xi.sh" and then imported in a new appliance with the command "restore_xi.sh </full/path/to/backupfile.tar.gz>.

Unfortunately, in the new appliance, the same error occurred again.

R.S.

Re: Missing host_name in service.cfg after update - riccardo

Posted: Thu Oct 05, 2017 3:32 pm
by dwhitfield
The original post said this happened after upgrade from 5.2.9 to 5.4.9. Is that the same situation you are in?

Can you PM me your Profile? You can download it by going to Admin > System Config > System Profile and click the ***Download Profile*** button towards the top. If for whatever reason you *cannot* download the profile, please put the output of View System Info (5.3.4+, Show Profile if older) in the thread (that will at least get us some info). This will give us access to many of the logs we would otherwise ask for individually. If security is a concern, you can unzip the profile take out what you like, and then zip it up again. We may end up needing something you remove, but we can ask for that specifically.

You can also generate a profile manually using the script at /usr/local/nagiosxi/html/includes/components/profile/getprofile.sh

That should generate a profile in /usr/local/nagiosxi/var/components/ which you can get off the server with an application such as FileZilla.

After you PM the profile, please update this thread. Updating this thread is the only way for it to show back up on our dashboard.

If you get an error that PROFILE BUILD FAILED, please see https://support.nagios.com/kb/article.p ... ategory=44

UPDATE: Profile received and shared with techs

Re: Missing host_name in service.cfg after update - riccardo

Posted: Fri Oct 06, 2017 6:46 am
by riccardo.spisa
hi,
I sent the profile as required.

Thanks

Re: Missing host_name in service.cfg after update - riccardo

Posted: Fri Oct 06, 2017 3:03 pm
by tgriep
Can you post the full error message here so we can check the profile for any configuration errors?

Re: Missing host_name in service.cfg after update - riccardo

Posted: Fri Oct 13, 2017 9:04 am
by riccardo.spisa
Hi,

Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/hostname1.cfg', starting on line 88)

If i delete hostname1.cfg configuration the error move down to the next hostname*.cfg

When i commit, the internel process remove the field "hostname" from any service file configuration.

Thanks

Re: Missing host_name in service.cfg after update - riccardo

Posted: Fri Oct 13, 2017 2:00 pm
by dwhitfield
What XI version are you using (this will be useful for anyone without your profile)? From what did you upgrade (this never got answered)?

Go to Configure -> Core Config Manager, then on the left under Tools click Config File Management. Then if you have all these options, click Delete, then Write, then Verify and post a screenshot.

Re: Missing host_name in service.cfg after update - riccardo

Posted: Fri Oct 13, 2017 2:00 pm
by tgriep
Do you know if the MYSQL server that Nagios uses has either been offloaded to a remote server or upgraded recently?
If it has been upgraded, do you know what version?
Can you also post the following files so we can review them?

Code: Select all

/use/local/nagiosxi/html/config.inc.php
/etc/my.cnf
and all of the files in this folder if they exist

Code: Select all

/etc/my.cnf.d
Thanks

Re: Missing host_name in service.cfg after update - riccardo

Posted: Thu Oct 19, 2017 7:13 am
by riccardo.spisa
HI,
folder /etc/my.cnf.d does not exist.

Latest Available Version: 5.4.10
Installed Version: 5.2.9

The update is executed correctly but later it becomes impossible to edit the services.

Every time we try to run the commit, the "host_name" attribute is deleted from the configuration files (for each service of each host).

I've already tried this: https://support.nagios.com/kb/article.php?id=144

I also tried installing a new system and migrating the database, so the problem was still in the new version.

Code: Select all

[root@lnxnagiosxi ~]# cat /usr/local/nagiosxi/html/config.inc.php
<?php
//
// Copyright (c) 2008-2010 Nagios Enterprises, LLC.  All rights reserved.
//
// $Id: config.inc.php 202 2010-07-13 21:22:57Z egalstad $

// base url
$cfg['base_url']="/nagiosxi";  // do not include http(s) or host name - this is the base from "http://localhost"

// base root directory where XI is installed
$cfg['root_dir']="/usr/local/nagiosxi";

// directory where scripts are installed
$cfg['script_dir']="/usr/local/nagiosxi/scripts";

$cfg['xidpe_dir'] = '/usr/local/nagios/var/spool/xidpe/';
$cfg['perfdata_spool'] = '/usr/local/nagios/var/spool/perfdata/';

// nom checkpoints
$cfg['nom_checkpoints_dir']="/usr/local/nagiosxi/nom/checkpoints/nagioscore/";

// force http/https
$cfg['use_https']=false;  // determines whether cron jobs and other scripts will force the use of HTTPS instead of HTTP

// allow for different http port for subsystem calls
$cfg['port_number'] = false;

// default server, db, connection settings
$cfg['dbtype']=''; // this setting is no longer used - use settings below
$cfg['dbserver']='localhost'; // this setting is no longer used - use settings below

// db-specific connection information
$cfg['db_info']=array(
        "nagiosxi" => array(
                "dbtype" => 'pgsql',
                "dbserver" => '',
                "user" => 'nagiosxi',
                "pwd" => 'n@gweb',
                "db" => 'nagiosxi',
                "dbmaint" => array(             // variables affecting maintenance of db
                        "max_auditlog_age" => 30, // max time (in DAYS) to keep audit log entries
                        "max_commands_age" => 480, // max time (minutes) to keep commands
                        "max_events_age" => 480, // max time (minutes) to keep events
                        "optimize_interval" => 60, // time (in minutes) between db optimization runs
                        "repair_interval" => 0, // time (in minutes) between db repair runs
                        ),
                ),
        "ndoutils" => array(
                "dbtype" => 'mysql',
                "dbserver" => 'localhost',
                "user" => 'ndoutils',
                "pwd" => 'n@gweb',
                "db" => 'nagios',
                "dbmaint" => array(             // variables affecting maintenance of ndoutils db

                        "max_externalcommands_age" => 7, // max time (in DAYS) to keep external commands
                        "max_logentries_age" => 90, // max time (in DAYS) to keep log entries
                        "max_statehistory_age" => 730, // max time (in DAYS) to keep state history information
                        "max_notifications_age" => 90, // max time (in DAYS) to keep notifications
                        "max_timedevents_age" => 5, // max time (minutes) to keep timed events
                        "max_systemcommands_age" => 5, // max time (minutes) to keep system commands
                        "max_servicechecks_age" => 5, // max time (minutes) to keep service checks
                        "max_hostchecks_age" => 5, // max time (minutes) to keep host checks
                        "max_eventhandlers_age" => 5, // max time (minutes) to keep event handlers
                        "optimize_interval" => 60, // time (in minutes) between db optimization runs
                        "repair_interval" => 0, // time (in minutes) between db repair runs
                        ),
                ),
        "nagiosql" => array(
                "dbtype" => 'mysql',
                "dbserver" => 'localhost',
                "user" => 'nagiosql',
                "pwd" => 'n@gweb',
                "db" => 'nagiosql',
                "dbmaint" => array(             // variables affecting maintenance of db
                        "max_logbook_age" => 480, // max time (minutes) to keep log book records
                        "optimize_interval" => 60, // time (in minutes) between db optimization runs
                        "repair_interval" => 0, // time (in minutes) between db repair runs
                        ),
                ),
        );

// db-specific table prefixes
$cfg['db_prefix']=array(
        "ndoutils" => "nagios_",    // prefix for NDOUtils tables
        "nagiosxi" => "xi_",            // prefix for XI tables
        "nagiosql" => "tbl_",           // prefix for NagiosQL tables
        );

// component info
$cfg['component_info']=array(
        "nagioscore" => array(
                "cgi_dir" => "/usr/local/nagios/sbin",
                "import_dir" => "/usr/local/nagios/etc/import",
                "plugin_dir" => "/usr/local/nagios/libexec",
                "cgi_config_file" => "/usr/local/nagios/etc/cgi.cfg",
                "cmd_file" => "/usr/local/nagios/var/rw/nagios.cmd",
                "log_file" => "/usr/local/nagios/var/nagios.log",
                "nom_checkpoint_interval" => 1440, // time (in minutes) between nom checkpoints
                ),
        "pnp" => array(
                "perfdata_dir" => "/usr/local/nagios/share/perfdata",
                "share_dir" => "/usr/local/nagios/share/pnp",
                "direct_url" => "/nagios/pnp",
                "username" => 'nagiosxi', // don't change this!
                "password" => 'nagiosadmin', // this gets reset when security credentials are reset after installation
                ),
        "nagiosql" => array(
                "dir" => "/var/www/html/nagiosql",
                "direct_url" => "/nagiosql",
                "username" => 'nagiosxi', // don't change this!
                "password" => 'n@gweb',  // this gets reset when security credentials are reset after installation
                ),
        "nagvis" => array(
                "share_dir" => "/usr/local/nagios/share/nagvis",
                "direct_url" => "/nagios/nagvis",
                "username" => 'nagiosadmin', // don't change this!
                "password" => 'nagiosadmin', // this gets reset when security credentials are reset after installation
                ),
        );

$cfg['demo_mode']=false; // is this in demo mode

$cfg['dashlet_refresh_multiplier']=1000;  // milliseconds (1 second = 1000)

// REFRESH RATES FOR VARIOUS DASHLETS (IN SECONDS UNLESS THE MULTIPLIER IS CHANGED)
$cfg['dashlet_refresh_rates']=array(
        "available_updates" => 24*60*60,                 // 24 hours
        "systat_eventqueuechart" => 5,
        "sysstat_monitoringstats" => 30,
        "systat_monitoringperf" => 30,
        "sysstat_monitoringproc" => 30,
        "perfdata_chart" => 60,                                 // performance graphs
        "network_outages" => 30,
        "host_status_summary" => 60,
        "service_status_summary" => 60,
        "hostgroup_status_overview" => 60,
        "hostgroup_status_grid" => 60,
        "servicegroup_status_overview" => 60,
        "servicegroup_status_grid" => 60,
        "hostgroup_status_summary" => 60,
        "servicegroup_status_summary" => 60,
        "sysstat_componentstates" => 7,
        "sysstat_serverstats" => 5,
        "network_outages_summary" => 30,
        "network_health" => 30,
        "host_status_tac_summary" => 30,
        "service_status_tac_summary" => 30,
        "feature_status_tac_summary" => 30,
        "admin_tasks" => 60,
        "getting_started" => 60,
        "pagetop_alert_content" => 30,          // not a dashlet yet, sits in page header
        "tray_alert" => 30, // sites in page footer
        );


// MEMCACHED SETUP
$cfg['memcached_enable']=false; // should we use memcached or not?
$cfg['memcached_hosts']=array('127.0.0.1','192.168.1.3');  // one or more memcached servers
$cfg['memcached_port']=11211;  // default memcached port
$cfg['memcached_compress']=false;  // use true to store items compressed
$cfg['memcached_ttl']=10; // max number of seconds data (from SELECT statements) should be cached


// HTTP BASIC AUTHENTICATION INFO -- USED BY SUBSYSTEM
$cfg['use_basic_authentication']=false; // is HTTP Basic authentication being used? if so, set the two variables below...
$cfg['subsystem_basic_auth_username']='nagiosxi'; // subsystem credentials
$cfg['subsystem_basic_auth_password']='somepassword';

$cfg['default_language']='en_US';       // default language
$cfg['default_theme']='';       // default theme

// available languages
$cfg['languages']=array(
        "en_US" => "English",
        );


/*********   DO NOT MODIFY ANYTHING BELOW THIS LINE   **********/

$cfg['default_instance_id']=1;  // default ndoutils instance to read from
$cfg['default_result_records']=100000;  // max number of records to return by default

$cfg['online_help_url']="http://support.nagios.com/"; // comment this out to disable online help links
$cfg['feedback_url']="http://api.nagios.com/feedback/";
$cfg['privacy_policy_url']="http://www.nagios.com/legal/privacypolicy/";

//$cfg['db_version']=101;
$cfg['db_version']=113;
//$cfg['product_version']='2009RC1';

$cfg['subsystem_ticket']="12345";  // default - this gets reset...

$cfg['htaccess_file']="/usr/local/nagiosxi/etc/htpasswd.users";
$cfg['htpasswd_path']="/usr/bin/htpasswd";

$cfg['enable_analytics']=1;

// Secure notification %responseurl%
// setting this to 1 will force users to login in the response URL
// $cfg['secure_response_url']=1;

// Globally disable in page help system
// $cfg['disable_helpsystem']=1;

///////// keep these in order /////////

// include generic db defs
require_once(dirname(__FILE__).'/includes/db.inc.php');

// include generic  definitions
require_once(dirname(__FILE__).'/db/common.inc.php');
// include db-specific definitions
//require_once(dirname(__FILE__).'/db/'.$cfg['dbtype'].'.inc.php');

?>
Thanks
Best Regards