Nagios agents

Installing Nagios agents on Linux distros.

If the operating system (linux) is the same distro&version on Server as on the Clients, just copy the full plugin's&binaries from the server to the agent systems.



On Debian/Raspbian:

apt-get install autoconf libmcrypt-dev libssl-dev wget git-core dstat lsof telnet dnsutils ethtool nmap arp-scan traceroute zip unzip python-dev  bc mcrypt sysstat nmon speedtest-cli msmtp msmtp-mta mailutils mutt wiringpi iperf rcs screen expect libmcrypt*

On RHEL/CentOS 7:

yum install -y openssl gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils net-snmp-perl git bc bind-utils zip unzip lsof dstat telnet ethtool nmap traceroute mutt screen expect mailx policycoreutils-python setools-console
EPEL required: yum install -y epel-release iperf libmcrypt libmcrypt-devel mcrypt nmon msmtp 

On Arch Linux:

pacman --noconfirm -S autoconf gcc glibc make openssl wget perl gettext net-snmp perl-net-snmp automake autoconf libmcrypt openssl unzip apache php gd traceroute php-apache libmariadbclient dnsutils openssh sudo inetutils cronie man-db man-pages s-nail git dstat lsof ethtool nmap arp-scan zip unzip bc sysstat nmon speedtest-cli msmtp msmtp-mta mailutils mutt wiringpi iperf screen expect

On FreeBSD:

pkg install -y wget autoconf automake gmake gettext gcc openssl net-snmp p5-Net-SNMP-Util bind-tools dtrace-toolkit sudo libmcrypt git lsof nmap arp-scan zip unzip mcrypt msmtp mailutils mutt iperf screen expect


NRPE/NSCA client:
groupadd -g 5666 nagios
useradd -u 5666 -g nagios -c "Nagios user for monitoring" -d /usr/local/nagios -m nagios

mkdir /usr/local/nagios
mkdir /usr/local/nagios/etc
mkdir /usr/local/nagios/etc/inputs
mkdir /usr/local/nagios/tmp
mkdir /usr/local/nagios/bin
mkdir /usr/local/nagios/libexec
mkdir /usr/local/nagios/libexec/ak72
mkdir /usr/local/nagios/var
mkdir /usr/local/nagios/var/tmp
chown -R nagios:nagios /usr/local/nagios

Nagios plugins:
tar zxvf nagios-plugins-2.3.3.tar.gz
cd ../nagios-plugins-2.#.#
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make install

cp -p /usr/local/nagios/libexec/check_http /usr/local/nagios/libexec/check_https

NRPE Client:
tar zxvf nrpe-4.#.#.tar.gz
make all
make install
make install-config
make install-init

systemctl enable nrpe
systemctl start nrpe

##CentOS 8: iptables -I INPUT -p tcp -m tcp --destination-port 5666 -j ACCEPT
iptables -I IN_public_allow -p tcp -m tcp --destination-port 5666 -j ACCEPT
#firewall-cmd --zone=public --add-port=http/tcp
#firewall-cmd --zone=public --add-port=http/tcp --permanent
firewall-cmd --zone=public --add-port=5666/tcp
firewall-cmd --zone=public --add-port=5666/tcp --permanent


NSCA Client:

tar zxvf nsca-2.#.#.tar.gz
make all

#cp -p src/nsca /usr/local/nagios/bin/
#chown nagios:nagios /usr/local/nagios/bin/nsca

cp -p src/send_nsca /usr/local/nagios/libexec/
chown nagios:nagios /usr/local/nagios/libexec/send_nsca

#cp -p sample-config/nsca.cfg /usr/local/nagios/etc/
#chown nagios:nagios /usr/local/nagios/etc/nsca.cfg
#chmod 600 /usr/local/nagios/etc/nsca.cfg

scp -p unix4life:/usr/local/nagios/libexec/send_nsca.cfg <remotehost>:/usr/local/nagios/libexec/send_nsca.cfg
scp -p unix4life:/usr/local/nagios/etc/nrpe.cfg redberry:/usr/local/nagios/etc/
scp -p -r unix4life:/usr/local/nagios/libexec/eventhandlers redberry:/usr/local/nagios/libexec/
scp -p -r unix4life:/usr/local/nagios/libexec/ak72 redberry:/usr/local/nagios/libexec/

chown -R nagios:nagios /usr/local/nagios