监控cacti
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了监控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 |
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 [email protected] 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;
1 2 | cd include/ vim config.php |
29行database_username改为cacti
30行database_password改为westos(cacti用户密码)
39行和42行注释去掉
1 2 | cd .. ll |
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/
Next Finsh
用户名:admin 密码:admin
设置新密码
首页
【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 |
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
【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 |
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 |
【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
Graph Trees-Default Tree-Add
【server1】
1 2 | cd /var/www/html/cacti/rra rrdtool info server2_mem_free_16.rrd | less |
插件
所需软件包: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,密码为设置的密码
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
1 2 | cd /var/www/html/cacti/log cat cacti.log |
软件包: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
Settings-Misc
本文出自 “huangguanhua” 博客,转载请与作者联系!
以上是关于监控cacti的主要内容,如果未能解决你的问题,请参考以下文章