Installing Nagios on Solaris

If you are not familiar with it, Nagios is an open source system and network monitoring application that keeps a watchful eye on hosts and services that you specify, alerting you when things go bad and when they get better. It was designed to run under Linux but, according to the creators, should also run on other Unix variants. With this in mind, I decided to try it out on Solaris.

Fortunately, they provide a very comprehensive User Guide and trust me, you’re going to need it. Suffice it to say, there is a section early in this document entitled Advice for Beginners which is pretty blunt about how tricky Nagios is to set up and, believe me, they are not wrong. Having said that, they do also say that once you get it running you will never want to be without it and I can definitely subscribe this this notion too.
Anyway, here are my notes from installing Nagios on Solaris:

My Setup

  • Solaris 10 (u3) for x86
  • Sun Studio 12
  • Nagios 2.10
  • Nagios Plugins 1.4.11

Building Nagios

I downloaded the Nagios source tar ball and unpacked it as a non-root user. Then, following the User Guide, I ran the configure script with no argument (implying I wanted all default settings) followed make all and this seemed to work fine.

Building Nagios Plugins

Nagios does most things by using other scripts/applications which it calls plugins. The Nagios website provides a collection of popular plugins for you to build. Once again, I did so using a configure command followed by a make all command. However, this did not go entirely smoothly:

  1. A number of the plugins failed to build citing an “undefined symbol: floor” error. This was resolved by adding -lm to the LIBS defined in line 328 of nagios-plugins-1.4.11/plugins/Makefile. This could probably also have been fixed by adding $(MATHLIBS) to the links statement of the affected plugins but that would have been more work.
  2. The check_dhcp module failed to compile citing several unknown data types (i.e. u_int8_t and u_int32_t). This was resolved by adding a -D__solaris__ to CPPFLAGS definitions at line 161 of nagios-plugins-1.4.11/plugins-root/Makefile
  3. The nagios-plugins-1.4.11/plugins-root/Makefile was also missing the same -lm link parameter as the plugins Makefile (line 221)

Once all of the above changes were make, all of the plugins seemed to build correctly.

Problems Found During Nagios Configuration

1. check_ping plugin did not work

No matter what way I configured the use of the check_ping plugin (in localhost.cfg, services section) it always reported:

CRITICAL – You need more args!!!
Could not open pipe:

A number of websites suggested that this was an IPv6 issue and that I should have used the --with-ipv6=no in my original call to the configure script when building the plugins. However, this was not the solution for me. It turns out that the definition of PING_COMMAND in nagios-plugins-1.4.11/config.h was empty and thus the check_ping plugin was actually making no attempt whatsoever to ping the requested host. I suspect that the reason for this is that I built the software as a non-root user which, on Solaris, does not have the ping command in it’s path (since ping is located in /usr/sbin on Solaris). Hence, the original configure script was unable to produce a valid definition for PING_COMMAND.

The solution to this was to edit nagios-plugins-1.4.11/config.h and add the following definition for PING_COMMAND (line 796)

#define PING_COMMAND “/usr/sbin/ping -s %s 64 %u”

The above command specific to Solaris and makes the Solaris version of ping behave like the Linux ping command. After this edit, I had to force a rebuild of the check_ping plugin (touch plugins/check_ping.c; make)

2. statusmap.cgi did not build

I only noticed this when I tried to view the Status Map section of Nagios. In short, the reason why this has not built is that I was missing a GD library on my Solaris system. The solution was to download and install a version of the GD library (and each of its dependent packages). I got mine from sunfreeware.com. The statusmap.cgi utility then built correctly and once I copied it to the libexec directory where Nagios was installed, it worked.

3. VRML Browser Plugin required

When I tried to view the 3-D Status Map options in Nagios, my brower kept launching a “Save As” dialog box. I turns out I needed to install a VRML plugin in my browser. I chose one called Cortona from Parallel Graphics. It seems to work fine in Firefox although, as yet, the 3-D Status Map view is more impressive than it is useful (for me anyway).

Conclusion

Nagios indeed took a long time to install, configure and set up. However, I can confirm that it was worth the effort and I am very pleased with it so far.


10 thoughts on “Installing Nagios on Solaris”

  1. I tried that nagios check_ping change but I just get a core dump now. I have reverted to using check_ping from nagios-plugins-1.4.5 and it works.

    Regards Stan

  2. Stan,

    Thanks for the feedback. Can you post back some details about your operating system version and hardware (for the record). It is interesting that the version of check_ping from nagios-plugins-1.4.5 works for you, I wonder what the differences are?

  3. im installing nagios on ubuntu, and i come out with the same problem, do you think the solution are the same for me (ubuntu) ???

  4. Hi James,

    I was using Solaris 10 X86 U5 on a IBM T43 laptop. I tried the same thing on my SUN T2000 with Solaris 10 SPARC U5 but I keep getting a segmentation fault :-(.

    So now I have copied check_ping from my Solaris 8 server to my T2000 and symbolically linked libintl.so.8 to libintl.so.3 to make it work.

    ./check_ping -V
    check_ping (nagios-plugins 1.4.9) 1.61

    That seems to work. Its not right but what the heck.

  5. Bagus,

    It depends on whether you are compiling Nagios from source on Ubuntu or not. There shouldn’t be any need to do that though since Nagios is available as a downloadable package on Ubuntu so it should just work right out of the box for you.

    Also, as far as I’m aware, the “ping” utility is in /usr/bin on Ubuntu so it should have been detected by a ./configure in any case.

    Stan,

    Thanks for the details about your system(s) and for the impromptu workaround. If I get time I will take another look at a more recent version of Nagios plugins and see if anything has improved.

  6. James, Bagus,

    Cracke my problem. I ran the check_ping command with the truss command in Solaris and found that it was trying to access /dev/upd6, and I haven’t enabled ipv6 on my servers. So I use the ./configure –without-ipv6 and rebuilt my plugins. Now working like a dream. See details below.

    truss -d ./check_ping -H localhost -w 100.0,20% -c 500.0,60% -p 5 -4
    Base time stamp: 1218013768.5929 [ Wed Aug 6 11:09:28 SAST 2008 ]
    0.0000 execve(“check_ping”, 0xFFBFFA74, 0xFFBFFAA0) argc = 10
    0.0047 resolvepath(“/usr/lib/ld.so.1”, “/lib/ld.so.1”, 1023) = 12
    0.0053 getcwd(“/export/home/stl/install/nagios-plugins-1.4.12/plugins”, 1012) = 0
    0.0057 resolvepath(“/export/home/stl/install/nagios-plugins-1.4.12/plugins/check_ping”, “/export/home/stl/install/nagios-plugins-1.4.12/plugins/check_ping”, 1023) = 65
    0.0063 stat(“/export/home/stl/install/nagios-plugins-1.4.12/plugins/check_ping”, 0xFFBFF850) = 0
    0.0067 open(“/var/ld/ld.config”, O_RDONLY) = 3
    0.0069 fstat(3, 0xFFBFF2D8) = 0
    0.0070 mmap(0x00000000, 152, PROT_READ, MAP_SHARED, 3,
    .
    .
    .
    .
    0.0352 close(4) = 0
    0.0355 open(“/dev/udp6”, O_RDONLY) = 4 -> The problem.
    0.0357 ioctl(4, I_STR, 0xFFBFF2D8) = 0
    0.0359 close(4) = 0
    0.0361 brk(0x0002E6F8) = 0
    0.0363 brk(0x000306F8) = 0
    0.0367 sigaction(SIGALRM, 0xFFBFF890, 0xFFBFF930) = 0
    0.0369 alarm(11) = 0
    0.0371 Incurred fault #6, FLTBOUNDS %pc = 0xFF131D14
    siginfo: SIGSEGV SEGV_MAPERR addr=0x0000000A
    0.0372 Received signal #11, SIGSEGV [default]
    siginfo: SIGSEGV SEGV_MAPERR addr=0x0000000A

  7. Stan,

    I can recall that compiling Nagios without ipv6 support was one of the many things I tried when I first encountered problems on X86. However, at that time, it was not the source of my problem so I never included details about it here

    Thanks for posting back your solution, very useful to know this.

  8. I downloaded the latest version of the Nagios Plugins tarball (1.4.12) from nagiosplugins.org this afternoon and tried building them again on my X86 Solaris box (I actually wanted to get the new check_dns plugin that comes with 1.2.14).

    This time, I took a closer look at the output from ./configure and noticed the following warnings:

    checking for ping... no
    checking for ping6... no
    checking for ICMP ping syntax... configure: WARNING: unable to find usable ping syntax
    checking for ICMPv6 ping syntax... none
    checking for nslookup... no

    This confirmed to me that my original problem was in fact that the Nagios configure stage was unable to locate a version of ping on my system (I just didn’t notice this warning the first time around) since it is located in /usr/sbin on Solaris which is not normally in the PATH for non-root users.

    So, I ran the following commands (as root) and tried the ./configure again (as non-root):

    # ln -s /usr/sbin/ping /usr/bin/ping
    # ln -s /usr/sbin/nslookup /usr/bin/nslookup

    and low and behold, the configure script ran cleaner with this output:

    checking for ping... /usr/bin/ping
    checking for ping6... no
    checking for ICMP ping syntax... /usr/bin/ping -n -s %s 56 %d
    checking for ICMPv6 ping syntax...none
    checking for nslookup... /usr/bin/nslookup

    So, for me, this is the cleanest solution since I control the box where this is running and Nagios is pretty much the only thing on the box.

Leave a Reply