Web interface for nagios


#1

Hi all,
I have installed and started nagios successfully and also done the right things for the apache web server. But when i try to browse from the web interface by typing in 127.0.0.1/nagios, i get this error,


Whoops!

Error: Could not read object configuration data!

Here are some things you should check in order to resolve this error:

  1. Verify configuration options using the -v command-line option to check for errors.
  2. Check the Nagios log file for messages relating to startup or status data errors.
  3. Make sure you’ve compiled the main program and the CGIs to use the same object data storage options (i.e. default text file or template-based file).

Make sure you read the documentation on installing, configuring and running Nagios thoroughly before continuing. If all else fails, try sending a message to one of the mailing lists. More information can be found at nagios.org.

This is happening only when i click anything under the Monitoring section. I can browse the Home and Documentation stuff but none of the statusmaps or details.
Please help, i am desperately trying for almost a week now.
Any help will be greately appreciated. I am also attaching a screenshot of the error.
:frowning:

Thanks,
MK


#2

i suppose the best thing would be to follow the advice the page gave you :slight_smile:

  1. Verify configuration options using the -v command-line option to check for errors.
  2. Check the Nagios log file for messages relating to startup or status data errors.
  3. Make sure you’ve compiled the main program and the CGIs to use the same object data storage options (i.e. default text file or template-based file).

and check you installed correctly following step by step the instructions in the docs.

Luca


#3

Most importantly as noted above, is -v.
-v is your friend, so use it whenever you make a config change or are having any kind of trouble.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Edited Fri May 20 2005, 07:32AM ]


#4

Hi All,
i appreciate your quick response.
I have followed the 3 steps given in the error. But still no luck.
I have used the -v command and my nagios configs did not return an error or warnings. Infact i have tested the ‘ping’ with a test machine and i got alerts from nagios as expected. It seems to work fine.
But for some reason just the maps and graphs show error. Do i need to install any software to display the images properly. I am using Redhat 9.0
I read somewhere about gd library. Can anyone give me more information about it.
Thanks, :slight_smile:


#5

Redhat huh? check your selinux settings.
And yes, gd lib is required and you should have seen a warning when you compiled nagios, that you did not have the gd lib or it couldn’t find it.


#6

I get the same error you have, when nagios is not even running.
So check again, and make sure it is up and running. Paste your proof please.
Edited Fri May 20 2005, 11:29AM ]


#7

Sir,
thanks for your reply.
i am attaching the pre check that nagios does by using the -v command. You will notice there are no errors or warnings.



#8

That does not show that nagios is running.
ps -ef|grep nagios

PS: you could also paste the text output, instead of a screencap of the screen, by highlighting the text in your shell, and pasting it here.

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

Nagios 1.2
Copyright © 1999-2004 Ethan Galstad (nagios@nagios.org)
Last Modified: 02-02-2004
License: GPL

Reading configuration data…

Running pre-flight check on configuration data…

Checking services…
Checked 1231 services.
Checking hosts…
Checked 308 hosts.
Checking host groups…
Checked 9 host groups.
Checking contacts…
Checked 21 contacts.
Checking contact groups…
Checked 11 contact groups.
Checking service escalations…
Checked 0 service escalations.
Checking host group escalations…
Checked 0 host group escalations.
Checking service dependencies…
Checked 0 service dependencies.
Checking host escalations…
Checked 0 host escalations.
Checking host dependencies…
Checked 0 host dependencies.
Checking commands…
Checked 36 commands.
Checking time periods…
Checked 5 time periods.
Checking for circular paths between hosts…
Checking for circular service execution dependencies…
Checking global event handlers…
Checking obsessive compulsive service processor command…
Checking misc settings…

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

[root@tia2665 libexec]# ps -ef|grep nagios
root 1691 1 0 May15 ? 00:01:04 gnome-terminal --sm-config-prefix /gnome-terminal-48DD05/ --sm-client-id 11ac100e1a000108837810100000161020006 --screen 0 --window-with-profile-internal-id=Default --show-menubar --role=gnome-terminal-2117–1183983675-1091220281 --active --title root@tia2665: /etc --working-directory /etc --zoom 1 --window-with-profile-internal-id=Default --show-menubar --role=gnome-terminal-2129–1639043355-1093724230 --active --title root@tia2665: /usr/local/system.scripts --working-directory /usr/local/system.scripts --zoom 1 --window-with-profile-internal-id=Default --show-menubar --role=gnome-terminal-2129-497806951-1093805489 --active --title root@tia2665: /usr/local/nagios/etc --working-directory /usr/local/nagios/etc --zoom 1
nagios 30684 1 1 15:29 ? 00:01:32 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19208 1 0 17:48 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19211 1 0 17:48 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19214 1 0 17:48 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19217 1 0 17:48 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19228 1 0 17:48 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19232 1 0 17:48 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19236 1 0 17:48 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19239 1 0 17:48 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19243 1 0 17:48 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios 19249 1 0 17:49 ? 00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root 19255 1750 0 17:49 pts/2 00:00:00 grep nagios
Edited Fri May 20 2005, 01:46PM ]


#9

Sir,
This is what i get,

[root@linuxbox root]# cd /usr/local/nagios/libexec
[root@linuxbox libexec]# /usr/local/nagios/bin/nagios -v /usr/local/etc/nagios.c
fg

Nagios 2.0b3
Copyright © 1999-2005 Ethan Galstad (www.nagios.org)
Last Modified: 04-03-2005
License: GPL

Reading configuration data…

Error: Cannot open main configuration file ‘/usr/local/etc/nagios.cfg’ for readi
ng!

***> 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.

[root@linuxbox libexec]# ps -ef|grep nagios
nagios 23957 1 0 17:15 ? 00:00:00 [nagios]
root 24421 24331 0 17:46 pts/0 00:00:00 grep nagios
[root@linuxbox libexec]#


#10

At the same time, if i do this, i dont get any errors.
Sorry, i am absolutely new to linux

[root@linuxbox etc]# …/bin/nagios -v nagios.cfg

Nagios 2.0b3
Copyright © 1999-2005 Ethan Galstad (www.nagios.org)
Last Modified: 04-03-2005
License: GPL

Reading configuration data…

Running pre-flight check on configuration data…

Checking services…
Checked 9 services.
Checking hosts…
Checked 7 hosts.
Checking host groups…
Checked 1 host groups.
Checking service groups…
Checked 0 service groups.
Checking contacts…
Checked 1 contacts.
Checking contact groups…
Checked 1 contact groups.
Checking service escalations…
Checked 0 service escalations.
Checking service dependencies…
Checked 0 service dependencies.
Checking host escalations…
Checked 0 host escalations.
Checking host dependencies…
Checked 0 host dependencies.
Checking commands…
Checked 22 commands.
Checking time periods…
Checked 4 time periods.
Checking extended host info definitions…
Checked 0 extended host info definitions.
Checking extended service info definitions…
Checked 0 extended service info definitions.
Checking for circular paths between hosts…
Checking for circular host and service dependencies…
Checking global event handlers…
Checking obsessive compulsive processor commands…
Checking misc settings…

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check[root@linuxbox etc]#


#11

/usr/local/nagios/bin/nagios -v /usr/local/etc/nagios.c
fg
That is the wrong path you used.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.c
fg
is the correct path to the config file.

But anyway, we still have not seen a
ps -ef|grep nagios
output from you, so that we know nagios is in fact running.


#12

Sir,
Here is the output,

[root@linuxbox root]# ps -ef|grep nagios
nagios 28283 1 0 14:20 ? 00:00:00 [nagios]
root 28291 28225 0 14:20 pts/0 00:00:00 grep nagios
[root@linuxbox root]#

Also i used the correct path and got the same results, no errors and no warnings.


#13

Sir,
here is the output of the command,

[root@linuxbox root]# ps -ef|grep nagios
nagios 28283 1 0 14:20 ? 00:00:00 [nagios]
root 28291 28225 0 14:20 pts/0 00:00:00 grep nagios
[root@linuxbox root]#


#14

It looks to me, that nagios is not running. Did you start nagios by executing:
/etc/rc.d/init.d/nagios start
??


#15

Sir,
here is the nagios starting ,

[root@linuxbox root]# /etc/rc.d/init.d/nagios start
Starting network monitor: nagios
[root@linuxbox root]#
[root@linuxbox root]# ps -ef|grep nagios
nagios 28499 1 0 15:23 ? 00:00:00 [nagios]
root 28507 28225 0 15:23 pts/0 00:00:00 grep nagios
[root@linuxbox root]#


#16

I’ve never seen it look like that in ps. [nagios]
Try this please.
/etc/rc.d/init.d/nagios status

Plus, when I start my nagios, it shows the process id #, which yours did not when you ran…
/etc/rc.d/init.d/nagios start

So I really don’t think it’s running.
Try this please also.

/etc/rc.d/init.d/nagios stop
/etc/rc.d/init.d/nagios status
ps -ef|grep nagios and make sure that there is no nagios returned from ps.
Now start nagios like this.
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

and now do a ps -ef|grep nagios.

Edited Sat May 21 2005, 11:36AM ]


#17

here is the output,

[root@linuxbox root]# /etc/rc.d/init.d/nagios status
PID TTY TIME CMD
28499 ? 00:00:00 nagios


#18

Well, that does tell me it’s running. Sorry to have gotten nowhere with you so far.
I’m outa here for today, so in the mean time, double check the documentation, and make sure you followed the steps completely. i.e. Did you authenticate properly, did you add that user to the contactgroups or the cgi.cfg file, things like that.


#19

Thank you for your help. I shall double check my configs again. Have a great day ahead :slight_smile:


#20

Sir,
i checked the documentation of nagios and it shows the exact same output of 'service nagios status ’ command that i am getting. I am also able to get alert messages if i restart my server, which is being monitored by nagios. The only problem is the webinterface.
:frowning: