Jump to content

Solaris client configuration for Nagios for Sandhar

From TetraWiki


    1. Find the Version of the Oracle Solaris OS

root@stl-dev:~# uname -a SunOS stl-dev 5.11 11.1 sun4v sparc sun4v

root@stl-dev:~# cat /etc/release

                           Oracle Solaris 11.1 SPARC
 Copyright (c) 1983, 2013, Oracle and/or its affiliates.  All rights reserved.
                          Assembled 06 November 2013

root@stl-dev:~#

root@stl-dev:~# mkdir Nagios

root@stl-dev:~# cd Nagios/

root@stl-dev:~/Nagios#


    1. Copy the /usr/local/nagios folder from running server and paste it on working server in /usr/local/
    1. From source server to destination run below command:

root@stl-dev-test:~# scp -rp /usr/local/nagios/ root@172.17.16.4:/usr/local/ The authenticity of host '172.17.16.4 (172.17.16.4)' can't be established. RSA key fingerprint is 6a:d4:ac:ad:da:dc:59:7c:b3:47:06:6f:ad:d8:7f:b0. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '172.17.16.4' (RSA) to the list of known hosts. Password: local.profile 100% |**************************************************************************| 131 00:00 local.login 100% |**************************************************************************| 170 00:00 .bashrc 100% |**************************************************************************| 159 00:00 local.cshrc 100% |**************************************************************************| 166 00:00 charset.alias 100% |**************************************************************************| 635 00:00 check_log 100% |**************************************************************************| 6014 00:00 check_dig 100% |**************************************************************************| 102 KB 00:00 check_pop 100% |**************************************************************************| 181 KB 00:00 check_flexlm 100% |**************************************************************************| 6314 00:00 check_simap 100% |**************************************************************************| 181 KB 00:00 urlize 100% |**************************************************************************| 116 KB 00:00 check_nwstat 100% |**************************************************************************| 154 KB 00:00 pst3 100% |**************************************************************************| 20752 00:00 check_file_age 100% |**************************************************************************| 3052 00:00 check_time 100% |**************************************************************************| 123 KB 00:00 check_ssmtp 100% |**************************************************************************| 181 KB 00:00 check_swap 100% |**************************************************************************| 341 KB 00:00 check_udp 100% |**************************************************************************| 181 KB 00:00 check_tcp 100% |**************************************************************************| 181 KB 00:00 check_dns 100% |**************************************************************************| 108 KB 00:00 check_ssh 100% |**************************************************************************| 120 KB 00:00 check_ntp_time 100% |**************************************************************************| 132 KB 00:00 check_users 100% |**************************************************************************| 117 KB 00:00 check_icmp 100% |**************************************************************************| 155 KB 00:00 check_rpc 100% |**************************************************************************| 9580 00:00 check_disk 100% |**************************************************************************| 345 KB 00:00 check_cpu 100% |**************************************************************************| 1289 00:00 check_http 100% |**************************************************************************| 413 KB 00:00 check_smtp 100% |**************************************************************************| 362 KB 00:00 check_ping 100% |**************************************************************************| 140 KB 00:00 check_ifoperstatus 100% |**************************************************************************| 15133 00:00 check_load 100% |**************************************************************************| 118 KB 00:00 check_sensors 100% |**************************************************************************| 1137 00:00 check_real 100% |**************************************************************************| 124 KB 00:00 check_breeze 100% |**************************************************************************| 2256 00:00 check_imap 100% |**************************************************************************| 181 KB 00:00 check_by_ssh 100% |**************************************************************************| 136 KB 00:00 check_snmp 100% |**************************************************************************| 343 KB 00:00 utils.pm 100% |**************************************************************************| 1912 00:00 check_overcr 100% |**************************************************************************| 126 KB 00:00 check_mem 100% |**************************************************************************| 4257 00:00 check_clamd 100% |**************************************************************************| 181 KB 00:00 check_mailq 100% |**************************************************************************| 20283 00:00 check_ups 100% |**************************************************************************| 131 KB 00:00 check_oracle 100% |**************************************************************************| 8326 00:00 check_ftp 100% |**************************************************************************| 181 KB 00:00 check_apt 100% |**************************************************************************| 287 KB 00:00 check_dhcp 100% |**************************************************************************| 144 KB 00:00 check_wave 100% |**************************************************************************| 2935 00:00 check_netstat.pl 100% |**************************************************************************| 25602 00:00 check_nntps 100% |**************************************************************************| 181 KB 00:00 check_jabber 100% |**************************************************************************| 181 KB 00:00 utils.sh 100% |**************************************************************************| 862 00:00 negate 100% |**************************************************************************| 120 KB 00:00 check_nntp 100% |**************************************************************************| 181 KB 00:00 check_ifstatus 100% |**************************************************************************| 12597 00:00 check_ircd 100% |**************************************************************************| 6886 00:00 check_nrpe 100% |**************************************************************************| 67832 00:00 check_dummy 100% |**************************************************************************| 93408 00:00 check_disk_smb 100% |**************************************************************************| 8700 00:00 check_spop 100% |**************************************************************************| 181 KB 00:00 check_nagios 100% |**************************************************************************| 120 KB 00:00 check_ntp 100% |**************************************************************************| 132 KB 00:00 check_cluster 100% |**************************************************************************| 110 KB 00:00 check_sstcam 100% |**************************************************************************| 10376 00:00 check_procs 100% |**************************************************************************| 312 KB 00:00 nrpe.cfg 100% |**************************************************************************| 8127 00:00 nrpe 100% |**************************************************************************| 119 KB 00:00 .profile 100% |**************************************************************************| 568 00:00 root@stl-dev-test:~#

    1. Add User nagios:

root@stl-dev:~# useradd -c "Nagios User" -d /usr/local/nagios -m nagios

    1. Add group nagios:

root@stl-dev:~# groupadd nagios

    1. Change group of nagios user:

root@stl-dev:~# usermod -G nagios nagios

    1. Change owner and group of /usr/local/nagios folder:

root@stl-dev:~# chown -R nagios:nagios /usr/local/nagios


    1. Then download nrpe-2.15 or copy from other server.
    1. If you want to download please follow below link:

Download : http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz/download

    1. I have copied it from other server in /root/Nagios directory.
Then extract and and compile it:
To compile gcc package is neccessary if it is not in system please install it.

root@stl-dev:~# pkg install gcc-3

          Packages to install:  1
      Create boot environment: No

Create backup boot environment: No

           Services to change:  1

DOWNLOAD PKGS FILES XFER (MB) SPEED Completed 1/1 319/319 31.5/31.5 0B/s

PHASE ITEMS Installing new actions 394/394 Updating package state database Done Updating image state Done Creating fast lookup database Done


root@stl-dev:~# cd Nagios/

root@stl-dev:~/Nagios# gunzip nrpe-2.15.tar.gz

root@stl-dev:~/Nagios# tar xvf nrpe-2.15.tar

root@stl-dev:~/Nagios# cd nrpe-2.15

root@stl-dev:~/Nagios/nrpe-2.15# ./configure -with-ssl=/usr/sfw/ -with-ssl-lib=/usr/sfw/lib/

root@stl-dev:~/Nagios/nrpe-2.15# make all

        1. Currently there is a bug in 2.12 and 2.15 so if you try and compile it generates the following errors:

  nrpe.c: In function `get_log_facility\92:
  nrpe.c:617: error: `LOG_AUTHPRIV\92 undeclared (first use in this function)
  nrpe.c:617: error: (Each undeclared identifier is reported only once
  nrpe.c:617: error: for each function it appears in.)
  nrpe.c:619: error: `LOG_FTP\92 undeclared (first use in this function)
  *** Error code 1
  make: Fatal error: Command failed for target `nrpe\92
  Current working directory /usr/local/src/nrpe-2.12/src
  *** Error code 1
  make: Fatal error: Command failed for target `all\92

    1. To fix at this time is to comment out the code that calls these two facilities, lines 712-715, in src/nrpe.c:
 /*else if(!strcmp(varvalue,\94authpriv\94))
 log_facility=LOG_AUTHPRIV;
 else if(!strcmp(varvalue,\94ftp\94))
 log_facility=LOG_FTP;*/
    1. UPDATE: You no longer need to comment out these lines, just replace them with the following:
 else if(!strcmp(varvalue,\94authpriv\94))
 log_facility=LOG_AUTH;
 else if(!strcmp(varvalue,\94ftp\94))
 log_facility=LOG_DAEMON; 
    1. Then run again make all:

root@stl-dev:~/Nagios/nrpe-2.15# make all

    1. Now you will get below output:

cd ./src/; make ; cd .. gcc -g -O2 -I/usr/include/openssl -I/usr/include -DHAVE_CONFIG_H -I ../include -I ./../include -o nrpe ./nrpe.c ./utils.c ./acl.c -L/usr/lib -lssl -lcrypto -lnsl -lsocket ./nrpe.c: In function \E2main\E2: ./nrpe.c:236:7: warning: assignment discards qualifiers from pointer target type gcc -g -O2 -I/usr/include/openssl -I/usr/include -DHAVE_CONFIG_H -I ../include -I ./../include -o check_nrpe ./check_nrpe.c ./utils.c -L/usr/lib -lssl -lcrypto -lnsl -lsocket ./check_nrpe.c: In function \E2main\E2: ./check_nrpe.c:136:7: warning: assignment discards qualifiers from pointer target type

      • Compile finished ***

If the NRPE daemon and client compiled without any errors, you can continue with the installation or upgrade process.

Read the PDF documentation (NRPE.pdf) for information on the next steps you should take to complete the installation or upgrade.


root@stl-dev:~/Nagios/nrpe-2.15# make install cd ./src/ && make install make install-plugin /usr/bin/ginstall -c -m 775 -o nagios -g nagios -d /usr/local/nagios/libexec /usr/bin/ginstall -c -m 775 -o nagios -g nagios check_nrpe /usr/local/nagios/libexec make install-daemon /usr/bin/ginstall -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin /usr/bin/ginstall -c -m 775 -o nagios -g nagios nrpe /usr/local/nagios/bin


root@stl-dev:~/Nagios/nrpe-2.15# make install-daemon-config /usr/bin/ginstall -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc /usr/bin/ginstall -c -m 644 -o nagios -g nagios sample-config/nrpe.cfg /usr/local/nagios/etc


    1. Now modify the nrpe.cfg file settings:

root@stl-dev:~/Nagios/nrpe-2.15# vim /usr/local/nagios/etc/nrpe.cfg

server_port=5666 nrpe_user=nagios nrpe_group=nagios allowed_hosts=127.0.0.1,172.17.16.3


command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10 command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 command[check_diskspace]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p / command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 command[check_cpu]=/usr/local/nagios/libexec/check_cpu 50 70 command[check_mem]=/usr/local/nagios/libexec/check_mem -w 25 -c 15 -f


    1. Make below entry in /etc/services file:

root@stl-dev:~/Nagios/nrpe-2.15# vim /etc/services nrpe 5666/tcp # NRPE

    1. Check nrpe service:

root@stl-dev:~/Nagios/nrpe-2.15# ps -ef | grep nrpe

   root   571 25054   0 11:48:05 pts/3       0:00 grep nrpe
    1. Run below command:

root@stl-dev:~/Nagios/nrpe-2.15# /usr/local/nagios/bin/nrpe -n -c /usr/local/nagios/etc/nrpe.cfg -d

    1. Check again nrpe service it should be like below:

root@stl-dev:~/Nagios/nrpe-2.15# ps -ef | grep nrpe

   root   580 25054   0 11:48:50 pts/3       0:00 grep nrpe
 nagios   578     1   0 11:48:48 ?           0:00 /usr/local/nagios/bin/nrpe -n -c /usr/local/nagios/etc/nrpe.cfg -d


root@stl-dev:/usr/local/nagios/libexec# netstat -a | grep nrpe stl-dev.stl.com.nrpe 172.17.16.3.42020 16768 0 128872 0 TIME_WAIT stl-dev.stl.com.nrpe 172.17.16.3.42021 16768 0 128872 0 TIME_WAIT

     *.nrpe               *.*                0      0 128000      0 LISTEN

stl-dev.stl.com.nrpe 172.17.16.3.44390 16768 0 128872 0 TIME_WAIT stl-dev.stl.com.nrpe 172.17.16.3.44399 16768 0 128872 0 TIME_WAIT

     *.nrpe                            *.*                             0      0 128000      0 LISTEN


    1. If nrpe is not LISTEN then please restart ther nrpe service as below:

root@stl-dev:/usr/local/nagios/libexec# ps -ef | grep nrpe

 nagios   578     1   0 11:48:48 ?           0:00 /usr/local/nagios/bin/nrpe -n -c /usr/local/nagios/etc/nrpe.cfg -d
   root   722 25054   0 11:58:24 pts/3       0:00 grep nrpe

root@stl-dev:/usr/local/nagios/libexec# kill -9 578

root@stl-dev:~/Nagios/nrpe-2.15# ps -ef | grep nrpe

   root   571 25054   0 11:48:05 pts/3       0:00 grep nrpe

root@stl-dev:/usr/local/nagios/libexec# /usr/local/nagios/bin/nrpe -n -c /usr/local/nagios/etc/nrpe.cfg -d

root@stl-dev:/usr/local/nagios/libexec# ps -ef | grep nrpe

 nagios   728     1   0 11:58:40 ?           0:00 /usr/local/nagios/bin/nrpe -n -c /usr/local/nagios/etc/nrpe.cfg -d
   root   730 25054   0 11:58:43 pts/3       0:00 grep nrpe