I thought I'd try to troubleshoot this, to get some more details on what is going wrong. I brought up the Nagios XI admin GUI in Firebug and navigated to one of the service details and clicked on the Performance
graphs tab. I watched the Firebug console, and saw this error scroll by amongst the many ajax requests taking place:
Code: Select all
Image corrupt or truncated: http://nagios.mycompany.com/nagiosxi/includes/components/perfdata/graphApi.php?host=TEST-HOST&service=Test%2BService&source=1&view=1&start=&end=&rand=1345764817
I copied the URL to a separate Firefox tab, also with Firebug open. Firefox displays an IMAGE containing the text: "The image 'http://...' cannot be displayed because it contains errors.", and the same "Image corrupt or truncated" error is logged to the Firebug console. What's interesting is that the response headers indicated the status was "200 OK". Here are the Request and Response headers displayed by Firebug.
Code: Select all
REQUEST Headers:
GET /nagiosxi/includes/components/perfdata/graphApi.php?host=TEST-HOST&service=Test%2BService&source=1&view=1&start=&end=&rand=1345764997 HTTP/1.1
Host: nagios.mycompany.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: nagiosxi=sj6ik84bda53mm234alnljl306
X-ClickOnceSupport: ( .NET CLR 3.5.30729; .NET4.0E)
RESPONSE Headers:
HTTP/1.1 200 OK
Date: Thu, 23 Aug 2012 23:37:27 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: nagiosxi=sj6ik84bda53mm234alnljl306; expires=Fri, 24-Aug-2012 00:07:27 GMT; path=/
Connection: close
Transfer-Encoding: chunked
Content-Type: image/png
To see what's going on with
graphApi.php, I set $bool = 1 after the call to passthru() to force it to log the RRDTool command being executed for the
graph. Then I watched /usr/local/nagios/var/
graphapi.log and reloaded the URL.
The log showed:
Code: Select all
graph ERROR: 2012-08-23T16:57:07-07:00
/usr/bin/rrdtool graph - --width=500 --height=100 --start=-24h --vertical-label "" --title "TEST-HOST / Test_Service" --lower-limit 0 DEF:var1=/usr/local/nagios/share/perfdata/TEST-HOST/Test_Service.rrd:1:MAX AREA:var1#EACC00:"Nbr_Users " LINE1:var1#000000:"" GPRINT:var1:LAST:"%3.4lf LAST " GPRINT:var1:MAX:"%3.4lf MAX " GPRINT:var1:AVERAGE:"%3.4lf AVERAGE \n" COMMENT:"Check Command check_dummy\r"
I ran the rrdtool command manually at the console, and redirected its output to /tmp/test.png. The file was 19k, as previously indicated by Firebug in the browser. I uploaded the .png file to my PC and the
graph displays just fine! (Windows 7, with the default Windows Photo Viewer) Note that it also displays fine when loaded into Firefox using a file: URL, e.g. file:///C:/Users/myuser/Desktop/test.png
At this point, I'm not sure what's happening with
graphApi.php to make the browser think the image is corrupt or truncated. And I don't know if the xml errors reported in my initial post are related or a separate issue.
Any tips on how to continue troubleshooting this problem?