nagios mysql配置_Nagios部署+远程MySQL监控+PNP图表环境配置

系统环境: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"

# 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

Alias /nagios "/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

这就是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 .php0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值