|
From: James G. <ja...@m5...> - 2005-01-05 00:28:33
|
Hi Ben,
First of all, thanks a lot for helping me out. Something worthy of note:
I have updated to 104.6 and seem to be getting the same old problems...
I have upgraded the database with 'perfparse-db-tool --update', and
ensured that all the settings are the same...
Ben Clewett wrote:
> James,
>
> I'll see if I can offer any help.
>
> James Greenhalgh wrote:
>
>> Hi all,
>>
>> I've been reading through the archives, and saw that Gili has had the
>> same problem as myself. That is, error 500 on perfparse.cgi. The
>> following is the error..
>>
>> --
>> Server error!
>>
>> The server encountered an internal error and was unable to complete
>> your request.
>>
>> Error message:
>> malformed header from script. Bad header=perfparse.cgi: perfparse.cgi
>>
>> If you think this is a server error, please contact the webmaster
>>
>> Error 500
>>
>> X.X.X.X
>> Tue 04 Jan 2005 10:07:03 EST
>> Apache/2.0.40 (Red Hat Linux)
>> --
>> The error only occurs when there are arguments passed to
>> perfparse.cgi. Eg perfparse.cgi?edit_host_list=1
>> When I go to perfparse.cgi, I can see the menu page correctly. The
>> permissions for perfparse.cgi are exactly the same as those for the
>> nagios cgi files.
>> All of the nagios pages work correctly and have been working for a
>> while. I am running nagios v1.1
>
>
> 1. Can you try the following URL:
>
> perfparse.cgi?show_config=1
>
> Does this also return the same error?
Yeah I get exactly the same error when I use that :(
>
> 2. Can you try running the program from the command line:
>
> $ export QUERY_STRING="?show_config=1"
> $ /...../perfparse.cgi
>
> Can you show me the result of this action?
>
# ./perfparse.cgi
Expires: Sun, 02 Jan 2000 01:01:01 GMT
content-type: text/html
<HTML>
<HEAD>
<TITLE>
PerfParse</TITLE>
<BODY BGcolor="#EEFFFF" TEXT="#000000" LINK="#000000" VLINK="#000000"
ALINK="#000000">
<pre>
perfparse.cgi
# File where Perfparse logs messages
# Error_Log = "string"
Error_Log = "/usr/local/nagios/var/perfparse.log"
# Rotate Perfparse log files
# Error_Log_Rotate = "Y/N"
Error_Log_Rotate = "Yes"
# Database user
# DB_User = "string"
DB_User = "nagios"
# Database password
# DB_Pass = "string"
DB_Pass = "myawesomepassword"
# Database name
# DB_Name = "string"
DB_Name = "nagios"
# Database hostname
# DB_Host = "string"
DB_Host = "localhost"
# Policy for default user
# Default_user_permissions_Policy = "string"
Default_user_permissions_Policy = "rw"
# Default permissions for host groups
# Default_user_permissions_Host_groups = "string"
Default_user_permissions_Host_groups = "rw"
# Summary Permissions for default user
# Default_user_permissions_Summary = "string"
Default_user_permissions_Summary = "rw"
# Dummy hostname if gethostname() does not work
# Dummy_Hostname = "string"
Dummy_Hostname = "dummy"
</pre>
</body></html>
#
> 3. Finally, can you try a small script in your cgi-bin directory:
>
>
> ---------------------test.cgi-------------------------
> #!/bin/sh
> echo "Expires: Sun, 02 Jan 2000 01:01:01 GMT"
> echo "content-type: text"
> echo ""
> echo "QUERY_STRING = $QUERY_STRING"
> echo ""
> set | grep "^[A-Za-z].*="
> ------------------------------------------------------
>
> chmod a+x test.cgi
>
> How call this URL as:
>
> http://....../test.cgi?testVariable=testValue
>
It creates a text file containing the following...
QUERY_STRING = testVariable=testValue
AUTH_TYPE=Basic
BASH=/bin/sh
BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release"
[5]="i386-redhat-linux-gnu")
BASH_VERSION='2.05b.0(1)-release'
DIRSTACK=()
DOCUMENT_ROOT=/var/www/html
EUID=48
GATEWAY_INTERFACE=CGI/1.1
GROUPS=()
HOSTNAME=netmon
HOSTTYPE=i386
HTTP_ACCEPT='text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
HTTP_ACCEPT_CHARSET='ISO-8859-1,utf-8;q=0.7,*;q=0.7'
HTTP_ACCEPT_ENCODING=gzip,deflate
HTTP_ACCEPT_LANGUAGE='en-us,en;q=0.5'
HTTP_CONNECTION=keep-alive
HTTP_COOKIE=phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bs%3A2%3A%2212%22%3B%7D
HTTP_HOST=203.24.149.157
HTTP_KEEP_ALIVE=300
HTTP_USER_AGENT='Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041207 Firefox/1.0 (Debian package 1.0-5)'
IFS='
MACHTYPE=i386-redhat-linux-gnu
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
PIPESTATUS=([0]="0")
POSIXLY_CORRECT=y
PPID=15513
PS4='+ '
PWD=/usr/local/nagios/sbin
QUERY_STRING=testVariable=testValue
REMOTE_ADDR=172.16.1.28
REMOTE_PORT=33070
REMOTE_USER=nagiosadmin
REQUEST_METHOD=GET
REQUEST_URI='/nagios/cgi-bin/test.cgi?testVariable=testValue'
SCRIPT_FILENAME=/usr/local/nagios/sbin/test.cgi
SCRIPT_NAME=/nagios/cgi-bin/test.cgi
SERVER_ADDR=X.X.X.X
SERVER_ADMIN=root@localhost
SERVER_NAME=X.X.X.X
SERVER_PORT=80
SERVER_PROTOCOL=HTTP/1.1
SERVER_SIGNATURE='<address>Apache/2.0.40 Server at X.X.X.X Port 80</address>
SERVER_SOFTWARE='Apache/2.0.40 (Red Hat Linux)'
SHELL=/sbin/nologin
SHELLOPTS=braceexpand:hashall:interactive-comments:posix
SHLVL=1
TERM=dumb
UID=48
UNIQUE_ID=H0yXun8AAAEAADyZLDIAAAAA
> Please tell me what is displayed. This would be of great help in
> finally fixing this problem.!
>
>
>
>>
>> I'm using perfparse-0.104.4. The following is some output from my
>> perfdata-service.log
>>
>> 1104549133 services-cbr / DISK OK [241572 kB (51%) free
>> on /dev/hda1] OK
>> 1104549133 services3-cbr /var DISK OK [14202808 kB (98%)
>> free on /dev/hda2] OK
>> 1104549133 pix PING PING OK - Packet loss = 0%, RTA = 1.48
>> ms OK
>> 1104549133 ids-cbr / DISK OK - free space: / 1317 MB
>> (91%): OK /=1317MB;1235;1381;0;1454
>>
>> Should I be seeing stuff after a '|' ? Does this mean that there is no
>> useful perfdata?
>
>
> The '|' has already been removed at this point. Your output looks
> correct. The only think I notice is that you may need a more recent
> version of your plugins. Since only the last line shows has returned
> any graphable data. (The part after the 'OK')
>
No worries. I'll do that after I fix all this other stuff. :)
>>
>> Also, and I think this may be intertwined with my cgi problem, I am
>> getting no data at all in my database.
>> The following is an error from perfparse.log.20050104.log
>>
>> 2005/01/04 10:54:54 [ storage.c:92 19064 ] storage_mysql module
>> successfully loaded
>> 2005/01/04 10:54:54 [log_reader.c:159 19064 ] No position mark path
>> was specified. Either disable saving the position or specify a mark path.
>
>
> Look at the example perfparse.cgi for a line showing the mark file path.
> Ensure this is correct. Delete any existing .mark file you find. This
> should fix this.
>
Woohoooooo!!!! I put a mark path into the perfparse.cfg file and it
added stuff to my database!!
[root@netmon bin]# ./perfparse-log2mysql -U nagios -P myawesomepassword
-D nagios -H localhost --no_transactions
00:03:51 read 206424 @ 809.7 l/sec. Met 37477 @ 0.18 Met/l. Drop 0.
+-----------------------------+ +-----------------------------+
| Generic statistics | | Nb Log Lines : 2 |
| Nb lines parsed : 206424 | | Nb lines dropped : 0 |
| Start date : 2005-01-05 | | Elapsed time : 00:03:51 |
| Start time : 10:06:53 | | Rate : (line/sec) 893.61 |
+-----------------------------+ +-----------------------------+
*** WARNING! Log file has been written to. Please check. ***
*** Log file name: /usr/local/nagios/var/perfparse.log.20050105.log ***
+-----------------------------+ +-----------------------------+
| MySQL storage statistics | | |
| New Hosts : 30 | | Metric/line : 0.18 |
| New Metrics : 27 | | Metrics Recorded : 37477 |
| New Services : 140 | | Summary Rec Added : 0 |
| New Summary Group : 0 | | SQL Queries : 844716 |
+-----------------------------+ +-----------------------------+
When I look inside /usr/local/nagios/var/perfparse.log.20050105.log
the last two lines are these...
--
2005/01/05 10:06:53 [ storage.c:95 22768 ] storage_mysql module
successfully loaded
2005/01/05 10:06:53 [log_reader.c:178 22768 ] Could not open
'/usr/local/nagios/var/perfdata_log.perfdata-service.log.mark'
--
Which is odd because I can perform cat on it..
# cat /usr/local/nagios/var/perfdata_log.perfdata-service.log.mark
18196528
508091289
#
After all of this, the graphs are still not working. :(
My web browser is firefox, and I have also tried using konqueror. I have
also tried (with a mac) Safari and IE. They all give me the same output.
This is the error from apache's logs... (it doesn't really say much)
---
[Wed Jan 05 11:08:02 2005] [error] [client 172.16.1.28] malformed header
from script. Bad header=perfparse.cgi: perfparse.cgi, referer:
http://X.X.X.X/nagios/cgi-bin/perfparse.cgi
---
>
>>
>> I have ran mysql_create.sql and created all the tables in the
>> database, it seems it is connecting correctly, too, as I had to fix
>> the config file to ensure this.
>
>
> Can you give me more details of the fix you has to make?
>
I only meant that I had to change the password and the hostname
so that it would connect properly.
Also, in the create_mysql file, I had to change one of the lines from
CREATE TABLE IF NOT EXISTS perfdata_registry (
host VARCHAR(75) DEFAULT NULL,
.....
to...
CREATE TABLE IF NOT EXISTS perfdata_registry (
host VARCHAR(75) NOT NULL,
.....
as it did not like the default null key. I saw this as a workaround on a
bugtracking list somewhere. Could this have possibly made it all fall over?
I should probably also mention that I am using mysql 3.2. I'm unable to
upgrade it as it is in a production environment. I have ensured that I
used the '--no_transactions' flags where appropriate.
Thanks a lot for any help, and thanks for the help so far. :D
Cheers,
James Greenhalgh
|