Page 1 of 2

NAGIOS XI new install issue

Posted: Fri Nov 14, 2014 10:50 am
by waynescoffee
Hi
I installed nagios XI but I’m having trouble bringing it up.
I saw the monitoring engine not running with an error when I hovered the mouse on the ! mark :
No lock file found in /usr/local/nagios/var/nagios.lock
And the performance grapher not running is due to NPCD not running.


I did some googling and saw a few things that I tried with no success in bringing the monitoring application on

Here's the error when I looked at the status or tried to start nagios service from CLI
[root@localhost etc]# service nagios start
Starting nagios:CONFIG ERROR! Start aborted. Check your Nagios configuration.
[root@localhost etc]# service nagios status
No lock file found in /usr/local/nagios/var/nagios.lock

I checked and tried to locate/find the missing lock file and config file but could not. I tried to look into the installation log file for the config file name but could not find it there. Does anyone have experience with fixing this issue. Thank you in advance for your help

[root@localhost etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Cannot open config file '/usr/local/nagios/etc/contacttemplates.cfg' for reading: No such file or directory
Error processing object config files!

Re: NAGIOS XI new install issue

Posted: Fri Nov 14, 2014 11:41 am
by abrist
What files exist in the following directory:

Code: Select all

ls -la /usr/local/nagios/etc/
Try removing and re-writing all the configs. Go to --> Configure --> Core Config Manager --> Write Config Files --> Click "Delete" and then "Write" and then "Verify". Post any errors.

Re: NAGIOS XI new install issue

Posted: Fri Nov 14, 2014 11:58 am
by waynescoffee
Hi Abrist,
Thanks for responding.


After clicking on delete:
Successfully deleted all Host / Service Config Files


After clicking on Write :
Write host configurations ...
Host configuration files successfully written!

Write service configurations ...
Service configuration files successfully written!

Configuration file: hostgroups.cfg successfully written!
Configuration file: servicegroups.cfg successfully written!
Configuration file: hosttemplates.cfg successfully written!
Configuration file: servicetemplates.cfg successfully written!
Configuration file: timeperiods.cfg successfully written!
Configuration file: commands.cfg successfully written!
Configuration file: contacts.cfg successfully written!
Configuration file: contactgroups.cfg successfully written!
Configuration file: contacttemplates.cfg successfully written!
Configuration file: servicedependencies.cfg successfully written!
Configuration file: hostdependencies.cfg successfully written!
Configuration file: serviceescalations.cfg successfully written!
Configuration file: hostescalations.cfg successfully written!
Configuration file: serviceextinfo.cfg successfully written!
Configuration file: hostextinfo.cfg successfully written!

After clicking on Verify :


Error: There are no services defined!
Error: There are no hosts defined!
Error: Service notification command 'xi_service_notification_handler' specified for contact 'xi_default_contact' is not defined anywhere!
Error: Host notification command 'xi_host_notification_handler' specified for contact 'xi_default_contact' is not defined anywhere!
Error: Global host event handler command 'xi_host_event_handler' is not defined anywhere!
Error: Global service event handler command 'xi_service_event_handler' is not defined anywhere!

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://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...
Error: There are no services defined!
Checked 0 services.
Error: There are no hosts defined!
Checked 0 hosts.
Checked 0 host groups.
Checked 0 service groups.
Error: Service notification command 'xi_service_notification_handler' specified for contact 'xi_default_contact' is not defined anywhere!
Error: Host notification command 'xi_host_notification_handler' specified for contact 'xi_default_contact' is not defined anywhere!
Checked 1 contacts.
Checked 0 contact groups.
Checked 0 commands.
Checked 1 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 0 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 1 timeperiods
Checking global event handlers...
Error: Global host event handler command 'xi_host_event_handler' is not defined anywhere!
Error: Global service event handler command 'xi_service_event_handler' is not defined anywhere!
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 6

***> One or more problems was encountered while running the pre-flight check...

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.


I guess I need to define these :


Error: There are no services defined!
Error: There are no hosts defined!
Error: Service notification command 'xi_service_notification_handler' specified for contact 'xi_default_contact' is not defined anywhere!
Error: Host notification command 'xi_host_notification_handler' specified for contact 'xi_default_contact' is not defined anywhere!
Error: Global host event handler command 'xi_host_event_handler' is not defined anywhere!
Error: Global service event handler command 'xi_service_event_handler' is not defined anywhere!

Re: NAGIOS XI new install issue

Posted: Fri Nov 14, 2014 1:24 pm
by abrist
waynescoffee wrote:Error: There are no services defined!
Error: There are no hosts defined!
Error: Service notification command 'xi_service_notification_handler' specified for contact 'xi_default_contact' is not defined anywhere!
Error: Host notification command 'xi_host_notification_handler' specified for contact 'xi_default_contact' is not defined anywhere!
Error: Global host event handler command 'xi_host_event_handler' is not defined anywhere!
Error: Global service event handler command 'xi_service_event_handler' is not defined anywhere!
Did you remove any commands from the ccm?
Did you remove and files from the static directory?

Re: NAGIOS XI new install issue

Posted: Fri Nov 14, 2014 2:16 pm
by waynescoffee
No. Not that I know of. I did not manually remove any of those.
When I tried to add host from CCM, Monitoring, Hosts, Add New, I got the following message:

Could complete the query because:

The query being run was: SELECT * FROM `tbl_command` WHERE `command_type`=2 ORDER BY `command_name`

Re: NAGIOS XI new install issue

Posted: Fri Nov 14, 2014 2:25 pm
by waynescoffee
I also saw a red star next to the apply configuration link on CCM menu and when I hovered the mouse on the link I saw the following message:
There are modifications to object that have not been applied yet. Apply configuration for the new changes to take effect.

And when I clicked on apply I saw these:

Applying Configuration

Command submitted for processing...
Waiting for configuration verification....
Backend login to the Core Config Manager failed.

An error occurred while attempting to apply your configuration to Nagios Core. Monitoring engine configuration files have been rolled back to their last known good checkpoint.

View a snapshot of this configuration error

Re: NAGIOS XI new install issue

Posted: Fri Nov 14, 2014 5:26 pm
by waynescoffee
I found out from WIKI NAGIOS Support about the script restore_default.sh. When I tried to run the script I found out there was an issue with the MySQL root password. So after I fixed the MySQL root issue, I deleted and write the configuration files again and this time I got a new error during the verification:

Error: Failed to locate check_period 'xi_timeperiod_24x7' for host 'www.google.com'!
Error: Could not register host (config file '/usr/local/nagios/etc/hosts/www.google.com.cfg', starting on line 16)

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in host type objects (config file '/usr/local/nagios/etc/hosttemplates.cfg', starting at line 16)
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in host type objects (config file '/usr/local/nagios/etc/hosttemplates.cfg', starting at line 121)
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in service type objects (config file '/usr/local/nagios/etc/servicetemplates.cfg', starting at line 16)
Warning: failure_prediction_enabled is obsoleted and no longer has any effect in service type objects (config file '/usr/local/nagios/etc/servicetemplates.cfg', starting at line 97)
Error: Failed to locate check_period 'xi_timeperiod_24x7' for host 'www.google.com'!
Error: Could not register host (config file '/usr/local/nagios/etc/hosts/www.google.com.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.

Re: NAGIOS XI new install issue

Posted: Fri Nov 14, 2014 9:36 pm
by Box293
Try this:

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

Re: NAGIOS XI new install issue

Posted: Mon Nov 17, 2014 10:40 am
by waynescoffee
Hi I tried running the script after removing those files you mentioned but got the following error below
Proxy request sent, awaiting response... 403 Forbidden
2014-11-17 01:36:15 ERROR 403: Forbidden.
NAGIOSQL LOGIN FAILED!

I noticed the script calls import_nagiosql.sh which in turn calls nagiosql_login.php. This php script uses
../html/config.inc.php
And I checked the password in that file and tried manual msyql nagiosql login and it works. So it does not look like a password issue for nagiosql.
mysql -h localhost -u nagiosql -pxxx

But I found out that the following MySQL nagiosxi login default password as shown in the confic.inc.php does not work:
# mysql -h localhost -u nagiosxi -pn@gweb
ERROR 1045 (28000): Access denied for user 'nagiosxi'@'localhost' (using password: YES)


I checked the mysql user table and did not see nagiosxi user in there.


mysql> select User from user;
+----------+
| User |
+----------+
| root |
| |
| nagiosql |
| ndoutils |
| root |
| |
| root |
+----------+
7 rows in set (0.00 sec)

mysql>

I also do not see nagiosxi database in MySQL:

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| nagios |
| nagiosql |
| test |
+--------------------+
5 rows in set (0.00 sec)

mysql>

This might explain why I had problem adding the missing host the other day
When I tried to add host from CCM, Monitoring, Hosts, Add New, I got the following message:
Could complete the query because:
The query being run was: SELECT * FROM `tbl_command` WHERE `command_type`=2 ORDER BY `command_name`

What's the best way to fix this issue? Uninstall and Reinstall? Is there a quick way to recreate the missing DB?
To prevent another issue when reinstalling, what kind of prechecks related to MySQL and other things should I do first prior to reinstallation ?




=========================================
Output of the script execution. I masked the IP address/hostname with xxx

./reconfigure_nagios.sh
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&username=nagiosxi&password=emm7ri' -O nagiosql.login--2014-11-17 01:36:14-- http://localhost/nagiosxi/includes/components/ccm/
Resolving www-xxx.xxx ... xxx.xxx.xxx.xxx
Connecting to www-xxx.xxx. ...xxx.xxx.xxx.xxx|:8080... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: http://xxx.xxx.xxx.xxx [following]
--2014-11-17 01:36:14-- http://xxx.xxx.xxx.xxx/
Connecting to www-xxx.xxx |xxx.xxx.xxx.xxx|:8080... connected.
Proxy request sent, awaiting response... 403 Forbidden
2014-11-17 01:36:15 ERROR 403: Forbidden.

NAGIOSQL LOGIN FAILED!

----------------------------------------

I tried manually running the following command:
# /usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data 'submit=Login&hidelog=true&loginSubmitted=true&username=nagiosxi&password=n@gweb' -O nagiosql.login

and the output shows:
--2014-11-17 03:14:11-- http://localhost/nagiosxi/includes/components/ccm/
Resolving www-xxx.xxx.xxx. xxx.xxx.xxx.xxx
Connecting to www-xxx.xxx.xxx|xxx.xxx.xxx.xxx|:8080... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: http://xxx.xxx.xxx.xxx [following]
--2014-11-17 03:14:11-- http://xxx.xxx.xxx.xxx/
Connecting to www-xxx.xxx.xxx | xxx.xxx.xxx.xxx |:8080... connected.
Proxy request sent, awaiting response... 403 Forbidden
2014-11-17 03:14:11 ERROR 403: Forbidden.




#cat /usr/local/nagios/var/objects.cache | sed -rn "/define host \{/{:a;N;/}/{/.host_name.localhost/p;d};ba}"
cat: /usr/local/nagios/var/objects.cache: No such file or directory
#ls -ltr /usr/local/nagios/var/objects.cache
ls: cannot access /usr/local/nagios/var/objects.cache: No such file or directory
#ls -ltr /usr/local/nagios/var/
total 20
drwxrwxr-x. 2 nagios nagios 4096 Nov 11 09:30 archives
drwxrwsr-x. 2 nagios nagcmd 4096 Nov 11 09:30 rw
drwxr-xr-x. 5 nagios nagios 4096 Nov 11 09:30 spool
drwxr-xr-x. 2 nagios nagios 4096 Nov 11 09:32 stats
-rw-r--r--. 1 nagios nagios 0 Nov 12 08:54 nagios.log
srwxr-xr-x. 1 nagios nagios 0 Nov 13 06:47 ndo.sock
-rw-r--r--. 1 nagios nagios 6 Nov 13 06:47 ndo2db.lock
#

Re: NAGIOS XI new install issue

Posted: Mon Nov 17, 2014 12:29 pm
by lmiltchev
Did you set up your proxy according to our recommendations as described here?