Cacti部署文档
1、配置yum本地源并安装所需包
[root@cactic ~]# vi /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///mnt/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release
~
~
"/etc/yum.repos.d/rhel-debuginfo.repo" 6L, 185C written
[root@cactic ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@cactic ~]# yum clean all
Loading "security" plugin
Loading "rhnplugin" plugin
Cleaning up Everything
[root@cactic tmp]# yum install httpd mysql-server php php-mysql php-snmp net-snmp net-snmp-utils
Loading "security" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
rhel-debuginfo 100% |=========================| 1.3 kB 00:00
primary.xml.gz 100% |=========================| 806 kB 00:00
rhel-debug: ################################################## 2944/2944
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package php-snmp.x86_64 0:5.1.6-20.el5 set to be updated
--> Processing Dependency: php-common = 5.1.6-20.el5 for package: php-snmp
---> Package mysql-server.x86_64 0:5.0.45-7.el5 set to be updated
--> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15)(64bit) for package: mysql-server
--> Processing Dependency: perl-DBI for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15()(64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15)(64bit) for package: mysql-server
--> Processing Dependency: mysql = 5.0.45-7.el5 for package: mysql-server
--> Processing Dependency: perl(DBI) for package: mysql-server
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15()(64bit) for package: mysql-server
---> Package php.x86_64 0:5.1.6-20.el5 set to be updated
--> Processing Dependency: php-cli = 5.1.6-20.el5 for package: php
---> Package net-snmp.x86_64 1:5.3.1-24.el5 set to be updated
--> Processing Dependency: libsensors.so.3()(64bit) for package: net-snmp
---> Package php-mysql.x86_64 0:5.1.6-20.el5 set to be updated
--> Processing Dependency: php-pdo for package: php-mysql
---> Package net-snmp-utils.x86_64 1:5.3.1-24.el5 set to be updated
---> Package httpd.x86_64 0:2.2.3-11.el5_1.3 set to be updated
filelists.xml.gz 100% |=========================| 2.5 MB 00:00
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd
--> Running transaction check
---> Package lm_sensors.x86_64 0:2.10.0-3.1 set to be updated
---> Package php-common.x86_64 0:5.1.6-20.el5 set to be updated
---> Package perl-DBI.x86_64 0:1.52-1.fc6 set to be updated
---> Package apr.x86_64 0:1.2.7-11 set to be updated
---> Package mysql.x86_64 0:5.0.45-7.el5 set to be updated
---> Package php-pdo.x86_64 0:5.1.6-20.el5 set to be updated
---> Package apr-util.x86_64 0:1.2.7-7.el5 set to be updated
--> Processing Dependency: libpq.so.4()(64bit) for package: apr-util
---> Package perl-DBD-MySQL.x86_64 0:3.0007-1.fc6 set to be updated
---> Package php-cli.x86_64 0:5.1.6-20.el5 set to be updated
--> Running transaction check
---> Package postgresql-libs.x86_64 0:8.1.11-1.el5_1.1 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================
Package Arch Version Repository Size
======================================================================
Installing:
mysql-server x86_64 5.0.45-7.el5 rhel-debuginfo 9.7 M
net-snmp-utils x86_64 1:5.3.1-24.el5 rhel-debuginfo 182 k
php x86_64 5.1.6-20.el5 rhel-debuginfo 1.2 M
php-mysql x86_64 5.1.6-20.el5 rhel-debuginfo 86 k
php-snmp x86_64 5.1.6-20.el5 rhel-debuginfo 28 k
Installing for dependencies:
apr x86_64 1.2.7-11 rhel-debuginfo 118 k
apr-util x86_64 1.2.7-7.el5 rhel-debuginfo 74 k
httpd x86_64 2.2.3-11.el5_1.3 rhel-debuginfo 1.1 M
lm_sensors x86_64 2.10.0-3.1 rhel-debuginfo 503 k
mysql x86_64 5.0.45-7.el5 rhel-debuginfo 4.2 M
net-snmp x86_64 1:5.3.1-24.el5 rhel-debuginfo 703 k
perl-DBD-MySQL x86_64 3.0007-1.fc6 rhel-debuginfo 147 k
perl-DBI x86_64 1.52-1.fc6 rhel-debuginfo 605 k
php-cli x86_64 5.1.6-20.el5 rhel-debuginfo 2.2 M
php-common x86_64 5.1.6-20.el5 rhel-debuginfo 154 k
php-pdo x86_64 5.1.6-20.el5 rhel-debuginfo 63 k
postgresql-libs x86_64 8.1.11-1.el5_1.1 rhel-debuginfo 195 k
Transaction Summary
=============================================================================
Install 17 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 21 M
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186
Importing GPG key 0x37017186 "Red Hat, Inc. (release key) <security@redhat.com>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: php-common ####################### [ 1/17]
Installing: perl-DBI ####################### [ 2/17]
Installing: mysql ####################### [ 3/17]
Installing: apr ####################### [ 4/17]
Installing: perl-DBD-MySQL ####################### [ 5/17]
Installing: php-pdo ####################### [ 6/17]
Installing: php-cli ####################### [ 7/17]
Installing: lm_sensors ####################### [ 8/17]
Installing: net-snmp ####################### [ 9/17]
Installing: postgresql-libs ####################### [10/17]
Installing: apr-util ####################### [11/17]
Installing: httpd ####################### [12/17]
Installing: php-snmp ####################### [13/17]
Installing: mysql-server ####################### [14/17]
Installing: php ####################### [15/17]
Installing: php-mysql ####################### [16/17]
Installing: net-snmp-utils ####################### [17/17]
Installed: mysql-server.x86_64 0:5.0.45-7.el5 net-snmp-utils.x86_64 1:5.3.1-24.el5 php.x86_64 0:5.1.6-20.el5 php-mysql.x86_64 0:5.1.6-20.el5 php-snmp.x86_64 0:5.1.6-20.el5
Dependency Installed: apr.x86_64 0:1.2.7-11 apr-util.x86_64 0:1.2.7-7.el5 httpd.x86_64 0:2.2.3-11.el5_1.3 lm_sensors.x86_64 0:2.10.0-3.1 mysql.x86_64 0:5.0.45-7.el5 net-snmp.x86_64 1:5.3.1-24.el5 perl-DBD-MySQL.x86_64 0:3.0007-1.fc6 perl-DBI.x86_64 0:1.52-1.fc6 php-cli.x86_64 0:5.1.6-20.el5 php-common.x86_64 0:5.1.6-20.el5 php-pdo.x86_64 0:5.1.6-20.el5 postgresql-libs.x86_64 0:8.1.11-1.el5_1.1
Complete!
[root@cactic tmp]# yum install freetype libart_lgpl libpng
Loading "security" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Package freetype - 2.2.1-19.el5.x86_64 is already installed.
Package freetype - 2.2.1-19.el5.i386 is already installed.
Package libart_lgpl - 2.3.17-4.i386 is already installed.
Package libart_lgpl - 2.3.17-4.x86_64 is already installed.
Package libpng - 2:1.2.10-7.1.el5_0.1.i386 is already installed.
Package libpng - 2:1.2.10-7.1.el5_0.1.x86_64 is already installed.
Nothing to do
[root@cactic tmp]# rpm -ivh cacti-0.8.8a-2.el5.noarch.rpm rrdtool-1.2.27-3.el5.x86_64.rpm rrdtool-php-1.2.27-3.el5.x86_64.rpm
warning: cacti-0.8.8a-2.el5.noarch.rpm: Header V4 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:rrdtool ########################################### [ 33%]
2:cacti ########################################### [ 67%]
3:rrdtool-php ########################################### [100%] 2、启动 MySQL 并设置 root 密码:
[root@cactic tmp]# /etc/init.d/mysqld restart
Stopping MySQL: [FAILED]
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h cactic password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
Support MySQL by buying support/licenses at
[ OK ]
Starting MySQL: [ OK ]
[root@cactic tmp]# /usr/bin/mysqladmin -u root password 'redhat'
创建数据库:
[root@cactic tmp]# mysqladmin -uroot -p create cacti
Enter password:******
导入 cacti.sql 数据库:
[root@cactic tmp]# mysql -uroot -p cacti < /usr/share/doc/cacti-0.8.8a/cacti.sql
Enter password:******
设置数据库权限:
[root@cactic tmp]# mysql -uroot -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> GRANT ALL ON cacti.* TO cactic@localhost IDENTIFIED BY 'redhat';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
编辑 cacti 的配置文件 /usr/share/cacti/include/config.php,设置 MYSQL 信息:
[root@cactic tmp]# vi /usr/share/cacti/include/config.php
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2012 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| |
+-------------------------------------------------------------------------+
*/
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "root";
$database_password = "redhat";
"/usr/share/cacti/include/config.php" 44L, 2121C written
设置目录权限:
[root@cactic tmp]# chown -R cacti /var/lib/cacti/rra
[root@cactic tmp]# chown -R cacti /var/log/cacti/
设置 crontab:
[root@cactic tmp]# crontab -e -u cacti
*/5 * * * * php /usr/share/cacti/poller.php > /dev/null 2>&1
设置 cacti 目录的访问权限: /etc/httpd/conf.d/cacti.conf
[root@cactic tmp]# vi /etc/httpd/conf.d/cacti.conf
#
# Cacti: An rrd based graphing tool
#
# Change the following ACLs to open up Cacti to other network devices.
# For example:
# On httpd 2.4, change "Require host localhost" to "Require all granted".
# On httpd 2.2, change "Allow from localhost" to "Allow from all".
Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti/>
<IfModule mod_authz_core.c>
# httpd 2.4
Require host localhost
</IfModule>
<IfModule !mod_authz_core.c>
# httpd 2.2
Order deny,allow
# Deny from all
# Allow from localhost
Allow from all
</IfModule>
"/etc/httpd/conf.d/cacti.conf" 56L, 1396C written
3、启动
启动 snmpd:
[root@cactic tmp]# /etc/init.d/snmpd restart
Stopping snmpd: [FAILED]
Starting snmpd: [ OK ]
[root@cactic tmp]# /etc/init.d/snmptrapd restart
Stopping snmptrapd: [FAILED]
Starting snmptrapd: [ OK ]
启用必须的服务:
[root@cactic tmp]# for i in httpd mysqld snmpd snmptrapd; do chkconfig --level 35 $i on; done
浏览器安装(首次登陆账号admin 密码admin 登陆后需要修改)
1、打开浏览器并输入地址192.168.85.40/cacti,根据提示安装即可
2、选择new install
3、点击 finish(首次登陆需要重设密码)
安装插件 monitor thold settings
[root@cactic tmp]# tar -zxvf monitor-0.8.2.tar.gz
monitor/wz_tooltip.js
monitor/index.php
monitor/LICENSE
monitor/sounds/index.php
monitor/sounds/attn-noc.wav
monitor/monitor.php
monitor/images/index.php
monitor/images/button_nosound.gif
monitor/images/blue.gif
monitor/images/muted.gif
monitor/images/tab_monitor.gif
monitor/images/red.gif
monitor/images/orange.gif
monitor/images/green.gif
monitor/setup.php
monitor/README
monitor/monitor.sql
[root@cactic tmp]# tar -zxvf settings-0.5.tar.gz
settings/index.php
settings/LICENSE
settings/setup.php
settings/README
settings/email-test.php
settings/include/index.php
settings/include/mailer.php
settings/include/functions.php
[root@cactic tmp]# tar -zxvf thold-0.4.3.tar.gz
thold/
thold/images/
thold/images/tab_thold.gif
thold/images/tab_thold_down.gif
thold/images/index.php
thold/images/reddot.png
thold/images/enable_thold.png
thold/images/view_graphs.gif
thold/images/disable_thold.png
thold/images/edit_object.png
thold/LICENSE
thold/README
thold/thold.sql
thold/thold_functions.php
thold/index.php
thold/setup.php
thold/listthold.php
thold/extras/
thold/extras/upgrade.php
thold/extras/apply_realms.php
thold/includes/
thold/includes/index.php
thold/includes/polling.php
thold/includes/tab.php
thold/includes/database.php
thold/includes/settings.php
thold/thold_graph.php
thold/thold_add.php
thold/thold_templates.php
thold/cli_thresholds.php
thold/thold.php
[root@cactic tmp]# cp -r monitor settings thold /usr/share/cacti/plugins
修改global.conf
在$config = array();下面插入以下几行
$plugins[] = 'thold';
$plugins[] = 'settings';
$plugins[] = 'monitor';
打开浏览器登陆cacti
在user management下将view monitoring勾选
在plugin management下启用插件
在graph management下勾选要描绘的项目
详细使用就根据个人喜好设定吧!
Linux下Cacti详细部署指南
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.heiqu.com/0729aacac41e4f27a68e128ff392a0a1.html