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

[经验分享] RedHat / CentOS Install and Configure Cacti Network Graphing Tool

[复制链接]

尚未签到

发表于 2015-9-7 12:52:23 | 显示全部楼层 |阅读模式
RedHat / CentOS Install and Configure Cacti Network Graphing Tool
by VIVEK GITE on APRIL 20, 2009 · 67 COMMENTS· last updated at JUNE 26, 2009


DSC0000.png   Cacti is a network graphing tool similar to MRTG. How do I install and configure common options to collect SNMP data and various other data (such as system load, network link status, hard disk space, logged in users etc) into an RRD?
From the official project site:
  Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG.
Required software(s)
  You need to install the following software on RHEL / Fedora / CentOS Linux:

  • MySQL Server : Store cacti data.
  • NET-SNMP server - SNMP (Simple Network Management Protocol) is a protocol used for network management.
  • PHP with net-snmp module - Access SNMP data using PHP.
  • Apache / lighttpd / ngnix webserver : Web server to display graphs created with PHP and RRDTOOL.
Install the software
  First, login as root user and type the following command to install mysql, apache and php:
# yum install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd
Configure MySQL server
  First, set root password:
# mysqladmin -u root password NEWPASSWORD
Create cacti MySQL database
  Create a database called cacti, enter:
# mysql -u root -p -e 'create database cacti'
Create a user called cacti with a password called zYn95ph43zYtq, enter:
# mysql -u root -p
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'zYn95ph43zYtq';
mysql> FLUSH privileges;
mysql> \qInstall snmpd
  Type the following command to install net-snmpd
# yum install net-snmp-utils php-snmp net-snmp-libs
Configure snmpd, open /etc/snmp/snmpd.conf
# vi /etc/snmp/snmpd.conf
Append / modify it as follows (see snmpd.conf man page for details):
com2sec local     localhost           public
group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
view all    included  .1                               80
access MyRWGroup ""      any       noauth    exact  all    all    none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root  (configure /etc/snmp/snmp.local.conf)
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat  Save and close the file. Turn on snmpd service:
# /etc/init.d/snmpd start
# chkconfig snmpd on
Make sure you are getting information from snmpd:
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
Sample ouptut:
IP-MIB::ipAdEntIfIndex.10.10.29.68 = INTEGER: 2
IP-MIB::ipAdEntIfIndex.67.yy.zz.eee = INTEGER: 3
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1Install cacti
  First, make sure EPEL repo is enabled. Type the following command to install cacti:
# yum install cacti
Install cacti tables
  Type the following command to find out cacti.sql path:
# rpm -ql cacti | grep cacti.sql
Sample output:
/usr/share/doc/cacti-0.8.7d/cacti.sql  Type the following command to install cacti tables (you need to type the cacti user password):
# mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.7d/cacti.sql
Configure cacti
  Open /etc/cacti/db.php file, enter:
# vi /etc/cacti/db.php
Make changes as follows:

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "zYn95ph43zYtq";
$database_port = "3306";
  Save and close the file.
Configure httpd
  Open /etc/httpd/conf.d/cacti.conf file, enter:
# vi /etc/httpd/conf.d/cacti.conf
You need to update allow from line. Either set to ALL or your LAN subnet to allow access to cacti:

#
# Cacti: An rrd based graphing tool
#
Alias /cacti    /usr/share/cacti
<Directory /usr/share/cacti/>
Order Deny,Allow
Deny from all
Allow from 10.0.0.0/8
</Directory>
  Another option is create /usr/share/cacti/.htaccess file and password protect the directory. Finally, restart httpd:
# service httpd restart
Setup cacti cronjob
  Open /etc/cron.d/cacti file, enter:
# vi /etc/cron.d/cacti
Uncomment the line:
*/5 * * * *     cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1  Save and close the file.
Run cacti installer
  Now cacti is ready to install. Fire a webbrowser and type the url:
http://your.example.com/cacti/
OR
http://your.server.ip.address/cacti/
Just follow on screen instructions. The default username and password for cacti is admin / admin. Upon first login, you will be force to change the default password.
How do I configure SNMP data collection?
  SNMP can be used to monitor server traffic. Once installed login to cacti.
=> Click on Devices
  => Select Localhost
  => Make sure SNMP options are selected as follows:

DSC0001.png Fig.01: SNMP configuration
  Finally, click on Save button.
How do I create SNMP graphs?
  Click on "Create Graphs for this Host" link on top right side.
  Select SNMP - Interface Statistics
  Select a graph type (such as In/Out bytes with total bandwidth)
  Finally, click on Create button.
How do I view graphs?
  To view graphs click on Graphs tab. Here is sample graph from one my own box:

DSC0002.png Fig.02: Cacti in Action - Memory, CPU and Network Usage

(Fig.02: Cacti in action)
Fig.03: Cacti in Action Disk, Load average and User stats
Further readings:

运维网声明 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-110584-1-1.html 上篇帖子: CentOS下安装配置Cacti 下篇帖子: 【转载】cacti 、nagios和ntop的简单介绍
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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