Nagios-Server-Side
[root@nagios ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.mL7UUO: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing… Â Â Â Â Â Â Â Â ########################################### [100%]
1:epel-release      ########################################### [100%]
[root@nagios ~]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Retrieving http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
warning: /var/tmp/rpm-tmp.MpyvoN: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Preparing… Â Â Â Â Â Â Â Â ########################################### [100%]
1:remi-release      ########################################### [100%]
[root@nagios ~]# yum -y install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpd
[root@nagios ~]# service httpd start && service nagios start
Starting httpd: httpd: apr_sockaddr_info_get() failed for nagios
httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
[ Â OK Â ]
Starting nagios: done.
[root@nagios ~]# htpasswd -c /etc/nagios/passwd nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin
[root@nagios ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet 192.169.173.171/32 brd 192.169.173.171 scope global lo:1
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether fa:16:3e:13:28:bb brd ff:ff:ff:ff:ff:ff
inet 10.192.30.122/22 brd 10.192.31.255 scope global eth0
inet6 fe80::f816:3eff:fe13:28bb/64 scope link
valid_lft forever preferred_lft forever
[root@nagios ~]# ls -l /usr/lib64/nagios
total 8
drwxrwxr-x 2 root root 4096 Apr 16 12:20 cgi-bin
drwxrwxr-x 3 root root 4096 Apr 16 12:20 plugins
[root@nagios plugins]# ls -l /usr/lib64/nagios/plugins/
total 2816
-rwxr-xr-x 1 root root   2251 Sep 11  2015 check_breeze
-rwxr-xr-x 1 root root   66632 Sep 11  2015 check_by_ssh
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_clamd -> check_tcp
-rwxr-xr-x 1 root root   50008 Sep 11  2015 check_cluster
-rwsr-x— 1 root nagios  64976 Sep 11  2015 check_dhcp
-rwxr-xr-x 1 root root   62272 Sep 11  2015 check_dig
-rwxr-xr-x 1 root root   70104 Sep 11  2015 check_disk
-rwxr-xr-x 1 root root   9289 Sep 11  2015 check_disk_smb
-rwxr-xr-x 1 root root   71560 Sep 11  2015 check_dns
-rwxr-xr-x 1 root root   35360 Sep 11  2015 check_dummy
-rwxr-xr-x 1 root root   3349 Sep 11  2015 check_file_age
-rwxr-xr-x 1 root root   6315 Sep 11  2015 check_flexlm
-rwsr-x— 1 root nagios  64608 Sep 11  2015 check_fping
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_ftp -> check_tcp
-rwxr-xr-x 1 root root   54464 Sep 11  2015 check_game
-rwxr-xr-x 1 root root   61848 Sep 11  2015 check_hpjd
-rwxr-xr-x 1 root root  140696 Sep 11  2015 check_http
-rwsr-x— 1 root nagios  69696 Sep 11  2015 check_icmp
-rwsr-x— 1 root nagios  53360 Sep 11  2015 check_ide_smart
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_imap -> check_tcp
-rwxr-xr-x 1 root root   6887 Sep 11  2015 check_ircd
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_jabber -> check_tcp
-rwxr-xr-x 1 root root   63440 Sep 11  2015 check_ldap
lrwxrwxrwx 1 root root    10 Apr 16 11:41 check_ldaps -> check_ldap
-rwxr-xr-x 1 root root   54424 Sep 11  2015 check_load
-rwxr-xr-x 1 root root   5989 Sep 11  2015 check_log
-rwxr-xr-x 1 root root   21480 Sep 11  2015 check_mailq
-rwxr-xr-x 1 root root   53464 Sep 11  2015 check_mrtg
-rwxr-xr-x 1 root root   53200 Sep 11  2015 check_mrtgtraf
-rwxr-xr-x 1 root root   78960 Sep 11  2015 check_mysql
-rwxr-xr-x 1 root root   73944 Sep 11  2015 check_mysql_query
-rwxr-xr-x 1 root root   54928 Sep 11  2015 check_nagios
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_nntp -> check_tcp
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_nntps -> check_tcp
-rwxr-xr-x 1 root root   29680 Sep 18  2015 check_nrpe
-rwxr-xr-x 1 root root   69904 Sep 11  2015 check_nt
-rwxr-xr-x 1 root root   67096 Sep 11  2015 check_ntp
-rwxr-xr-x 1 root root   66328 Sep 11  2015 check_ntp_peer
-rwxr-xr-x 1 root root   14283 Sep 11  2015 check_ntp.pl
-rwxr-xr-x 1 root root   62968 Sep 11  2015 check_ntp_time
-rwxr-xr-x 1 root root   78248 Sep 11  2015 check_nwstat
-rwxr-xr-x 1 root root   8779 Sep 11  2015 check_oracle
-rwxr-xr-x 1 root root   59448 Sep 11  2015 check_overcr
-rwxr-xr-x 1 root root   72960 Sep 11  2015 check_pgsql
-rwxr-xr-x 1 root root   68184 Sep 11  2015 check_ping
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_pop -> check_tcp
-rwxr-xr-x 1 root root   66352 Sep 11  2015 check_procs
-rwxr-xr-x 1 root root   58696 Sep 11  2015 check_real
-rwxr-xr-x 1 root root   9581 Sep 11  2015 check_rpc
-rwxr-xr-x 1 root root   1453 Sep 11  2015 check_sensors
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_simap -> check_tcp
-rwxr-xr-x 1 root root   89048 Sep 11  2015 check_smtp
-rwxr-xr-x 1 root root  109680 Sep 11  2015 check_snmp
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_spop -> check_tcp
-rwxr-xr-x 1 root root   56488 Sep 11  2015 check_ssh
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_ssmtp -> check_tcp
-rwxr-xr-x 1 root root   52440 Sep 11  2015 check_swap
-rwxr-xr-x 1 root root   80048 Sep 11  2015 check_tcp
-rwxr-xr-x 1 root root   57704 Sep 11  2015 check_time
lrwxrwxrwx 1 root root     9 Apr 16 11:41 check_udp -> check_tcp
-rwxr-xr-x 1 root root   63560 Sep 11  2015 check_ups
-rwxr-xr-x 1 root root   48168 Sep 11  2015 check_users
-rwxr-xr-x 1 root root   2936 Sep 11  2015 check_wave
drwxr-xr-x 2 root root   4096 Aug 30  2013 eventhandlers
-rwxr-xr-x 1 root root   49376 Sep 11  2015 negate
-rwxr-xr-x 1 root root   46352 Sep 11  2015 urlize
-rw-r–r– 1 root root   2065 Sep 11  2015 utils.pm
-rwxr-xr-x 1 root root   2791 Sep 11  2015 utils.sh
——————————————————————————————————————
                           Nagios-client
[root@li1250-113 ~]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@li1250-113 ~]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
[root@li1250-113 ~]# yum -y install nagios nagios-plugins-all nrpe
[root@li1250-113 ~]# service httpd start && service nagios start
Redirecting to /bin/systemctl start  httpd.service
Redirecting to /bin/systemctl start  nagios.service
[root@li1250-113 ~]# nano /etc/nagios/nrpe.cfg
———————————-
Edit /etc/nagios/nrpe.cfg
log_facility=daemon
pid_file=/var/run/nrpe/nrpe.pid
server_port=5666
nrpe_user=nrpe
nrpe_group=nrpe
allowed_hosts=nagios-server ip address
dont_blame_nrpe=1
debug=0
command_timeout=60
connection_timeout=300
include_dir=/etc/nrpe.d/
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /dev/vda
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200
command[check_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
[root@li1250-113 ~]# iptables -N NRPE
[root@li1250-113 ~]# iptables -I INPUT -s 0/0 -p tcp –dport 5666 -j NRPE
[root@li1250-113 ~]# iptables -I NRPE -s 192.169.173.171 -j ACCEPT
[root@li1250-113 ~]# iptables -A NRPE -s 0/0 -j DROP
[root@li1250-113 ~]# /etc/init.d/iptables save
-bash: /etc/init.d/iptables: No such file or directory
[root@li1250-113 ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ Â OK Â ]
[root@li1250-113 ~]# service iptables reload
Redirecting to /bin/systemctl reload  iptables.service
[root@li1250-113 ~]# netstat -tlpn |grep 5666
[root@li1250-113 ~]# service nrpe start
Redirecting to /bin/systemctl start  nrpe.service
[root@li1250-113 ~]# netstat -tlpn |grep 5666
tcp     0    0 0.0.0.0:5666       0.0.0.0:*        LISTEN    9830/nrpe
tcp6 Â Â Â 0 Â Â Â 0 :::5666 Â Â Â Â Â Â Â Â :::* Â Â Â Â Â Â Â Â Â Â LISTEN Â Â Â 9830/nrpe
[root@li1250-113 ~]# iptables -L
Chain INPUT (policy ACCEPT)
Chain NRPE (1 references)
target   prot opt source        destination
ACCEPT   all  —  ip-192-169-173-171.ip.secureserver.net  anywhere
DROP    all  —  anywhere       anywhere




