共计 2955 个字符,预计需要花费 8 分钟才能阅读完成。
注:
本文档基于 nagios+apache 的模式,安装 nagios 时须预先编译安装 apache,在此不进行 apache 编译安装的赘述。
一:配置 apache
# vi /usr/local/apache/conf/extra/httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName 192.168.189.132
DocumentRoot “/www”
<Directory “/www”>
Order deny,allow
Deny from all
</Directory>
#以下是 apache 上,nagios 所需的配置信息:
Scriptalias/nagios/cgi-bin /usr/local/nagios/sbin
<directory”/usr/local/nagios/sbin”>
Authtype basic
Options execcgi
Allowoverride none
Order allow,deny
Allow from all
Authname “nagios access”
Authuserfile /usr/local/nagios/etc/htpasswd
Require valid-user
</directory>
Alias /nagios /usr/local/nagios/share
<directory”/usr/local/nagios/share”>
Authtype basic
Options none
Allowoverride none
Order allow,deny
Allow from all
Authname “nagios access”
// 配置 nagios 用户验证
Authuserfile /usr/local/nagios/etc/htpasswd
Require valid-user
</directory>
</VirtualHost>
二:创建 nagios 用户与组
# useradd nagios
# groupadd nagios
# usermod –a –Gnagios nobody
# usermod –a –Gnagios nagios
二:下载 nagios 相关软件包,并编译安装及环境配置
# cd /usr/local/src
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz
# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
# wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz
# tar -zxvf nagios-3.4.1.tar.gz
# tar -zxvf nagios-plugins-1.4.16.tar.gz
# tar -zxvf nagios/nrpe-2.13.tar.gz
编译安装 nagios
# cd nagios-3.4.1/
# ./configure –prefix=/usr/local/nagios –with-command-group=nagios
# make all
# make install
# make install-init
# make install-commandmode
# make install-config
编译安装 nagios 插件
# cd ../nagios-plugins-1.4.16
# ./configure –prefix=/usr/local/nagios –with-nagios-user=nagios –with-nagios-group=nagios
# make && make install
编译安装 nrpe
# cd ../nrpe-2.13
# ./configure –prefix=/usr/local/nagios
# make all
# make install-plugin
设置 nagios 目录权限
# chown –R nagios:nagios /usr/local/nagios/
配置用户密码访问
# /usr/local/apache/bin/htpasswd -cm /usr/local/nagios/etc/htpasswd nagiosadmin
New password:
Re-type new password:
Adding password for usernagiosadmin
三:启用 nagios,并访问测试
开启 apache 服务
# /usr/local/apache/bin/apachectl -k start
检测 nagios 配置文件语法是否正确
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
若语法正确,则可以正常启动 nagios
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg -d
(也可使用系统服务方式启动:service nagios start)
页面访问测试
出现以上页面,说明 nagios 安装部署成功。后续需在服务中添加主机与服务,方能开始进行监控。
更多 MongoDB 相关教程见以下内容:
CentOS 编译安装 MongoDB 与 mongoDB 的 php 扩展 http://www.linuxidc.com/Linux/2012-02/53833.htm
CentOS 6 使用 yum 安装 MongoDB 及服务器端配置 http://www.linuxidc.com/Linux/2012-08/68196.htm
Ubuntu 13.04 下安装 MongoDB2.4.3 http://www.linuxidc.com/Linux/2013-05/84227.htm
MongoDB 入门必读(概念与实战并重) http://www.linuxidc.com/Linux/2013-07/87105.htm
Ubunu 14.04 下 MongoDB 的安装指南 http://www.linuxidc.com/Linux/2014-08/105364.htm
《MongoDB 权威指南》(MongoDB: The Definitive Guide)英文文字版[PDF] http://www.linuxidc.com/Linux/2012-07/66735.htm
Nagios 监控 MongoDB 分片集群服务实战 http://www.linuxidc.com/Linux/2014-10/107826.htm
基于 CentOS 6.5 操作系统搭建 MongoDB 服务 http://www.linuxidc.com/Linux/2014-11/108900.htm
MongoDB 的详细介绍:请点这里
MongoDB 的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-02/140487.htm