<div dir="ltr"><div><div><div><div>Hello.<br><br></div>I had a problem recently where the graphs were loading fine on my development machine, but not on my production machine.<br><br></div>I've narrowed down the problem to the fact that web servers with a cgi-bin (or cgi) directory will assume everything within that directory is executable. Attempts made to access files in that directory from html will result in those files being executed instead of read. For example, if style.css is in the cgi-bin directory, then it will not be correctly read by the web browser.<br>
<br></div><div></div>The graphing tools in collection3 are all within a single collection3 directory;<br></div><div><div style="margin-left:40px"><span style="font-family:courier new,monospace">$ pwd;ls</span><br><span style="font-family:courier new,monospace">/usr/share/doc/collectd-4.9.1/contrib/collection3</span><br>
<span style="font-family:courier new,monospace">bin etc lib README share</span><br></div><br></div><div>And the index.cgi and htmlcss.cgi reference the css and js files in the share directory using a relative path. For example "../share/navigate.js".<br>
<br></div><div>When I tried to deploy this on a tomcat server, I was forced to put this in the cgi directory as follows.<br><div style="margin-left:40px"><span style="font-family:courier new,monospace">$ pwd</span><br><span style="font-family:courier new,monospace">/usr/local/apache-tomcat-7.0.18/webapps/system/WEB-INF/cgi</span><br>
<span style="font-family:courier new,monospace"></span><span style="font-family:courier new,monospace">$ ln -s /usr/share/doc/collectd-4.9.1/contrib/collection3 collectd</span><br></div></div><div><br></div><div>However, when I went to access the graphs via firefox, I noticed that the buttons didn't work. This was because navigate.js couldn't be loaded, so all the functions defined in it were undefined.<br>
<div><br>I found reference to this type of problem online here:<br><a href="http://www.theadminzone.com/forums/showthread.php?t=6156">http://www.theadminzone.com/forums/showthread.php?t=6156</a><br></div><div>and here:<br>
<a href="http://forums.jaguarpc.com/open-discussion-chit-chat/13449-external-javascript-file-problem.html">http://forums.jaguarpc.com/open-discussion-chit-chat/13449-external-javascript-file-problem.html</a><br></div><div>
<br></div><br></div><div>To fix this I did the following.<br><br></div><div>1. Create another link to collection3 in the webapps directory.<br><div style="margin-left:40px"><span style="font-family:courier new,monospace">$ pwd</span><br>
<span style="font-family:courier new,monospace">/usr/local/apache-tomcat-7.0.18/webapps</span><br><span style="font-family:courier new,monospace"></span><span style="font-family:courier new,monospace"> $ ln -s /usr/share/doc/collectd-4.9.1/contrib/collection3 collectd</span><br>
</div></div><div><br>2. Edit the index.cgi and htmlcss.cgi files to reference "/collectd/share/..." instead of "../share/...". <br><br></div><div>The graphs then load normally.<br><br>While this works, I dislike having the change the source code because it is something that will have to be repeated every time we update collectd.<br>
<br></div><div>Has anyone else had this problem? Have you been able to solve it better than I?<br><br>Thanks!!<br><br>Chris<br></div><div><br></div><div><br></div><div><br></div></div>