Deploying Nagios NRPE on Solaris

June 2, 2007

Nagios is a stable and well regarded open source monitoring suite. NRPE is a Nagios plugin that allows a remote Nagios monitoring server to log into a server and execute a Nagios check. The Nagios check will then return information that is relevant to the service the Nagios monitoring server is monitoring.

To install NRPE on Solaris, i use the blastware.org package. The blastwave.org nrpe package also depends on the nagiosp package which contains the standard nagios plugins. If you havent setup your Solaris box with blastwave.org, instruction are included below.

Copy the blastwave.org package pkg_get.pkg to /tmp/ . You can do this from another server using scp.

# pkgadd -d /tmp/pkg_get.pkg
# /opt/csw/bin/pkg-get -i nrpe
# wget -P /tmp/ http://rene.bz/wp-content/uploads/solaris/nrpe_smf.zip
# cd /tmp
# unzip nrpe_smf.zip
# mv nrpe/manifest/nagios-nrpe.xml /var/svc/manifest/network
# mv nrpe/method/nagios-nrpe /lib/svc/method/nagios-nrpe
# svccfg import /var/svc/manifest/network/nagios-nrpe.xml
# svcadm disable nrpe
# svcadm enable nrpe

To check if nrpe is working you should see the following

# svcs | grep nrpe
online         May_29   svc:/network/nagios/nrpe:default
# netstat -a | grep 5666
      *.5666               *.*                0      0 49152      0 LISTEN

If svcs doesnt show the service as online, you can check the SMF log file /var/svc/log/network-nagios-nrpe:default.log.

If things still arent working, execute /lib/svc/method/nagios-nrpe manually with some bourne debugging. This will show you what the nagios-nrpe script is trying to do.

# sh -x /lib/svc/method/nagios-nrpe
  • aerosmith

    WROKS LIKE CHARM

    create /opt/csw/etc/nrpe.cfg chown nagios:nagios /opt/csw/etc/nrpe.cfg chmod ug+x /lib/svc/method/nagios-nrpe

    ;)

    Thanks

  • http://www.mikemcdonough.net Mike McDonough

    I seemd to have two services installed! One from the pkg-get install and the other using this processes

    svcs | grep nrpe offline 14:01:20 svc:/network/cswnrpe:default offline 14:14:08 svc:/network/nagios/nrpe:default

    I don;t think this is correct. I also can’t get either to come online.

    sh -x /lib/svc/method/nagios-nrpe + . /lib/svc/share/smf_include.sh SMF_EXIT_OK=0 SMF_EXIT_ERR_FATAL=95 SMF_EXIT_ERR_CONFIG=96 SMF_EXIT_MON_DEGRADE=97 SMF_EXIT_MON_OFFLINE=98 SMF_EXIT_ERR_NOSMF=99 SMF_EXIT_ERR_PERM=100 PREFIX=/opt/csw ETC=/opt/csw/etc BIN=/opt/csw/bin PID_FILE=/var/run/nrpe.pid nrpe_daemon=/opt/csw/bin/nrpe -c /opt/csw/etc/nrpe.cfg -d + [ -f /opt/csw/bin/nrpe ] + exit 0

  • Dave

    It works up to the point where the procedures asks me to do the following:

    mv nrpe/manifest/nagios-nrpe.xml /var/svc/manifest/network

    But the directory /var/svc doesn’t exist.

    Does anyone know how to do this on Solaris 8?

  • http://www.mikemcdonough.net Mike McDonough

    I ended up removing the prior compiled version of NRPE from /usr/local/. The copy from plastwave loads its service as cswnrpe so I have to do a ‘svcadm enable cswnrpe’ to get it to work.

  • http://sergiusesn.blogspot.com Sergio Enrique Schvezov

    smf is for solaris 10 and above. You should add the service manually for Solaris 8 in /etc/init.d/ and add it to /etc/rc2.d or /etc/rc3.d …

  • luke

    I cannot get this to work for me…..

    I run the following from my nagios server (nagios-host)

    $ check_npre -n -H remote-nrpe-host CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.

    nrpe[27079]: [ID 601491 daemon.notice] Starting up daemon nrpe[27081]: [ID 813741 daemon.error] Error: Could not complete SSL handshake. 1

    cat /opt/csw/etc/nrpe.cfg | grep allowed_hosts allowed_hosts=nagios-host

    Why is it constantly trying to perform an SSL handshake?

  • http://cyruspy.wordpress.com Ciro

    How was it so far?, this starts NRPE on our Solaris Host, but each execution gives EXIT_CODE=0, no matter what is the real state (OK, WARNING or CRITICAL).

  • anbarasu a

    Getting  SSL Handshake error – 

    CHECK_NRPE: Error – Could not complete SSL handshake. 

    kindly suggest where exactly problem lies.

Previous post:

Next post: