这里直接引入官方的文档:http://www.cacti.net/spine_install.php
Spine Installation
Spine needs to be compiled before it can be used. If you found a binary package of Spine for your operating system, you can skip the next step about compiling Spine.
Compiling Spine
Compiling Spine for Windows under Cygwin
Compiling Spine for Redhat/Fedora Linux
Compiling Spine for Redhat/Fedora Linux
Before you continue, check if any pre-compiled packages are available for your version of Redhat/Fedora Linux. These instructions will help you compile Spine from source if no binary packages are available.
Prerequisites
Make sure that the following packages are installed before attempting to compile Spine:
net-snmp-devel
mysql
mysql-devel
openssl-devel
Compiling Spine
Download the latest source distribution of Spine and run the following commands to get a working binary:
tar xvzf cacti-spine-0.8.7.tar.gz
cd spine-0.8.7
./configure
make
Now you must move your new binary, spine and spine.conf to a more permanent home such as /usr/local/spine. Edit thespine.conf file and specify your database connection information for Cacti.
You should now be ready to start using Spine!
Setting Up Spine
Once Spine is installed on your system, you must perform the following steps to make your Cacti installation aware of it.
Login to Cacti as an admin user.
Select Settings on the menu and click the Paths tab.
Enter the complete path to your Spine binary in the Spine Poller File Path field and click Save.
Click the Poller tab.
Choose "spine" from the Poller Type dropdown box and click Save.
After completing these steps, Cacti will spawn Spine every 5 minutes instead of cmd.php. If you are having problems getting Spine to gather data, you can always temporarily change Poller Type back to "cmd.php".
鉴于有些同学看着英文就有点头晕,这里我也演示一下,如果安装及设置spine。 1、解决依赖关系
## spine 依赖于mysql mysql-devel net-snmp-devel openssl-devel
## 我们在安装cacti的时候已经安装 mysql mysql-devel 所以,这里只需安装另外2个
[root@localhost ~]# yum -y install net-snmp-devel openssl-devel 2、下载并安装spine,下载的版本最好与cacti一致,spine-0.8.8b
# 下载地址, 下载和 cacti 版本一致的spine
http://www.cacti.net/downloads/spine/
[root@localhost ~]# tar xf cacti-spine-0.8.8b.tar.gz
[root@localhost ~]# cd cacti-spine-0.8.8b
[root@localhost cacti-spine-0.8.8b]# ./configure
[root@localhost cacti-spine-0.8.8b]# make && make install
# 默认安装在/usr/local/spine/目录下。 3、提供配置文件
[root@localhost ~]# cp /usr/local/spine/etc/spine.conf.dist /etc/spine.conf
## 编辑配置文件,请根据实际情况修改
[root@localhost ~]# vi /etc/spine.conf
DB_Host localhost
DB_Database cactidb
DB_User cactiuser
DB_Pass cactiuser
DB_Port 3306
DB_PreG 0
# 这里的配置是怎么来的呢? 还记得吧, 就是 cacti/include/config.php
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
$database_ssl = false; 4、测试是否正常
[root@localhost ~]# /usr/local/spine/bin/spine
## 报错了
MYSQL: Connection Failed: Error:'2003', Message:'Can't connect to MySQL server on 'shuttle' (61)'
05/12/2012 07:14:22 PM - SPINE: Poller[0] FATAL: Connection Failed, Error:'2003', Message:'Can't connect to MySQL server on 'shuttle' (61)' (Spine init)
## google了一下
You probably checked it out already but make sure:
DB_Host 127.0.0.1
and NOT
DB_Host localhost