设为首页 收藏本站
查看: 1029|回复: 0

[经验分享] 监控cacti

[复制链接]

尚未签到

发表于 2019-1-9 12:01:16 | 显示全部楼层 |阅读模式
  

所需软件包: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改为westoscacti用户密码)
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_Usercacti,密码为设置的密码
http://s1.运维网.com/wyfs02/M02/83/29/wKioL1dsCvqhI8OZAAAQ8_HkD6M307.png

1
su - cacti
/usr/local/spine/bin/spine
SPINE: Using spine config file [/etc/spine.conf]
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、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-661208-1-1.html 上篇帖子: 设置cacti图形标题能显示中文 下篇帖子: cacti无数据问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表