监控cacti
所需软件包:cacti-0.8.8h.tar.gz cacti-spine-0.8.8h.tar.gz php-snmp-5.3.3-26.el6.x86_64.rpm
1
yum install httpd
1
tar zxf cacti-0.8.8h.tar.gz -C /var/www/html/
1
2
cd /var/www/html/
ln -s cacti-0.8.8h/ cacti
1
2
yum install -y php php-mysql mysql-server php-server php-snmp net-snmp rrdtool php-gd php-dom net-snmp-utils
yum install php-snmp-5.3.3-26.el6.x86_64.rpm -y
1
vim /etc/php.ini
将946行注释取消,将date.timezone的值改为Asia/Shanghai
1
2
php -m
sockets session mysql mysqli snmp
1
/etc/init.d/mysqld start
mysql登入
create database cacti;
grant all on cacti.* to cacti@localhost identified by 'westos';
1
mysql -ucacti -pwestos cacti ##可以成功登录
1
mysql_secure_installation
1
2
3
cd /var/www/html/cacti
mysql -ucacti -pwestos cacti < cacti.sql
mysql -ucacti -pwestos cacti
show tables;
http://s4.运维网.com/wyfs02/M00/83/2A/wKiom1dsBl-gwJYHAACD4D-UmMs675.png
1
2
cd include/
vim config.php
29行database_username改为cacti
30行database_password改为westos(cacti用户密码)
39行和42行注释去掉
http://s1.运维网.com/wyfs02/M01/83/29/wKioL1dsBnfR6kMuAADb4XETajA380.png
1
2
cd ..
ll
http://s2.运维网.com/wyfs02/M01/83/2A/wKiom1dsBoqC8RrAAADHDM4Guf8729.png
1
useradd -u 1000 cacti ##将所有人和所有组都改为cacti
1
2
su - cacti
crontab -e
内容:*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1
logout
1
/etc/init.d/httpd restart
http://172.25.45.1/cacti/install/
http://s5.运维网.com/wyfs02/M02/83/29/wKioL1dsBpfAzrIfAADV67rOVEY290.png
Next Finsh
http://s5.运维网.com/wyfs02/M01/83/29/wKioL1dsBqehR-9xAACtCE5sVlA403.png
用户名:admin 密码:admin
设置新密码
http://s1.运维网.com/wyfs02/M01/83/2A/wKiom1dsBvGTP62gAACxBCqG6Zs941.png
首页
http://s2.运维网.com/wyfs02/M02/83/2A/wKiom1dsB0ui5Wn7AACI8kwtWc8792.png
【server2】
1
2
yum install -y net-snmp net-snmp-utils
/etc/init.d/snmpd start
1
snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
1
vim /etc/snmp/snmpd.conf
http://s4.运维网.com/wyfs02/M01/83/29/wKioL1dsB3Twj3A6AABLCTq_8wY288.png
http://s4.运维网.com/wyfs02/M00/83/29/wKioL1dsB3XjmycpAACA0dUnq_I996.png
http://s4.运维网.com/wyfs02/M01/83/29/wKioL1dsB9ijN0tqAABYYTqRjAY585.png
http://s3.运维网.com/wyfs02/M00/83/2A/wKiom1dsB5rShVTmAABbAM8_kjo570.png
http://s1.运维网.com/wyfs02/M01/83/2A/wKiom1dsB-_yCCGDAAATITz37xc318.png
1
/etc/init.d/snmpd restart
1
snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.25.45.2 = INTEGER: 2
http://s2.运维网.com/wyfs02/M02/83/29/wKioL1dsCFHh5snTAAAs47gBwcM180.png
【server1】
1
snmpwalk -v 1 -c public 172.25.45.2 IP-MIB::ipAdEntIfIndex
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.25.45.2 = INTEGER: 2
【server2】
1
/etc/init.d/snmpd reload
【server1】
1
/etc/snmp/snmpd.conf
http://s5.运维网.com/wyfs02/M02/83/2A/wKiom1dsCTbDyXBHAAAYeAxy95A225.png
1
2
snmpwalk -v 1 172.25.45.2 -c public .1.3.6.1.4.1.2021.9
snmpwalk -v 1 172.25.45.2 -c public .1
【server2】
1
scp /etc/snmp/snmpd.conf root@172.25.45.1:/etc/snmp/
【server1】
1
/etc/init.d/snmpd start
1
snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.25.45.1 = INTEGER: 2
http://172.25.45.1/cacti
Devices-Add-Create Graphs for this Host
http://s4.运维网.com/wyfs02/M01/83/29/wKioL1dsCiXBlPMSAAERtDyDY9M486.png
http://s4.运维网.com/wyfs02/M00/83/29/wKioL1dsCibyuNFLAAA22FY63lY348.png
http://s2.运维网.com/wyfs02/M01/83/29/wKioL1dsCpuBD_t2AANIe_cwIoA032.png
Graph Trees-Default Tree-Add
http://s4.运维网.com/wyfs02/M01/83/2A/wKiom1dsCq3CP4SlAAEAelihI8c851.png
http://s5.运维网.com/wyfs02/M00/83/29/wKioL1dsCaDTHp5lAAApRdNpHDA676.png
【server1】
1
2
cd /var/www/html/cacti/rra
rrdtool info server2_mem_free_16.rrd | less
http://s4.运维网.com/wyfs02/M02/83/2A/wKiom1dsCtDh8NaxAAC771iIdDg356.png
http://s2.运维网.com/wyfs02/M00/83/29/wKioL1dsCt-yx9YMAAAmKlR_0C0493.png
插件
所需软件包:cacti-spine-0.8.8h.tar.gz
【server1】
1
2
3
4
tar zxf cacti-spine-0.8.8h.tar.gz
yum install -y mysql-devel net-snmp-devel
yum install -y openssl-devel
yum install dos2unix autoconf automake binutils libtool gcc cpp glibc-headers kernel-headers glibc-devel
1
2
3
4
5
cd cacti-spine-0.8.8h
sh bootstrap
./configure
make
make install
1
2
3
cd /usr/local/spine/etc/
cp spine.conf.dist /etc/spine.conf
vim /etc/spine.conf
修改DB_User为cacti,密码为设置的密码
http://s1.运维网.com/wyfs02/M02/83/29/wKioL1dsCvqhI8OZAAAQ8_HkD6M307.png
1
su - cacti
/usr/local/spine/bin/spine
SPINE: Using spine config file
SPINE: Version 0.8.8h starting
SPINE: Time: 0.1084 s, Threads: 5, Hosts: 3
http://172.25.45.1/cacti
Settings-Poller
http://s2.运维网.com/wyfs02/M02/83/2A/wKiom1dsCwezaeU2AACR0zM_g7I973.png
http://s2.运维网.com/wyfs02/M00/83/2A/wKiom1dsC5ai8Wh-AAAihIkC8hs473.png
1
2
cd /var/www/html/cacti/log
cat cacti.log
http://s2.运维网.com/wyfs02/M01/83/29/wKioL1dsC-XxXGahAAAewcOUwuw516.png
软件包:monitor-v1.3-1.tgz
1
tar zxf monitor-v1.3-1.tgz -C /var/www/html/cacti/plugins
http://172.25.45.1/cacti
Plugin Management
http://s1.运维网.com/wyfs02/M02/83/2A/wKiom1dsDEPRHfC2AAA-LIcLdvk105.png
http://s2.运维网.com/wyfs02/M01/83/29/wKioL1dsDGGT71s9AABCVutPVVo212.png
Settings-Misc
http://s4.运维网.com/wyfs02/M00/83/2A/wKiom1dsDHizTXTbAAB8fze8qn4853.png
http://s4.运维网.com/wyfs02/M01/83/2A/wKiom1dsDHjCXcmWAAApusY8q14353.png
页:
[1]