博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CentOS6.8安装nagios-4.4.1
阅读量:5938 次
发布时间:2019-06-19

本文共 4735 字,大约阅读时间需要 15 分钟。

Security-Enhanced Linux

This guide is based on SELinux being disabled or in permissive mode. Steps to do this are as follows.

sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config setenforce 0

Prerequisites

Perform these steps to install the pre-requisite packages

yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix.

Downloading the Source

cd /tmp

wget -O nagioscore.tar.gz
tar xzf nagioscore.tar.gz

Compile

cd /tmp/nagioscore-nagios-4.4.1/

./configure
make all

Create User And Group

This creates the nagios user and group. The apache user is also added to the nagios group.

make install-groups-users
usermod -a -G nagios apache

Install Binaries

This step installs the binary files, CGIs, and HTML files.

make install

Install Service / Daemon

This installs the service or daemon files and also configures them to start on boot. The Apache httpd service is also configured at this point.

make install-daemoninit
chkconfig --level 2345 httpd on

Install Command Mode

This installs and configures the external command file.

make install-commandmode

Install Configuration Files

This installs the SAMPLE configuration files. These are required as Nagios needs some configuration files to allow it to start.

make install-config

Install Apache Config Files

This installs the Apache web server configuration files. Also configure Apache settings if required.

make install-webconf

Configure Firewall

You need to allow port 80 inbound traffic on the local firewall so you can reach the Nagios Core web interface.

iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT service iptables save
ip6tables -I INPUT -p tcp --destination-port 80 -j ACCEPT service ip6tables save

Create nagiosadmin User Account

You'll need to create an Apache user account to be able to log into Nagios.

The following command will create a user account called nagiosadmin and you will be prompted to provide a password for the account.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Start Apache Web Server

service httpd start

Start Service / Daemon

service nagios start

Test Nagios

Nagios is now running, to confirm this you need to log into the Nagios Web Interface.

Point your web browser to the ip address or FQDN of your Nagios Core server, for example:
You will be prompted for a username and password. The username is nagiosadmin (you created it in a previous step) and the password is what you provided earlier. Once you have logged in you are presented with the Nagios interface. Congratulations you have installed Nagios Core.

BUT WAIT ...

Currently you have only installed the Nagios Core engine. You'll notice some errors under the hosts and services along the lines of:

(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory
These errors will be resolved once you install the Nagios Plugins, which is covered in the next step.

Installing The Nagios Plugins

Nagios Core needs plugins to operate properly. The following steps will walk you through installing Nagios Plugins.

These steps install nagios-plugins 2.2.1. Newer versions will become available in the future and you can use those in the following installation steps. Please see the releases page on GitHub for all available versions.
Please note that the following steps install most of the plugins that come in the Nagios Plugins package. However there are some plugins that require other libraries which are not included in those instructions. Please refer to the following KB article for detailed installation instructions:
Documentation - Installing Nagios Plugins From Source.

Prerequisites

Make sure that you have the following packages installed.

yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release
yum install -y perl-Net-SNMP

cd /tmp

wget
rpm -ihv epel-release-latest-6.noarch.rpm
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils
yum install -y perl-Net-SNMP

Downloading The Source

cd /tmp

wget --no-check-certificate -O
nagios-plugins.tar.gz
tar zxf nagios-plugins.tar.gz

Compile + Install

cd /tmp/nagios-plugins-release-2.2.1/

./tools/setup ./configure
make make install

Test Plugins

Point your web browser to the ip address or FQDN of your Nagios Core server, for example:

Go to a host or service object and "Re-schedule the next check" under the Commands menu. The error you previously saw should now disappear and the correct output will be shown on the screen.

Service / Daemon Commands

service nagios start

service nagios stop
service nagios restart
service nagios status

详细信息请参考

转载于:https://blog.51cto.com/437549/2318764

你可能感兴趣的文章
关于System.Collections空间
查看>>
MPP(大规模并行处理)
查看>>
Centos下基于Hadoop安装Spark(分布式)
查看>>
Java 位运算
查看>>
好用的CSS模块化打包工具CSS-COMBO
查看>>
python 中的字符和字符串
查看>>
C#Winform限制Textbox只能输入数字
查看>>
EL表达式经典用法
查看>>
java.lang.NoClassDefFoundError: javax/mail/Authenticator
查看>>
联想集团涨超7% 杨元庆持股比例升至8.12%
查看>>
各省光伏十三五规划汇总:总规模将超130GW
查看>>
Apache Storm 官方文档 —— 常用模式
查看>>
聊聊JVM的年轻代
查看>>
lvm逻辑卷管理
查看>>
VS2010不能断点/下断的问题
查看>>
[Android]权限处理
查看>>
Spark bind on port 0. Attempting port 1 问题解决
查看>>
兼容所有浏览器的复制到剪切板功能,悬浮层不能复制问题解决
查看>>
day 20 第一阶段考试总结
查看>>
我的友情链接
查看>>