Install NRPE v3 to Remote Client
cd /tmp
wget --no-check-certificate -O nrpe.tar.gz https://github.com/NagiosEnterprises/nrpe/archive/nrpe-3.2.1.tar.gz
tar xzf nrpe.tar.gz
cd /tmp/nrpe-nrpe-3.2.1/
./configure --enable-command-args
make all
make install
make install-config
echo >> /etc/services
echo '# Nagios services' >> /etc/services
echo 'nrpe 5666/tcp' >> /etc/services
make install-init
nano /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1,192.168.xx.xx
service nrpe start
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
How to fix Nagios NRPE: Unable to read output issue
apt-get install nagios-plugins
cp /usr/lib/nagios/plugins/check_* /usr/local/nagios/libexec
Download memory monitor tool to Remote Client
cd /usr/lib/nagios/plugins/
wget https://raw.githubusercontent.com/justintime/nagios-plugins/master/check_mem/check_mem.pl
mv check_mem.pl check_mem
chmod +x check_mem
./check_mem -f -w 20 -c 10
How to set and add commands to remote nrpe client
nano /usr/local/nagios/etc/nrpe.cfg
Find Default Commands
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -r -w .15,.10,.05 -c .30,.25,.20
command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
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
Add your Commands
command[check_cpu]=/usr/local/nagios/libexec/check_load -r -w .001,.002,.003 -c .004,.005,.006
command[check_mem]=/usr/local/nagios/libexec/check_mem -f -w 51 -c 50
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 99% -c 90% -p /dev/mapper/openfire402--vg-root
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
service nrpe restart
How to set and add commands to Monitor Server
nano /usr/local/nagios/etc/servers/client.cfg
define host{
use linux-server
host_name Openfire402
alias server
address 192.168.0.102
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
}
define service {
use generic-service
host_name Openfire402
service_description SSH
check_command check_ssh
notifications_enabled 1
}
define service {
use generic-service
host_name Openfire402
service_description PING
check_command check_ping!100.0,20%!500.0,60%
notifications_enabled 1
}
define service {
use generic-service
host_name Openfire402
service_description CPU
check_command check_nrpe!check_cpu
notifications_enabled 1
}
define service {
use generic-service
host_name Openfire402
service_description RAM
check_command check_nrpe!check_mem
notifications_enabled 1
}
define service {
use generic-service
host_name Openfire402
service_description Disk
check_command check_nrpe!check_disk
notifications_enabled 1
}
define service {
use generic-service
host_name Openfire402
service_description Swap
check_command check_nrpe!check_swap
notifications_enabled 1
}
Install SSL and SendEmail package
apt-get install libio-socket-ssl-perl libnet-ssleay-perl perl
apt-get install sendemail
touch /var/log/sendemail
chmod 666 /var/log/sendemail
Set SMTP AUTHENTICATION
nano /usr/local/nagios/etc/resource.cfg
$USER5$=xxx@gmail.com
$USER6$=smtp.gmail.com:587
$USER7$=username
$USER8$=password
Back up and modify email command
cd /usr/local/nagios/etc/objects/
cp commands.cfg commands-old.cfg
nano commands.cfg
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/sendemail -s $USER6$ -xu $USER7$ -xp $USER8$ -t $CONTACTEMAIL$ -f $USER5$ -l /var/log/sendemail -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/sendemail -s $USER6$ -xu $USER7$ -xp $USER8$ -t $CONTACTEMAIL$ -f $USER5$ -l /var/log/sendemail -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$"
}
This is really an amazing post, thanks for sharing such a valuable information with us, keep sharing!!
回覆刪除DevOps Online Training institute
DevOps Online Training in Hyderabad
This is good site and nice point of view.I learnt lots of useful information.
回覆刪除DevOps Training in Bangalore | Certification | Online Training Course institute | DevOps Training in Hyderabad | Certification | Online Training Course institute | DevOps Training in Coimbatore | Certification | Online Training Course institute | DevOps Online Training | Certification | Devops Training Online
Excellent Blog! I would Thanks for sharing this wonderful content.its very useful to us.Great site and a great topic as well I really get amazed to read this.
回覆刪除oracle training in chennai
oracle training institute in chennai
oracle training in bangalore
oracle training in hyderabad
oracle training
hadoop training in chennai
hadoop training in bangalore