Page 1 of 2
Error: Service has no hosts and/or service_description
Posted: Tue Nov 29, 2016 10:53 am
by valmberg
Please see the post I submitted in the General Forum:
https://support.nagios.com/forum/viewto ... =6&t=41298
I'm still getting the "Error: Service has no hosts and/or service_description..." error.
thanks
Re: Error: Service has no hosts and/or service_description
Posted: Tue Nov 29, 2016 1:52 pm
by dwhitfield
Neither
/usr/local/nagios/etc/services/Tilsdcprd1.cfg nor
/usr/local/nagios/etc/services/Censdcprd1.cfg exist. There's no reference to Censdcprd1.cfg or Tilsdcprd1.cfg anywhere in your profile.
Back up your services and hosts, and then let's try:
Code: Select all
rm -f /usr/local/nagios/etc/hosts/*.*
rm -f /usr/local/nagios/etc/services/*.*
cd /usr/local/nagiosxi/scripts/
./reconfigure_nagios.sh
Please let us know if that resolves your issue.
Re: Error: Service has no hosts and/or service_description
Posted: Tue Nov 29, 2016 2:25 pm
by valmberg
I went ahead and ran the commands as you suggested. The output is below. It still reported an error "Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/Cenvapprd51.oya.ad.cfg', starting on line 16)"
The issue seems to be with changing any of the services in Nagios since the upgrade. The host_name doesn't get added in the service.cfg file.
Here is the service after I made a minor change. Note that the host_name is missing. This happens with
ALL of the services - if i make any change at all! EXCEPT, if I remove the hostname in the gui and put in the '*'. Then it works just fine - but runs that service against all of the hosts - not what I desire.
Code: Select all
define service {
service_description Cenvapprd51 URL Status
use xiwizard_website__service
check_command check_xi_service_! -f ok -I 10.x.x.52 -u '/' -p 80!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
notification_interval 60
notification_period xi_timeperiod_24x7
notifications_enabled 1
contacts bilobro,harrisj,sandert
_xiwizard websiteurl
register 1
}
======================================================================================================================================================
Here is the output of the commands you requested I run:
Code: Select all
Package perl-Test-Simple-0.92-141.el6_7.1.x86_64 already installed and latest version
Package perl-Class-Accessor-0.31-6.1.el6.noarch already installed and latest version
Package perl-Params-Validate-0.92-3.el6.x86_64 already installed and latest version
Package perl-Config-Tiny-2.12-7.1.el6.noarch already installed and latest version
Package perl-Math-Calc-Units-1.07-6.el6.noarch already installed and latest version
Package perl-Number-Format-1.73-3.el6.noarch already installed and latest version
Nothing to do
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.stjschools.org
* epel: mirrors.xmission.com
* extras: repo1.sea.innoscale.net
* updates: repo1.sea.innoscale.net
Setting up Install Process
Package php-pecl-ssh2-0.11.0-7.el6.x86_64 already installed and latest version
Nothing to do
no crontab for nagios
no crontab for root
Copying over new XI directory...
Updating NagiosQL...
NAGIOSQL-POST
Patching NDOUtils...
NDOUtils already patched at level 103
Updating sequences...
Nagios XI Postgres Database Sequence Information
OLD VALUES
--------------
xi_commands_command_id_seq = 2020
xi_events_event_id_seq = 444165
xi_meta_meta_id_seq = 442391
xi_options_option_id_seq = 191
xi_sysstat_sysstat_id_seq = 101
xi_usermeta_usermeta_id_seq = 1117
xi_users_user_id_seq = 64
NEW VALUES
--------------
xi_commands_command_id_seq = 2020
xi_events_event_id_seq = 444165
xi_meta_meta_id_seq = 442391
xi_options_option_id_seq = 191
xi_sysstat_sysstat_id_seq = 101
xi_usermeta_usermeta_id_seq = 1117
xi_users_user_id_seq = 64
Installing new PNP templates...
Updating init script...
Enabling large install tweaks...
Fixing config file permissions...
Fixing htpasswd permissions...
Checking group memberships...
Installing new XI templates...
URL:
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies ://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&backend=1&username=nagiosxi&password=sspk4g' -O nagiosql.login--2016-11-23 13:21:32-- ://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ânagiosql.loginâ
[ <=> ] 36,230 --.-K/s in 0.01s
2016-11-23 13:21:32 (2.86 MB/s) - ânagiosql.loginâ
LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL:
Array
(
[0] => xi_timeperiod_24x7.cfg
)
IMPORTING /usr/local/nagios/etc/import/xi_timeperiod_24x7.cfg
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies ://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'backend=1&cmd=admin&type=import&importsubmitted=true&chbOverwrite=1&subForm=Import&selImportFile[]=/usr/local/nagios/etc/import/xi_timeperiod_24x7.cfg' -O nagiosql.import.monitoring
--2016-11-23 13:21:32-- ://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ânagiosql.import.monitoringâ
[ <=> ] 41,868 --.-K/s in 0.01s
2016-11-23 13:21:32 (3.40 MB/s) - ânagiosql.import.monitoringâ
RESETTING PERMS
URL:
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies ://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&backend=1&username=nagiosxi&password=sspk4g' -O nagiosql.login--2016-11-23 13:21:33-- ://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ânagiosql.loginâ
[ <=> ] 36,230 --.-K/s in 0.01s
2016-11-23 13:21:33 (2.60 MB/s) - ânagiosql.loginâ
LOGIN SUCCESSFUL!
URL:
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies ://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'backend=1&cmd=apply&type=writeConfig' -O nagiosql.export.monitoring
--2016-11-23 13:21:33-- ://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ânagiosql.export.monitoringâ
[ <=> ] 21,721 --.-K/s in 0.01s
2016-11-23 13:21:33 (1.93 MB/s) - ânagiosql.export.monitoringâ
WRITE CONFIGS SUCCESSFUL!
OUTPUT:
Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL
Website: s://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Checked 170 services.
Warning: Host 'UAG' has no default contacts or contactgroups defined!
Checked 100 hosts.
Checked 8 host groups.
Checked 9 service groups.
Checked 10 contacts.
Checked 5 contact groups.
Checked 127 commands.
Checked 16 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 100 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 16 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 1
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
RET: 0
Running configuration check...
Stopping nagios:. done.
Starting nagios: done.
Fixing php-mcrypt bug...
Stopping d: [ OK ]
Starting d: [ OK ]
Nagios XI Upgrade Complete!
---------------------------
You can access the Nagios XI web interface by visiting:
://10.61.61.90/nagiosxi/
[root@nagios nagiosxi]#
You have new mail in /var/spool/mail/root
[root@nagios nagiosxi]#
[root@nagios nagiosxi]#
[root@nagios nagiosxi]# rm -f /usr/local/nagios/etc/hosts/*.*
[root@nagios nagiosxi]# rm -f /usr/local/nagios/etc/services/*.*
[root@nagios nagiosxi]# cd /usr/local/nagiosxi/scripts/
[root@nagios scripts]# ./reconfigure_nagios.sh
URL:
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies ://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&backend=1&username=nagiosxi&password=sspk4g' -O nagiosql.login--2016-11-29 11:08:42-- ://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ânagiosql.loginâ
[ <=> ] 36,238 --.-K/s in 0.01s
2016-11-29 11:08:42 (3.34 MB/s) - ânagiosql.loginâ
LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL: ://localhost/nagiosxi/includes/components/ccm/
Array
(
)
RESETTING PERMS
URL:
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies ://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&backend=1&username=nagiosxi&password=sspk4g' -O nagiosql.login--2016-11-29 11:08:42-- ://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ânagiosql.loginâ
[ <=> ] 36,238 --.-K/s in 0.01s
2016-11-29 11:08:43 (3.14 MB/s) - ânagiosql.loginâ
LOGIN SUCCESSFUL!
URL:
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies ://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'backend=1&cmd=apply&type=writeConfig' -O nagiosql.export.monitoring
--2016-11-29 11:08:43-- ://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ânagiosql.export.monitoringâ
[ <=> ] 32,886 --.-K/s in 0.01s
2016-11-29 11:08:44 (3.06 MB/s) - ânagiosql.export.monitoringâ
WRITE CONFIGS SUCCESSFUL!
OUTPUT:
Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL
Website: s://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/Cenvapprd51.oya.ad.cfg', starting on line 16)
Error processing object config files!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
RET: 1
/usr/local/nagiosxi/nom/checkpoints/nagioscore/errors /usr/local/nagiosxi/scripts
tar: Removing leading `/' from member names
/usr/local/nagiosxi/scripts
LATEST NOM SNAPSHOT: /usr/local/nagiosxi/nom/checkpoints/nagioscore/1480433232.tar.gz
/ /usr/local/nagiosxi/scripts
RESTORING NOM SNAPSHOT : /usr/local/nagiosxi/nom/checkpoints/nagioscore/1480433232.tar.gz
/usr/local/nagiosxi/scripts
RESETTING PERMS
Re: Error: Service has no hosts and/or service_description
Posted: Tue Nov 29, 2016 2:47 pm
by dwhitfield
This first part is going to sound familiar, but stay with me. Please go to XI > Configure > CCM > Configuration Snapshots > and find the most recent entry with "Config Ok". Click the Restore button for that line. Restore the snapshot then apply the configuration.
Make your change. Presumably, the error will show up. Send a screenshot of any errors you get in the GUI.
Either way on the GUI error, download the failed configuration (it's the first option under "Actions"), and either post it here or PM it to me. If you PM it to me, please update this post. Updating the post is the only way for it to show back up on our dashboard.
Thanks!
Re: Error: Service has no hosts and/or service_description
Posted: Tue Nov 29, 2016 2:56 pm
by valmberg
I am pasting 3 screenshots. The last one is an SQL error I get "Table 'nagiosql.tbl_session_locks' doesn't exist. I'm not sure if that has anything to do with what is occurring.
thanks
Re: Error: Service has no hosts and/or service_description
Posted: Tue Nov 29, 2016 4:10 pm
by dwhitfield
First, login to your Nagios XI server as the root user.
Next, stop the MySQL database server with the following command:
Run the Nagios XI database repair script with the following command:
Code: Select all
/usr/local/nagiosxi/scripts/repairmysql.sh nagios
The script will check and repair all tables in the nagios MySQL database. This process may take several minutes to complete, depending on the size of your database.
Once the script has completed, start the MySQL database server with the following command:
As for the services issue, I never did get the snapshot. Could you PM that too me and then post in the thread? Thanks!
UPDATE: snapshot received and shared with techs
Re: Error: Service has no hosts and/or service_description
Posted: Wed Nov 30, 2016 12:41 pm
by valmberg
I have run through the DB repair as you suggested. still getting the SQL Error [nagiosql] : Table 'nagiosql.tbl_session_locks' doesn't exist message.
I have PM'd you the configuration file.
Thanks for all your help.
Re: Error: Service has no hosts and/or service_description
Posted: Wed Nov 30, 2016 5:03 pm
by avandemore
Please try this instead:
Code: Select all
# /usr/local/nagiosxi/scripts/repair_databases.sh
Re: Error: Service has no hosts and/or service_description
Posted: Wed Nov 30, 2016 5:11 pm
by valmberg
I ran the command /usr/local/nagiosxi/scripts/repair_databases.sh
The script reported the repair complete:
===============
REPAIR COMPLETE
===============
Stopping ndo2db: done.
Starting ndo2db: done.
Running configuration check...
Stopping nagios:. done.
Starting nagios: done.
=======================
nagios database repair succeeded
nagiosql database repair succeeded
Went into the GUI and changed a service (from inactive to active) and then applied the configuration (at the bottom of the services list). Received the "Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/Cenvapprd51.oya.ad.cfg', starting on line 16)" error message still.
Also, if I use the Apply Configuration under Quick Tools, I still get "SQL Error [nagiosql] : Table 'nagiosql.tbl_session_locks' doesn't exist"
Re: Error: Service has no hosts and/or service_description
Posted: Wed Nov 30, 2016 5:15 pm
by avandemore
As far as your configuration error the Apply Configuration error output is correct.
The service in question has no host_name defined. host_name is a required field.
Are you using
Manage Hosts or
Manage Host Groups? Judging from the service defintion it doesn't appear to be the case. Select a host or host group using one or more of those methods and your configuration for that service will be valid.
See this:
https://assets.nagios.com/downloads/nag ... ml#service
https://support.nagios.com/kb/article.php?id=539