In this tutorial i will tell you how to install Nagios Core 4.1.1 and Nagios Plugins 2.1.1 on RHEL Linux server. Following all steps were performed and tested on RHEL 7.3 Linux Server.
Step 01 : Disable SELinux
Disable the SELinux by running the following command with root user.
Note: setenforce is a command line utility that is used to switch the mode SELinux is running in from enforcing to permissive and vice versa without requiring a reboot.
Modify /etc/selinux/config and change enforcing to disabled
Step 02: Install the required packages
Make sure you have installed the following packages on your Linux system before continuing.
Apache 2
PHP
GCC compiler and development libraries
GD development libraries
If you did not install then please run the following commands:
GCC compiler and development libraries :
GNU Compiler Collection. gcc, formerly known as the GNU C Compiler, compiles multiple languages (C, C++, Objective-C, Ada, FORTRAN, and Java) to machine code.
GD development libraries :
The GD library is a graphics drawing library that provides tools for manipulating image data. In Shopp, the GD library is used to process images for generating gallery preview and thumbnail size images automatically.
net-snmp:
Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment (eg. routers), computer equipment and even devices like UPSs.
And helps Nagios for notification emails.
openssl-devel:
OpenSSL is a toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.
php-cli : PHP Command Line Interface
Step 03: Create Account Information
Create the Nagios user
The usermod command modifies the system account files to reflect the changes that are specified on the command line.
-a, --append
Add the user to the supplementary group(s). Use only with the -G option.
-G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
A list of supplementary groups which the user is also a member of.
Step 04: Download and Install Nagios
Run the following commands to download and extract Nagios and Nagios plugins in /tmp directory.
cd nagios-4.1.1
Run the Nagios configure script, passing the name of the group you created earlier like so:
We now need to create a password for the nagiosadmin user. This will be used to login to your core web GUI.
Step 06: Start Nagios and Apache server
Enter the following url into the browser, replace your public IP of nagios server. It will ask to enter username and password. In this configuration we have username as nagiosadmin and password also as nagiosadmin.
http://<public_ip_of_nagios_server>/nagios/
Step 08: Troubleshooting
If you cannot access the Nagios web page, it may be related to your firewall rules. The following command will open up port 80 on your Nagios Core machine.
and look for the part that says 'Listen :80'. Modify it to be 'Listen 0.0.0.0:80'. Then, run service httpd restart.
Step 01 : Disable SELinux
Disable the SELinux by running the following command with root user.
$ setenforce 0
Basically this a security feature of the Linux kernel. It is designed to protect the server against misconfigurations and/or compromised daemons.Note: setenforce is a command line utility that is used to switch the mode SELinux is running in from enforcing to permissive and vice versa without requiring a reboot.
Modify /etc/selinux/config and change enforcing to disabled
Need personal assistance on Nagios? Please contact me at immukesh72@gmail.comat very nominal charges |
---|
Step 02: Install the required packages
Make sure you have installed the following packages on your Linux system before continuing.
Apache 2
PHP
GCC compiler and development libraries
GD development libraries
If you did not install then please run the following commands:
sudo yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp openssl-devel wget unzip -y
Note:GCC compiler and development libraries :
GNU Compiler Collection. gcc, formerly known as the GNU C Compiler, compiles multiple languages (C, C++, Objective-C, Ada, FORTRAN, and Java) to machine code.
GD development libraries :
The GD library is a graphics drawing library that provides tools for manipulating image data. In Shopp, the GD library is used to process images for generating gallery preview and thumbnail size images automatically.
net-snmp:
Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment (eg. routers), computer equipment and even devices like UPSs.
And helps Nagios for notification emails.
openssl-devel:
OpenSSL is a toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.
php-cli : PHP Command Line Interface
Step 03: Create Account Information
Create the Nagios user
useradd nagios
Create a new nagcmd group for allowing external commands to be submitted through the web interface.
groupadd nagcmd
Add both the nagios user and the apache user to the group nagcmd.
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
Where :usermod -a -G nagcmd apache
The usermod command modifies the system account files to reflect the changes that are specified on the command line.
-a, --append
Add the user to the supplementary group(s). Use only with the -G option.
-G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
A list of supplementary groups which the user is also a member of.
Step 04: Download and Install Nagios
Run the following commands to download and extract Nagios and Nagios plugins in /tmp directory.
cd /tmp
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
tar zxf nagios-4.1.1.tar.gz
tar zxf nagios-plugins-2.1.1.tar.gz
Go to nagios-4.1.1 directory and start compiling Nagios.wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
tar zxf nagios-4.1.1.tar.gz
tar zxf nagios-plugins-2.1.1.tar.gz
cd nagios-4.1.1
Run the Nagios configure script, passing the name of the group you created earlier like so:
./configure --with-command-group=nagcmd
Compile the Nagios source code.
make all
Install binaries, init script, sample config files and set permissions on the external command directory.
make install
make install-init
make install-config
make install-commandmode
Configure the Web Interfacemake install-init
make install-config
make install-commandmode
make install-webconf
Same way install the Nagios plugin as well.
cd /tmp/nagios-plugins-2.1.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
make all
make install
Step 05: Creating a password for nagiosadmin./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
make all
make install
We now need to create a password for the nagiosadmin user. This will be used to login to your core web GUI.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Step 06: Start Nagios and Apache server
service httpd start
service nagios start (or) /etc/init.d/nagios start
Step 07: Login to the Web Interfaceservice nagios start (or) /etc/init.d/nagios start
Enter the following url into the browser, replace your public IP of nagios server. It will ask to enter username and password. In this configuration we have username as nagiosadmin and password also as nagiosadmin.
http://<public_ip_of_nagios_server>/nagios/
Step 08: Troubleshooting
If you cannot access the Nagios web page, it may be related to your firewall rules. The following command will open up port 80 on your Nagios Core machine.
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
If you don't have firewall-cmd then try the following rule into your iptablesfirewall-cmd --reload
iptables -A INPUT -p tcp --dport http -j ACCEPT
iptables -A INPUT -p tcp --dport https -j ACCEPT
iptables-save > /etc/sysconfig/iptables
/etc/init.d/iptables restart
If you are still unable to access the web GUI, your web server may be only listening on IPv6. Modify /etc/httpd/conf/httpd.confiptables -A INPUT -p tcp --dport https -j ACCEPT
iptables-save > /etc/sysconfig/iptables
/etc/init.d/iptables restart
and look for the part that says 'Listen :80'. Modify it to be 'Listen 0.0.0.0:80'. Then, run service httpd restart.
Need personal assistance on Nagios? Please contact me at immukesh72@gmail.comat very nominal charges |
---|
No comments:
Post a Comment