nagios 监控环境搭建
2015-01-31 18:37
316 查看
所用: nagios-3.5.1.tar.gz
nagios-plugins-2.0.3.tar.gz
httpd-2.2.29.tar.gz
php-5.5.20.tar.gz
http://pan.baidu.com/s/1jGnAPM2
1.创建用户(nagios)
useradd -s /sbin/nologin nagios
2.创建安装目录
mkdir /usr/local/nagios
3.赋予权限
chown -R nagios.nagios /usr/local/nagios/
4.安装nagios
tar -xvf nagios-3.5.1.tar.gz
make all
make install
make install-init #安装主程序html,cgi 模块
make install-commandmode #配置目录权限
make install-config #安装配置文件
5.设置开机自启动nagios
cd /usr/local/nagios/bin
chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --list nagios
6.安装nagios插件nagios-plugins
tar -xvf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
./configure --prefix=/usr/local/nagios/
make
make install
7.安装apache2 与php
tar -xvf httpd-2.2.29.tar.gz
cd httpd-2.2.29
./configure --prefix=/usr/local/apache2
make
make install
tar -xvf php-5.5.20.tar.gz
cd php-5.5.20
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
make
make install
修改apache的配置文件httpd.conf
将
User daemon
Group daemon
更改为
User nagios
Group nagios
将
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
更改为
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
在<IfModule mime_module>中添加
AddType application/x-httpd-php .php #支持php
在末尾处添加:
#setting for 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
Deny from nothing
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"
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
</Directory>
创建用户名,密码
/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd ixdba
输入密码即可。用户名为ixdba
启动apache
访问:http://ip/nagios/ 输入用户名 ixdba,密码登陆即可。
检测配置是否正确
../bin/nagios -v nagios.cfg
如果有错误信息,会直接提示出来
配置
hosts.cfg 文件 检测主机的配置文件 默认系统没有带,需要自己手写配置。我一般将此文件放置在nagios/etc/objects目录下
vi hosts.cfg
service.cfg 文件 主要提供检测服务器的命令文件。默认系统没有带,需要自己手写配置。我一般将此文件放置在nagios/etc/objects目录下
vi service.cfg
nagios.cfg nagios 的主要配置文件位于 nagios/etc目录下
vi nagios.cfg
再次检测nagios 的配置文件
启动与关闭 nagios
开启apache 服务 登陆访问 查看服务器状态
nagios-plugins-2.0.3.tar.gz
httpd-2.2.29.tar.gz
php-5.5.20.tar.gz
http://pan.baidu.com/s/1jGnAPM2
1.创建用户(nagios)
useradd -s /sbin/nologin nagios
2.创建安装目录
mkdir /usr/local/nagios
3.赋予权限
chown -R nagios.nagios /usr/local/nagios/
4.安装nagios
tar -xvf nagios-3.5.1.tar.gz
make all
make install
make install-init #安装主程序html,cgi 模块
make install-commandmode #配置目录权限
make install-config #安装配置文件
5.设置开机自启动nagios
cd /usr/local/nagios/bin
chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --list nagios
6.安装nagios插件nagios-plugins
tar -xvf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
./configure --prefix=/usr/local/nagios/
make
make install
7.安装apache2 与php
tar -xvf httpd-2.2.29.tar.gz
cd httpd-2.2.29
./configure --prefix=/usr/local/apache2
make
make install
tar -xvf php-5.5.20.tar.gz
cd php-5.5.20
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
make
make install
修改apache的配置文件httpd.conf
将
User daemon
Group daemon
更改为
User nagios
Group nagios
将
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
更改为
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
在<IfModule mime_module>中添加
AddType application/x-httpd-php .php #支持php
在末尾处添加:
#setting for 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
Deny from nothing
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"
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
</Directory>
创建用户名,密码
/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd ixdba
输入密码即可。用户名为ixdba
启动apache
访问:http://ip/nagios/ 输入用户名 ixdba,密码登陆即可。
检测配置是否正确
../bin/nagios -v nagios.cfg
如果有错误信息,会直接提示出来
配置
hosts.cfg 文件 检测主机的配置文件 默认系统没有带,需要自己手写配置。我一般将此文件放置在nagios/etc/objects目录下
vi hosts.cfg
service.cfg 文件 主要提供检测服务器的命令文件。默认系统没有带,需要自己手写配置。我一般将此文件放置在nagios/etc/objects目录下
vi service.cfg
nagios.cfg nagios 的主要配置文件位于 nagios/etc目录下
vi nagios.cfg
再次检测nagios 的配置文件
启动与关闭 nagios
开启apache 服务 登陆访问 查看服务器状态
相关文章推荐
- 搭建基于nginx环境的nagios监控系统 推荐
- Nagios监控环境搭建
- 搭建基于nginx环境的nagios监控系统
- nagios1------搭建nagios监控环境
- nagios监控环境搭建
- 一起搭建linux监控平台之nagios(二)监控端环境部署
- ubuntu下nagios监控环境搭建
- nagios环境搭建与监控mysql,脚本编写
- nagios监控之(运行环境搭建)
- 一起搭建linux监控平台之nagios(一)lamp环境
- 一起搭建linux监控平台之nagios(三)被监控端的环境部署
- linux系统下Nagios+rrdtool+Pnp4nagios监控环境的搭建
- linux下mrtg,cacti,nagios,ganglia的搭建和win/linux主机等的监控。 推荐
- 基于fedora16的nagios环境搭建--个人日记(2)--搭建lamp环境
- 基于fedora16的nagios环境搭建--个人日记(8)--cacti安装
- 基于fedora16的nagios环境搭建--个人日记(4)--飞信报警
- 基于fedora16的nagios环境搭建--个人日记(3)--nagios安装
- nagios监控服务器搭建
- 在Nginx中搭建Nagios监控平台
- 基于fedora16的nagios环境搭建--个人日记(6)--nagvis安装