cacti安装配置指南(自写)

发布于 2022-09-05 15:11:37 字数 310 浏览 9 评论 4

本帖最后由 ktaog6 于 2010-12-25 13:23 编辑

在cu找了半天,真不知道这个帖子应该放哪。。。
http://blog.zhiyu.info/linux/linux_server/cacti-install/154.html
我自己写的cacti安装过程,有兴趣的同学可以参考下

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

吝吻 2022-09-19 08:43:28

又一个编译狂人,用系统自带的包完全可以实现,干什么非要编译呢

客气,呵呵
最近在重整blog,有些乱,大家见谅,嘿~

自在安然 2022-09-09 18:13:59

我把原文转帖过来,感谢分享!

暮色兮凉城 2022-09-09 10:49:52

回复 1# ktaog6

    Cacti安装配置文档
2010年06月2日 翅儿学飞 No comments

##################################################################
##        ##
##   Cacti安装配置文档   ##
##  日期:2009-11-19 作者:翅儿学飞  ##
##        ##
##################################################################

####################一、软件下载####################

rrdtool http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.1.tar.gz
cacti http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz

####################二、环境配置####################

rpm -qa|grep fontconfig-devel
rpm -qa|grep freetype-devel
rpm -qa|grep libjpeg-devel
rpm -qa|grep libpng-devel
rpm -qa|grep libXpm-devel
rpm -qa|grep gettext-devel
rpm -qa|grep openssl-devel
rpm -qa|grep libmcrypt-devel
rpm -qa|grep libmhash-devel
rpm -qa|grep pango-devel
rpm -qa|grep libart_lgpl-devel
rpm -qa|grep net-snmp-utils
rpm -qa|grep net-snmp-devel

####################三、安装步骤####################

1、apache安装

tar xzvf httpd-2.2.12.tar.gz
cd httpd-2.2.12
./configure –prefix=/usr/local/apache –enable-authn-dbm –enable-authz-dbm –enable-ssl –enable-vhost-alias –enable-rewrite –enable-so –enable-charset-lite –enable-deflate –with-z –with-ssl –with-mpm=prefork
make
make install
ln -s /usr/local/apache/bin/apachectl /usr/local/sbin/httpd
echo “/usr/local/apache/bin/apachectl start” >> /etc/rc.d/rc.local

2、GD安装

tar xzvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure –prefix=/usr/local/gd/ –enable-shared –enable-static –with-libiconv-prefix=/usr/local/libiconv/ –with-png –with-freetype –with-fontconfig –with-jpeg –with-xpm
make
make install

3、MySQL安装(如果不是用本地MySQL,则下面可以省略,只安装mysql-devel即可)

groupadd mysql
useradd -g mysql mysql
tar xzvf mysql-5.1.37.tar.gz
cd mysql-5.1.37
./configure –prefix=/usr/local/mysql/
make
make install
cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
bin/mysql_install_db –user=mysql
chown -R root .
chown -R mysql var
share/mysql/mysql.server start

4、PHP安装

tar xzvf php-5.2.10.tar.gz
cd php-5.2.10
./configure –prefix=/usr/local/php/ –with-config-file-path=/usr/local/php/etc/php.ini –with-apxs2=/usr/local/apache/bin/apxs –with-mysql=/usr/local/mysql/ –with-pear –with-openssl –with-zlib –with-pcre-dir –with-mcrypt –with-mhash –with-libxml-dir –enable-fastcgi  –enable-discard-path –enable-magic-quotes –enable-static –enable-mbstring  –enable-shmop –enable-wddx –enable-sockets –with-snmp
make
make install
cp php.ini-dist /usr/local/php/etc/php.ini
vi /usr/local/apache/conf/httpd.conf
添加:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
修改:
<IfModule dir_module>
     DirectoryIndex index.html index.php
</IfModule>
:wq

5、RRDTool安装

tar xzvf rrdtool-1.4.2.tar.gz
cd rrdtool-1.4.2
./configure –prefix=/usr/local/rrdtool/
make
make install

6、cacti安装

tar xzvf cacti-0.8.7e.tar.gz
mv cacti-0.8.7e/ /usr/local/cacti/
#对php环境配置
vi /usr/local/php/etc/php.ini
如果使用的是动态加载的模块,则对如下进行设置,如果是编译静态模块方式,加–with-mysql和–with-snmp
extension_dir = /etc/php.d#扩展模块的存放目录
extension=mysql.so
extension=snmp.so
;session.save_path=/tmp#php4.3.6以上要加上注释
file_uploads = On#如果要支持模版上传,则启用此选项
:wq
#对apache环境配置
vi /usr/local/apache/conf/httpd.conf
修改:
Include conf/extra/httpd-vhosts.conf
:wq
cp /usr/local/apache/conf/extra/httpd-vhosts.conf /usr/local/apache/conf/extra/httpd-vhosts.conf.bak
vi /usr/local/apache/conf/extra/httpd-vhosts.conf
改为:
<VirtualHost *:80>
    ServerAdmin admin@aaa.cn
    DocumentRoot “/usr/local/cacti”
    ServerName monitor.aaa.cn
    ErrorLog “logs/monitor.aaa.cn-error_log”
    CustomLog “logs/monitor.aaa.cn-access_log” common
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    allow from all
</Directory>
</VirtualHost>
:wq
#对MySQL数据库设定
mysql -u root -p
mysql> create database cacti;
mysql> grant all on cacti.* to cacti@’%’ identified by ‘cacti’;
mysql> flush privileges;
mysql> exit
mysql -u cactidu -p cacti<cacti.sql
cd /usr/local/cacti/
vi include/config.php
修改数据信息:
$database_type = “mysql”;#  数据库类型
$database_default = “cacti”;#  数据库名称
$database_hostname = “192.168.1.2″;# 数据库地址
$database_username = “cacti”;# 数据库用户名
$database_password = “cacti”;# 数据库用户密码
$database_port = “3306″;#  数据库端口
:wq
useradd cactiexec -s /sbin/nologin
chown -R cactiexec rra/ log/
crontab -u cactiexec -e
*/5 * * * * /usr/local/php/bin/php /usr/local/cacti/poller.php > /dev/null 2>&1
httpd start
访问http://monitor.aaa.cn
next>>
New Install>>
/usr/local/rrdtool/bin/rrdtool
/usr/local/php/bin/php
/usr/bin/snmpwalk
/usr/bin/snmpget
/usr/bin/snmpbulkwalk
/usr/bin/snmpgetnext
/usr/local/cacti/log/cacti.log
NET-SNMP 5.X
Finish>>
user:admin
pass:admin
console>settings>RRDTool 1.3.X>Save

####################四、其他说明####################
1、修改每一分钟获取一次源
首先修改crontab
crontab -u cactiexec -e
*/1 * * * * /usr/local/php/bin/php /usr/local/cacti/poller.php > /dev/null 2>&1
然后修改poller和cron的Interval
登陆后选择console>settings>Poller>Poller Interval和Cron Interval设置为Every Minute
进入MySQL执行命令
mysql> UPDATE data_template_data SET rrd_step=60 WHERE rrd_step=300;
mysql> UPDATE data_template_rrd SET rrd_heartbeat=120 WHERE rrd_heartbeat=600;
mysql> UPDATE poller_item SET rrd_step = 60 WHERE rrd_step = 300;
mysql> delete from rra;
mysql> INSERT INTO rra VALUES (1,’c21df5178e5c955013591239eb0afd46′,’Daily (1 Minute Average)’,0.5,1,3000,86400);
mysql> INSERT INTO rra VALUES (2,’0d9c0af8b8acdc7807943937b3208e29′,’Weekly (6 Minute Average)’,0.5,6,3500,604800);
mysql> INSERT INTO rra VALUES (3,’6fc2d038fb42950138b0ce3e9874cc60′,’Monthly (24 Minute Average)’,0.5,24,3875,2678400);
mysql> INSERT INTO rra VALUES (4,’e36f3adb9f152adfa5dc50fd2b23337e’,'Yearly (5 Hour Average)’,0.5,288,3985,33053184);
mysql> INSERT INTO rra VALUES (5,’283ea2bf1634d92ce081ec82a634f513′,’Hourly (1 Minute Average)’,0.5,1,500,14400);
最后删除所有模版
rm /usr/local/cacti/rra/*

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文