手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Nagios部署+远程MySQL监控+PNP图表环境配置

[日期:2012-07-01] 来源:Linux社区  作者:linuxkeep [字体: ]

系统环境:RHEL6 x86_64 selinux and iptables disabled
nagios 主机:192.168.0.114
MySQL 主机: 192.168.0.121

一、安装nagios
本实验均采用源码安装,因此卸载掉自带相关软件包httpd和php
[root@nagios ~]# rpm -e `rpm -q httpd` --nodeps
[root@nagios ~]# rpm -e `rpm -q php` --nodeps
1、安装编译所需软件包
[root@nagios ~]# yum install httpd gcc make gd php-gd perl-ExtUtils-Embed.x86_64 libxml2-devel zlib zlib-devel libjpeg-devel -y
[root@nagios ~]# useradd nagios
2、安装监控平台apache
[root@nagios ~]#tar -zxvf httpd-2.0.63.tar.gz
[root@nagios ~]# cd httpd-2.0.63
[root@nagios httpd-2.0.63]# ./configure --prefix=/usr/local/apache2
[root@nagios httpd-2.0.63]# make && make install
3、安装php(因为nagios软件web管理页面属于php格式)
[root@nagios ~]# tar -zxvf php-5.3.2.tar.gz
[root@nagios ~]# cd php-5.3.2
[root@nagios php-5.3.2]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib --with-jpeg-dir
[root@nagios php-5.3.2]# make && make install
4、安装监控软件nagios
[root@nagios ~]# tar -zxvf nagios-3.2.2.tar.gz
[root@nagios ~]# cd nagios-3.2.2
[root@nagios nagios-3.2.2]#./configure --prefix=/usr/local/nagios --with-httpd-conf=/usr/local/apache2/conf
[root@nagios nagios-3.2.2]#make all
*** Compile finished ***

If the main program and CGIs compiled without any errors, you

can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

make install

- This installs the main program, CGIs, and HTML files

make install-init

- This installs the init script in /etc/rc.d/init.d

make install-commandmode

- This installs and configures permissions on the
directory for holding the external command file

make install-config

- This installs *SAMPLE* config files in /usr/local/nagios/etc
You'll have to modify these sample files before you can
use Nagios. Read the HTML documentation for more info
on doing this. Pay particular attention to the docs on
object configuration files, as they determine what/how
things get monitored!

make install-webconf

- This installs the Apache config file for the Nagios
web interface
[root@nagios nagios-3.2.2]# make install
[root@nagios nagios-3.2.2]# make install-init
[root@nagios nagios-3.2.2]# make install-commandmode
[root@nagios nagios-3.2.2]# make install-config
[root@nagios nagios-3.2.2]#make install-webconf
启动apache服务,并查看是否成功
[root@nagios nagios-3.2.2]# /usr/local/apache2/bin/apachectl start
5、安装nagios-plugins插件

[root@nagios ~]#tar -zxvf nagios-plugins-1.4.15.tar.gz
[root@nagios ~]# cd nagios-plugins-1.4.15
[root@nagios nagios-plugins-1.4.15]#./configure --enable-perl-modules --enable-libtap
[root@nagios nagios-plugins-1.4.15]# make && make install
[root@nagios ~]#ls /usr/local/nagios/libexec
check_apt check_dns check_ifstatus check_nntp check_pop check_time
check_breeze check_dummy check_imap check_nt check_procs check_udp
check_by_ssh check_file_age check_ircd check_ntp check_real check_ups
check_clamd check_flexlm check_load check_ntp_peer check_rpc check_users
check_cluster check_ftp check_log check_ntp_time check_sensors check_wave
check_dhcp check_http check_mailq check_nwstat check_smtp negate
check_dig check_icmp check_mrtg check_Oracle check_ssh urlize
check_disk check_ide_smart check_mrtgtraf check_overcr check_swap utils.pm
check_disk_smb check_ifoperstatus check_nagios check_ping check_tcp utils.sh
6、插件已经安装好了,接下来配置nagios访问目录
[root@nagios ~]#cat /usr/local/apache2/conf/nagios.conf
# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file. Customize the paths, etc. as
# needed to fit your system.

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"


<Directory "/usr/local/nagios/sbin">

# SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</Directory>

Alias /nagios "/usr/local/nagios/share"


<Directory "/usr/local/nagios/share">

# SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users  (注意这里的密码文件)
Require valid-user
</Directory>
这就是nagios WEB管理页面的指向
[root@nagios ~]# cat /usr/local/apache2/conf/nagios.conf >> /usr/local/apache2/conf/httpd.conf
修改apache服务的执行用户,允许php首页等
[root@nagios ~]# vim /usr/local/apache2/conf/httpd.conf (约268行)
268 User nobody
269 Group #-1
395 DirectoryIndex index.html index.html.var
改成:
268 User nagios
269 Group nagios
395 DirectoryIndex index.html index.php
396 AddType application/x-httpd-php .php

linux
相关资讯       Nagios  Nagios部署 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款