Chris Weldon bio photo

Chris Weldon

A savvy software engineer and agilist, Chris slings code in C#, but has also been known for commanding fleets of systems. He's currently a Tech Lead at Wolters Kluwer.

Email Twitter Facebook Github

If you ever compile Nagios successfully on Solaris 10 (trust me, it’s a beast to get working properly), beware if you get the following errors:

[Tue Jul 01 18:15:37 2008] [error] [client] histogram.cgi: fatal
: open failed: No such file or directory, referer: 
[Tue Jul 01 18:15:37 2008] [error] [client] Premature end of script heade
rs: histogram.cgi, referer: https://nagiostest.domain.tld/nagios/side.html
[Tue Jul 01 18:16:03 2008] [error] [client] statusmap.cgi: fatal
: open failed: No such file or directory, referer: 
[Tue Jul 01 18:16:03 2008] [error] [client] Premature end of script heade
rs: statusmap.cgi, referer: https://nagiostest.domain.tld/nagios/cgi-bin/status.cgi?hostg

You likely haven’t compiled in support appropriately for GD and the JPEG, PNG, and other libraries. To check, issue a ldd statusmap.cgi and you may get the following output:

[root]@nagiostest ~/nagios-3.0.3/cgi> (18:19:28 07/01/08)
:: ldd statusmap.cgi =>	 (file not found) =>	 (file not found) =>	 (file not found) =>	 (file not found) =>	 /usr/lib/ =>	 /lib/ =>	 /lib/ =>	 /lib/ =>	 /lib/ =>	 /lib/

Those files not found are not good. Please note that the following solution I am using Solaris 10 x86 on a Dell server. I use Blastwave for GNU package management on the Solaris server, which is installed in /opt/csw. I also have installed the Blastwave distributed libgd, libpng, jpeg, etc. packages necessary for this part of the compilation process.


Do the following:

[root]@nagiostest ~/nagios-3.0.3> (18:24:05 07/01/08)
:: export LD_LIBRARY_PATH=/opt/csw/lib:/usr/sfw/lib:/usr/lib

[root]@nagiostest ~/nagios-3.0.3> (18:24:36 07/01/08)
:: export LDFLAGS="-R/opt/csw/lib -R/usr/sfw/lib -R/usr/lib"

[root]@nagios ~/nagios-3.0.3> (18:25:14 07/01/08)
:: ./configure --prefix=/opt/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagioscm --with-gd-lib=/opt/csw/lib --with-gd-inc=/opt/csw/include


root]@nagiostest ~/nagios-3.0.3> (18:26:21 07/01/08)
:: cd cgi/

[root]@nagiostest ~/nagios-3.0.3/cgi> (18:26:26 07/01/08)
:: make clean
rm -f avail.cgi cmd.cgi config.cgi extinfo.cgi history.cgi notifications.cgi outages.cgi showlog.cgi status.cgi statuswml.cgi summary.cgi tac.cgi statuswrl.cgi statusmap.cgi trends.cgi histogram.cgi
rm -f *.o core gmon.out
rm -f *~ *.*~

[root]@nagiostest ~/nagios-3.0.3/cgi> (18:26:27 07/01/08)
:: make

We can see that our CGI has the appropriate links we were looking for:

[root]@nagios ~/nagios-3.0.3/cgi> (18:26:51 07/01/08)
:: ldd statusmap.cgi =>	 /opt/csw/lib/ =>	 /opt/csw/lib/ =>	 /opt/csw/lib/ =>	 /opt/csw/lib/ =>	 /opt/csw/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /opt/csw/lib/ =>	 /usr/lib/ =>	 /opt/csw/lib/ =>	 /opt/csw/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /opt/csw/lib/ (SUNW_1.1) =>	 (version not found) =>	 /usr/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /usr/lib/ =>	 /usr/lib/

Kudos go out to the Nagios FAQ for having this.