Cgi.cfg reading errors

Dan Adams dadams at aspect1.net
Tue Mar 30 22:20:50 CEST 2004


---- LONG POST BELOW ----
Andreas,
	I tried the commands as you had stated and it didn't make much
sense. When I tried it with the grep command as part of it, it did not show
anything but a black line but when I use grep I am used to it just going to
the next prompt if there is nothing to be found, below (at the bottom of the
e-mail is the output of the commands. Any more ideas?

Dan

-----Original Message-----
From: nagios-users-admin at lists.sourceforge.net
[mailto:nagios-users-admin at lists.sourceforge.net] On Behalf Of Andreas
Ericsson
Sent: Sunday, March 28, 2004 4:23 AM
To: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Cgi.cfg reading errors


Dan Adams wrote:
> Andreas,
> 	I tried that, su to root first then su to both of the users, what 
> Nagios is and what the web server is.

Only the webserver user needs read-access to the files, and it's path 
will not be relative to DocumentRoot.

You can do the following to see what files it's trying to open and what 
happens when it does. First su to the webserver pseudo-user, then run 
this little sequence;
export REQUEST_METHOD=GET
export QUERY_STRING="host=all"
export REMOTE_USER="some-authorized-user"

strace <cgi-program> 2>&1 | grep open | less

You will obviously have to replace some-authorized-user with an 
authorized user, and the 'host=all' string may not work with all CGI's.

If you still can't work it out, post the output of the strace-command 
here and I'll probably be able to help you.

> When I did the cat on that filename it
> listed the file perfectly fine from both of those users. I also tried 
> restarting the web server in the event that chmodding the file to 777 
> would help.

Restarting it after chmod'ing it can't possibly help, since the files 
are accessed on run-time by the cgi's.

> 	Also, I will ask, in which directory should the nagios.cfg file be 
> in, I did not see it below the /usr/local/nagios directory tree?
> 
In /usr/local/nagios/etc by default.

> Dan
> 
> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net
> [mailto:nagios-users-admin at lists.sourceforge.net] On Behalf Of Andreas 
> Ericsson
> Sent: Saturday, March 27, 2004 1:23 PM
> To: nagios-users at lists.sourceforge.net
> Subject: Re: [Nagios-users] Cgi.cfg reading errors
> 
> 
> 
> 
> Dan Adams wrote:
> 
>>I have Nagios setup and running on a Unix environment computer, I have
>>the cgi.cfg file chmoded to 777, just to make sure it can work, 
>>however I am still getting an error message saying that the file 
>>cannot be opened for reading on most of the pages in the website. I do 
>>have the website working, but I cannot get this file (At least, but 
>>the other *.cfg files may have errors also). I was wondering, at first 
>>at least, does any one know of any FAQ pages or such that may help 
>>with this error? I will gladly read through any suggestions that can 
>>come my way to help. Any information will be greatly appreciated.
>>
> 
> Log on to the system as the user nagios and the web-server is running
> and and try to 'cat' the file.
> 
> If you can, I'm pretty sure you've made a typo or something in
> nagios.cfg, or that you have moved your nagios installation to some 
> other directory than you initally had it (--prefix option to ./configure).
> 
> If you can't (which I think might be the case), the user may not have
> execute permissions for one or more of the directories above it in the 
> path (execute permissions on unix-systems means 'access to files and 
> directories in it', whereas reading permissions means 'access to 
> directory listing when coupled with execute permissions', basically).
> 
> 

-- 
Mvh
Andreas Ericsson
OP5 AB
+46 (0)733 709032
andreas.ericsson at op5.se


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo
technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

---------

nobody at MRTG:/usr/local/nagios/share/cgi-bin$ export REQUEST_METHOD=GET
nobody at MRTG:/usr/local/nagios/share/cgi-bin$ export QUERY_STRING="host=all"
nobody at MRTG:/usr/local/nagios/share/cgi-bin$ export REMOTE_USER="dadams"
nobody at MRTG:/usr/local/nagios/share/cgi-bin$ strace ./config.cgi 2>&1 
execve("./config.cgi", ["./config.cgi"], [/* 29 vars */]) = 0
brk(0)                                  = 0x8068480
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=25711, ...}) = 0
old_mmap(NULL, 25711, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40016000
close(3)                                = 0
open("/usr/local/mysql/lib/mysql/libmysqlclient.so.12", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\215"..., 1024) =
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=264941, ...}) = 0
old_mmap(NULL, 236672, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4001d000
mprotect(0x40043000, 81024, PROT_NONE)  = 0
old_mmap(0x40043000, 81920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x25000) = 0x40043000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300]\1"..., 1024) =
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=1458907, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x40057000
old_mmap(NULL, 1268836, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40058000
mprotect(0x40187000, 27748, PROT_NONE)  = 0
old_mmap(0x40187000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x12f000) = 0x40187000
old_mmap(0x4018c000, 7268, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4018c000
close(3)                                = 0
open("/usr/lib/libz.so.1", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\244\30"..., 1024) =
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=51724, ...}) = 0
old_mmap(NULL, 50320, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4018e000
mprotect(0x40199000, 5264, PROT_NONE)   = 0
old_mmap(0x40199000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0xb000) = 0x40199000
close(3)                                = 0
open("/lib/libcrypt.so.1", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\n\0\000"...,
1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=22862, ...}) = 0
old_mmap(NULL, 182176, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4019b000
mprotect(0x401a0000, 161696, PROT_NONE) = 0
old_mmap(0x401a0000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x4000) = 0x401a0000
old_mmap(0x401a1000, 157600, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x401a1000
close(3)                                = 0
open("/lib/libnsl.so.1", O_RDONLY)      = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 <\0\000"..., 1024)
= 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=87565, ...}) = 0
old_mmap(NULL, 84928, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x401c8000
mprotect(0x401da000, 11200, PROT_NONE)  = 0
old_mmap(0x401da000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x11000) = 0x401da000
old_mmap(0x401db000, 7104, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x401db000
close(3)                                = 0
open("/lib/libm.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0006\0"..., 1024) =
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=177047, ...}) = 0
old_mmap(NULL, 140432, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x401dd000
mprotect(0x401ff000, 1168, PROT_NONE)   = 0
old_mmap(0x401ff000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x21000) = 0x401ff000
close(3)                                = 0
open("/usr/lib/libssl.so.0", O_RDONLY)  = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300\204"..., 1024)
= 1024
fstat64(3, {st_mode=S_IFREG|0555, st_size=196624, ...}) = 0
old_mmap(NULL, 200676, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40200000
mprotect(0x4022e000, 12260, PROT_NONE)  = 0
old_mmap(0x4022e000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x2d000) = 0x4022e000
close(3)                                = 0
open("/usr/lib/libcrypto.so.0", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\271\2"..., 1024)
= 1024
fstat64(3, {st_mode=S_IFREG|0555, st_size=1029840, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x40231000
old_mmap(NULL, 1038840, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40232000
mprotect(0x4031b000, 84472, PROT_NONE)  = 0
old_mmap(0x4031b000, 73728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0xe8000) = 0x4031b000
old_mmap(0x4032d000, 10744, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4032d000
close(3)                                = 0
open("/lib/libdl.so.2", O_RDONLY)       = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0P\31\0\000"...,
1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=11885, ...}) = 0
old_mmap(NULL, 11524, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40330000
mprotect(0x40332000, 3332, PROT_NONE)   = 0
old_mmap(0x40332000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x1000) = 0x40332000
close(3)                                = 0
munmap(0x40016000, 25711)               = 0
brk(0)                                  = 0x8068480
brk(0x8069480)                          = 0x8069480
brk(0)                                  = 0x8069480
brk(0x806a000)                          = 0x806a000
open("/usr/local/nagios/etc/cgi.cfg", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0666, st_size=21335, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x40016000
read(3, "################################"..., 4096) = 4096
read(3, "he interval_length variable.\n# N"..., 4096) = 4096
read(3, " GLOBAL HOST AND SERVICE EVENT H"..., 4096) = 4096
read(3, " is set to 1.\n\nstate_retention_f"..., 4096) = 4096
read(3, "implementing distributed monitor"..., 4096) = 4096
read(3, "ripped from macros before being "..., 4096) = 855
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x40016000, 4096)                = 0
time([1080677915])                      = 1080677915
open("/etc/localtime", O_RDONLY)        = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=130, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x40016000
read(3, "TZif\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0\0\0\3\0"..., 4096) =
130
close(3)                                = 0
munmap(0x40016000, 4096)                = 0
fstat64(1, {st_mode=S_IFCHR|0720, st_rdev=makedev(136, 0), ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x40016000
write(1, "Cache-Control: no-store\n", 24Cache-Control: no-store
) = 24
write(1, "Pragma: no-cache\n", 17Pragma: no-cache
)      = 17
write(1, "Last-Modified: Tue, 30 Mar 2004 "..., 45Last-Modified: Tue, 30 Mar
2004 20:18:35 GMT
) = 45
write(1, "Expires: Tue, 30 Mar 2004 20:18:"..., 39Expires: Tue, 30 Mar 2004
20:18:35 GMT
) = 39
write(1, "Content-type: text/html\r\n", 25Content-type: text/html
) = 25
write(1, "\r\n", 2
)                     = 2
write(1, "<html>\n", 7<html>
)                 = 7
write(1, "<head>\n", 7<head>
)                 = 7
write(1, "<META HTTP-EQUIV=\'Pragma\' CONTEN"..., 46<META
HTTP-EQUIV='Pragma' CONTENT='no-cache'>
) = 46
write(1, "<title>\n", 8<title>
)                = 8
write(1, "Configuration\n", 14Configuration
)         = 14
write(1, "</title>\n", 9</title>
)               = 9
write(1, "</head>\n", 8</head>
)                = 8
write(1, "<body CLASS=\'config\'>\n", 22<body CLASS='config'>
) = 22
write(1, "\n", 1
)                       = 1
write(1, "<!-- Produced by Nagios (http://"..., 93<!-- Produced by Nagios
(http://www.nagios.org).  Copyright (c) 1999-2002 Ethan Galstad. -->
) = 93
open("common-header.ssi", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
open("config-header.ssi", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
write(1, "<H1>Whoops!</H1>\n", 17<H1>Whoops!</H1>
)      = 17
write(1, "<P><STRONG><FONT COLOR=\'RED\'>Err"..., 132<P><STRONG><FONT
COLOR='RED'>Error: Could not open CGI config file
'/usr/local/nagios/etc/cgi.cfg' for reading!</FONT></STRONG></P>
) = 132
write(1, "<P>\n", 4<P>
)                    = 4
write(1, "Here are some things you should "..., 70Here are some things you
should check in order to resolve this error:
) = 70
write(1, "</P>\n", 5</P>
)                   = 5
write(1, "<P>\n", 4<P>
)                    = 4
write(1, "<OL>\n", 5<OL>
)                   = 5
write(1, "<LI>Make sure you\'ve installed a"..., 327<LI>Make sure you've
installed a CGI config file in its proper location.  See the error message
about for details on where the CGI is expecting to find the configuration
file.  A sample CGI configuration file (named <b>cgi.cfg</b>) can be found
in the <b>sample-config/</b> subdirectory of the Nagios source code
distribution.
) = 327
write(1, "<LI>Make sure the user your web "..., 97<LI>Make sure the user
your web server is running as has permission to read the CGI config file.
) = 97
write(1, "</OL>\n", 6</OL>
)                  = 6
write(1, "</P>\n", 5</P>
)                   = 5
write(1, "<P>\n", 4<P>
)                    = 4
write(1, "Make sure you read the documenta"..., 268Make sure you read the
documentation on installing and configuring Nagios thoroughly before
continuing.  If all else fails, try sending a message to one of the mailing
lists.  More information can be found at <a
href='http://www.nagios.org'>http://www.nagios.org</a>.
) = 268
write(1, "</P>\n", 5</P>
)                   = 5
open("config-footer.ssi", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
open("common-footer.ssi", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
write(1, "\n", 1
)                       = 1
write(1, "<!-- Produced by Nagios (http://"..., 93<!-- Produced by Nagios
(http://www.nagios.org).  Copyright (c) 1999-2002 Ethan Galstad. -->
) = 93
write(1, "</body>\n", 8</body>
)                = 8
write(1, "</html>\n", 8</html>
)                = 8
munmap(0x40016000, 4096)                = 0
exit_group(-2)                          = ?
nobody at MRTG:/usr/local/nagios/share/cgi-bin$ 



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list