系统环境:RHEL6 x86_64 selinux and iptables disabled
Nagios主机:172.25.193.2(server端)
Mysql主机: 172.25.193.3(client端)
Server端:
shell> yum install httpd gcc make gd-devel -y#编译所需软件包
shell> useradd nagios #运行nagios服务的用户
shell> usermod -G nagios apache #使 apache 用户对 nagios 目录具有写权限,不然 web 页面操作失败
shell> tar jxf nagios-cn-3.2.3.tar.bz2 #nagios 软件安装
shell> cd nagios-cn-3.2.3
shell> ./configure
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
shell> tar zxf nagios-plugins-2.1.1.tar.gz
shell> yum install -y mysql-devel openssl-devel
shell> ./configure
shell> make
shell> make install
shell> chown nagios.nagios /usr/local/nagios/
shell> chown -R nagios.nagios /usr/local/nagios/libexec
shell> /etc/init.d/nagios start
shell> htpasswd /usr/local/nagios/etc/htpasswd.users nagiosadmin
shell> cd /usr/local/nagios/etc/objects
shell> cp -p localhost.cfg hosts.cfg
shell> cp -p localhost.cfg services.cfg
shell> vim ./nagios.cfg
shell> vim hosts.cfg
shell> vim services.cfg
Client端
shell>yum install -y mysql-server
shell> /etc/init.d/mysqld start
shell> mysql
mysql> grant select on test.* to nagios@'172.25.193.2' identified by 'redhat';
shell> ./check_mysql -H 172.25.193.3 -u nagios -p redhat
Server端
shell> /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
shell> /etc/init.d/nagios reload
shell> yum install -y rpm-build
shell> rpmbuild -tb ganglia-3.4.0.tar.gz
yum install -y libart_lgpl-devel gcc-c++ python-devel libconfuse-devel pcre-devel autoconf automake libtool expat-devel rrdtool-devel apr-devel
yum install -y rrdtool-devel-1.3.8-6.el6.x86_64.rpm
libconfuse-2.6-3.el6.x86_64.rpm
libconfuse-devel-2.6-3.el6.x86_64.rpm
shell> rpmbuild -tb ganglia-web-3.4.2.tar.gz
cd rpmbuild/RPMS/noarch/
rpm -ivh ganglia-web-3.4.2-1.noarch.rpm
Client端:
shell> rpm -ivh ganglia-gmond-3.4.0-1.x86_64.rpm libganglia-3.4.0-1.x86_64.rpm
libconfuse-2.6-3.el6.x86_64.rpm
libconfuse-devel-2.6-3.el6.x86_64.rpm
shell> vim /etc/ganglia/gmond.conf 修改cluster name
Server端:
shell> cd /etc/ganglia
shell> vim gmetad.conf
shell> vim gmond.conf
shell> /etc/init.d/gmetad start
shell> /etc/init.d/gmond/ start
by Yedda