yum -y install gcc vim
yum -y install httpd httpd-manual mysql mysql-devel mysql-server php php-devel php-mysql php-common php-pdo php-gd lm_sensors net-snmp php-snmp net-snmp-utils
chkconfig mysqld on
chkconfig httpd on
chkconfig snmpd on
chkconfig mysqld on
chkconfig httpd on
chkconfig snmpd on
mysqladmin -u root password '123456'
mysql -u root -p 进入数据库
mysql> create database cacti;
grant all on cacti.* to cactiadmin@localhost identified by '123456';
flush privileges;
yum -y install cairo-devel libxml2-devel pango pango-devel
tar xf rrdtool-1.4.4.tar.gz
cd rrdtool-1.4.4
cd rrdtool-1.4.4
./configure --prefix=/usr/local/rrdtool && make && make install
-bash: make: command not found #按照make
./configure --prefix=/usr/local/rrdtool && make && make install
make[2]: Leaving directory `/root/rrdtool-1.4.4/doc'
Making all in bindings
make[2]: Entering directory `/root/rrdtool-1.4.4/bindings'
make[3]: Entering directory `/root/rrdtool-1.4.4/bindings'
cd perl-piped && /usr/bin/perl Makefile.PL PREFIX=/usr/local/rrdtool LIB=/usr/local/rrdtool/lib/perl/5.10.1
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at Makefile.PL line 1.
BEGIN failed--compilation aborted at Makefile.PL line 1.
make[3]: *** [perl-piped/Makefile] Error 2
make[3]: Leaving directory `/root/rrdtool-1.4.4/bindings'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/rrdtool-1.4.4/bindings'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/rrdtool-1.4.4'
make: *** [all] Error 2
yum -y install perl-ExtUtils-MakeMaker
./configure --prefix=/usr/local/rrdtool && make && make install
ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
tar xf cacti-0.8.7e.tar.gz -C /var/www/html/
cd /var/www/html/
mv cacti-0.8.7e/ cacti
chown -R root.root /var/www/html/cacti/
mysql -u root -p cacti <cacti/cacti.sql
vim /var/www/html/cacti/include/config.php
$database_username = "cactiadmin";
$database_password = "123456";
vim /var/www/html/cacti/include/global.php
$database_username = "cactiadmin";
$database_password = "123456";
yum -y install wget unzip patch
wget http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7e-PA-v2.6.zip
unzip cacti-plugin-0.8.7e-PA-v2.6.zip
cd cacti-plugin-arch/
[root@test cacti-plugin-arch]# cp cacti-plugin-0.8.7e-PA-v2.6.diff /var/www/html/cacti/
[root@test cacti-plugin-arch]# cp pa.sql /var/www/html/cacti/
cd /var/www/html/cacti/
patch -p1 -N <cacti-plugin-0.8.7e-PA-v2.6.diff
mysql -uroot -p cacti<pa.sql
vim include/global.php
$config['url_path'] = '/cacti/';
crontab -e
*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php
service crond restart
http://IP/cacti/install/index.php
http://172.16.21.199/cacti/index.php
useradd -s /sbin/nologins nagios
mkdir -p /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/
tar xf nagios-3.4.1.tar.gz
cd nagios
./configure --prefix=/usr/local/nagios/
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
chkconfig --add nagios
chkconfig nagios on
service nagios start
tar xf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --prefix=/usr/local/nagios/ && make && make install
vim /etc/httpd/conf/httpd.conf
最后添加如下内容,设置成需要输入密码才能登陆
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 "Nagions 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/nagios/etc/objects/下建立2个文件
(1)hosts.cfg定义主机的文件
define host{
use linux-server
host_name 172.16.21.133
alias 172.16.21.133
address 172.16.21.133
}
(2)services.cfg 定义主机服务的文件
define service{
use local-service //引用local-service的属性信息,在template.cfg中定义
host_name 172.16.21.133 //监控那个主机,host-142在hosts.cfg中定义
service_description ssh //对监控内容的描述
check_command check_ssh //指定监控的命令,check_ping在commands.cfg中定义
}
define service{
use local-service
host_name 172.16.21.133
service_description Ping
check_command check_ping
}
# chown nagios.nagios /usr/local/nagios/etc/objects/{hosts.cfg,services.cfg}
htpasswd -c /usr/local/nagios/etc/htpasswd nagiosadmin