共计 14926 个字符,预计需要花费 38 分钟才能阅读完成。
前言:
原本是想源码安装的,但是现在发现还是太麻烦了,就直接通过 apt-get install 安装了。
一、Cacti 概述
1. Cacti 是用 php 语言实现的一个软件,它的主要功能是用 snmp 服务获取数据,然后用 rrdtool 储存和更新数据,当用户需要查看数据的时候用 rrdtool 生成图表呈现给用户。因此,snmp 和 rrdtool 是 cacti 的关键。Snmp 关系着数据的收集,rrdtool 关系着数据存储和图表的生成。
2. MySQL 配合 PHP 程序存储一些变量数据并对变量数据进行调用,如:主机名、主机 ip、snmp 团体名、端口号、模板信息等变量。
3. snmp 抓到数据不是存储在 mysql 中,而是存在 rrdtool 生成的 rrd 文件中(在 cacti 根目录的 rra 文件夹下)。rrdtool 对数据的更新和存储就是对 rrd 文件的处理,rrd 文件是大小固定的档案文件(Round Robin Archive),它能够存储的数据笔数在创建时就已经定义。
二、系统环境
1、Linux Ubuntu-server 3.5.0-23-generic x86_64
三、apache、mysql、php 安装
参考:http://www.linuxidc.com/Linux/2014-10/107924.htm
四、cacti 安装
enadmin@ubuntu-server:~$ apt-get update
enadmin@ubuntu-server:~$ sudo apt-get install cacti
通过这种方式安装会显示依赖包
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libperl5.14 libphp-adodb libsensors4 libsnmp-base libsnmp15 mysql-server php5-snmp rrdtool snmp
Suggested packages:
php5-ldap php5-adodb lm-sensors snmp-mibs-downloader
The following NEW packages will be installed:
cacti libperl5.14 libphp-adodb libsensors4 libsnmp-base libsnmp15 mysql-server php5-snmp rrdtool snmp
0 upgraded, 10 newly installed, 0 to remove and 113 not upgraded.
Need to get 4,205 kB/4,574 kB of archives.
After this operation, 12.6 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.163.com/ubuntu/ precise-security/main php5-cli amd64 5.3.10-1ubuntu3.13 [3,051 kB]
Get:2 http://mirrors.163.com/ubuntu/ precise-security/main php5-mysql amd64 5.3.10-1ubuntu3.13 [76.6 kB]
Get:3 http://mirrors.163.com/ubuntu/ precise-security/main php5-gd amd64 5.3.10-1ubuntu3.13 [38.8 kB]
Get:4 http://mirrors.163.com/ubuntu/ precise-security/main libapache2-mod-php5 amd64 5.3.10-1ubuntu3.13 [3,137 kB]
Get:5 http://mirrors.163.com/ubuntu/ precise-security/main php5-common amd64 5.3.10-1ubuntu3.13 [1,774 kB]
Get:6 http://mirrors.163.com/ubuntu/ precise-security/main libsnmp-base all 5.4.3~dfsg-2.4ubuntu1.2 [217 kB]
Get:7 http://mirrors.163.com/ubuntu/ precise-security/main libsnmp15 amd64 5.4.3~dfsg-2.4ubuntu1.2 [1,334 kB]
Get:8 http://mirrors.163.com/ubuntu/ precise-security/main mysql-server all 5.5.38-0ubuntu0.12.04.1 [11.4 kB]
Get:9 http://mirrors.163.com/ubuntu/ precise-security/main php5-snmp amd64 5.3.10-1ubuntu3.13 [11.0 kB]
Get:10 http://mirrors.163.com/ubuntu/ precise-security/main snmp amd64 5.4.3~dfsg-2.4ubuntu1.2 [162 kB]
Fetched 9,813 kB in 16s (594 kB/s)
Preconfiguring packages …
Package configuration
下面是安装过程截图
选中 Apache2 以后,接下来再会安装一些软件
Selecting previously unselected package libsensors4.
(Reading database … 58559 files and directories currently installed.)
Unpacking libsensors4 (from …/libsensors4_1%3a3.3.1-2ubuntu1_amd64.deb) …
Preparing to replace php5-cli 5.3.10-1ubuntu3.10 (using …/php5-cli_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement php5-cli …
Preparing to replace php5-mysql 5.3.10-1ubuntu3.10 (using …/php5-mysql_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement php5-mysql …
Preparing to replace php5-gd 5.3.10-1ubuntu3.10 (using …/php5-gd_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement php5-gd …
Preparing to replace libapache2-mod-php5 5.3.10-1ubuntu3.10 (using …/libapache2-mod-php5_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement libapache2-mod-php5 …
Preparing to replace php5-common 5.3.10-1ubuntu3.10 (using …/php5-common_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement php5-common …
Selecting previously unselected package libperl5.14.
Unpacking libperl5.14 (from …/libperl5.14_5.14.2-6ubuntu2.4_amd64.deb) …
Selecting previously unselected package libphp-adodb.
Unpacking libphp-adodb (from …/libphp-adodb_5.12-1_all.deb) …
Selecting previously unselected package libsnmp-base.
Unpacking libsnmp-base (from …/libsnmp-base_5.4.3~dfsg-2.4ubuntu1.2_all.deb) …
Selecting previously unselected package libsnmp15.
Unpacking libsnmp15 (from …/libsnmp15_5.4.3~dfsg-2.4ubuntu1.2_amd64.deb) …
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from …/mysql-server_5.5.38-0ubuntu0.12.04.1_all.deb) …
Selecting previously unselected package php5-snmp.
Unpacking php5-snmp (from …/php5-snmp_5.3.10-1ubuntu3.13_amd64.deb) …
Selecting previously unselected package snmp.
Unpacking snmp (from …/snmp_5.4.3~dfsg-2.4ubuntu1.2_amd64.deb) …
Selecting previously unselected package rrdtool.
Unpacking rrdtool (from …/rrdtool_1.4.7-1_amd64.deb) …
Selecting previously unselected package cacti.
Unpacking cacti (from …/cacti_0.8.7i-2ubuntu1_all.deb) …
Processing triggers for man-db …
Setting up libsensors4 (1:3.3.1-2ubuntu1) …
Setting up php5-common (5.3.10-1ubuntu3.13) …
Setting up php5-cli (5.3.10-1ubuntu3.13) …
Setting up libapache2-mod-php5 (5.3.10-1ubuntu3.13) …
* Reloading web server config apache2
…done.
Setting up php5-mysql (5.3.10-1ubuntu3.13) …
Setting up php5-gd (5.3.10-1ubuntu3.13) …
Setting up libperl5.14 (5.14.2-6ubuntu2.4) …
Setting up libphp-adodb (5.12-1) …
Setting up libsnmp-base (5.4.3~dfsg-2.4ubuntu1.2) …
Setting up libsnmp15 (5.4.3~dfsg-2.4ubuntu1.2) …
Setting up mysql-server (5.5.38-0ubuntu0.12.04.1) …
Setting up php5-snmp (5.3.10-1ubuntu3.13) …
Setting up snmp (5.4.3~dfsg-2.4ubuntu1.2) …
Setting up rrdtool (1.4.7-1) …
Setting up cacti (0.8.7i-2ubuntu1) …
dbconfig-common: writing config to /etc/dbconfig-common/cacti.conf
Creating config file /etc/dbconfig-common/cacti.conf with new version
Creating config file /etc/cacti/debian.php with new version
granting access to database cacti for cacti@localhost: success.
verifying access for cacti@localhost: success.
creating database cacti: success.
verifying database cacti exists: success.
populating database via sql… done.
dbconfig-common: flushing administrative password
Creating config file /etc/cacti/apache.conf with new version
Creating config file /etc/cacti/lighttpd.conf with new version
* Reloading web server config apache2
…done.
Processing triggers for libc-bin …
ldconfig deferred processing now taking place
————————————– 分割线 ————————————–
RHEL6.4 中使用 Cacti+Spine 监控主机实现发送邮件报警 http://www.linuxidc.com/Linux/2013-11/92795.htm
RHEL6.4 中使用 Cacti+Spine 监控远程主机 http://www.linuxidc.com/Linux/2013-11/92796.htm
CentOS 5.5 完整安装 Cacti+Spine http://www.linuxidc.com/Linux/2011-12/49701.htm
CentOS 6 下 Cacti 搭建文档 http://www.linuxidc.com/Linux/2013-06/86595.htm
RHEL5.9 下 Cacti 监控部署详解 http://www.linuxidc.com/Linux/2013-06/85427.htm
CentOS 6.3 下 Cacti 安装详解 http://www.linuxidc.com/Linux/2013-05/84279.htm
CentOS Linux 下快速安装配置 Cacti 中文版 http://www.linuxidc.com/Linux/2013-03/81627.htm
————————————– 分割线 ————————————–
更多详情见请继续阅读下一页的精彩内容 :http://www.linuxidc.com/Linux/2014-10/108129p2.htm
网页安装
在安装完上面内容以后,请进入以下地址 http://your-ip/cacti/ 再安装
安装 snmpd
enadmin@Ubuntu-server:~$ sudo apt-get install snmpd
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
snmpd
upgraded, 1 newly installed, 0 to remove and 146 not upgraded.
Need to get 76.0 kB of archives.
After this operation, 267 kB of additional disk space will be used.
Get:1 http://mirrors.163.com/ubuntu/ precise-security/main snmpd amd64 5.4.3~dfsg-2.4ubuntu1.2 [76.0 kB]
Fetched 76.0 kB in 0s (97.6 kB/s)
Preconfiguring packages …
Selecting previously unselected package snmpd.
(Reading database … 59498 files and directories currently installed.)
Unpacking snmpd (from …/snmpd_5.4.3~dfsg-2.4ubuntu1.2_amd64.deb) …
Processing triggers for ureadahead …
ureadahead will be reprofiled on next reboot
Processing triggers for man-db …
Setting up snmpd (5.4.3~dfsg-2.4ubuntu1.2) …
update-rc.d: warning: snmpd stop runlevel arguments (1) do not match LSB Default-Stop values (0 1 6)
* Starting network management services:
enadmin@ubuntu-server:~$
测试 snmp 的服务
enadmin@ubuntu-server:~$ snmpwalk -v 1 -c public localhost .1.3.6.1.2.1.1.1.0
iso.3.6.1.2.1.1.1.0 = STRING: “Linux ubuntu-server 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64”
enadmin@ubuntu-server:~$
查看 localhost 的监控画面
在配置完毕上述内容以后,正常情况下应该可以看到 cacti 对于自身 localhost 的的默认监控了。我们进入到 Graphs->Tree Mode->Default Tree->Host:Localhost 当中查看对于 localhost 的监控,如下图所示。
常见问题解决
问题 1:cacti 无法正常生成图片
在 cacti 当中看不到图片,通过 Turn Off Graph Debug Mode. 提示报错如下:
‘/var/lib/cacti/rra/localhost_users_6.rrd’: No such file or directory
解决方法:
这是因为权限问题原因导致的,系统无法生成相应的 rrd 文件,需要我们人工手动生成,具体操作方法如下:
Console->System Utilities->Rebuild Poller Cache
Cacti 的详细介绍 :请点这里
Cacti 的下载地址 :请点这里
更多 Ubuntu 相关信息见 Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2
前言:
原本是想源码安装的,但是现在发现还是太麻烦了,就直接通过 apt-get install 安装了。
一、Cacti 概述
1. Cacti 是用 php 语言实现的一个软件,它的主要功能是用 snmp 服务获取数据,然后用 rrdtool 储存和更新数据,当用户需要查看数据的时候用 rrdtool 生成图表呈现给用户。因此,snmp 和 rrdtool 是 cacti 的关键。Snmp 关系着数据的收集,rrdtool 关系着数据存储和图表的生成。
2. MySQL 配合 PHP 程序存储一些变量数据并对变量数据进行调用,如:主机名、主机 ip、snmp 团体名、端口号、模板信息等变量。
3. snmp 抓到数据不是存储在 mysql 中,而是存在 rrdtool 生成的 rrd 文件中(在 cacti 根目录的 rra 文件夹下)。rrdtool 对数据的更新和存储就是对 rrd 文件的处理,rrd 文件是大小固定的档案文件(Round Robin Archive),它能够存储的数据笔数在创建时就已经定义。
二、系统环境
1、Linux Ubuntu-server 3.5.0-23-generic x86_64
三、apache、mysql、php 安装
参考:http://www.linuxidc.com/Linux/2014-10/107924.htm
四、cacti 安装
enadmin@ubuntu-server:~$ apt-get update
enadmin@ubuntu-server:~$ sudo apt-get install cacti
通过这种方式安装会显示依赖包
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libperl5.14 libphp-adodb libsensors4 libsnmp-base libsnmp15 mysql-server php5-snmp rrdtool snmp
Suggested packages:
php5-ldap php5-adodb lm-sensors snmp-mibs-downloader
The following NEW packages will be installed:
cacti libperl5.14 libphp-adodb libsensors4 libsnmp-base libsnmp15 mysql-server php5-snmp rrdtool snmp
0 upgraded, 10 newly installed, 0 to remove and 113 not upgraded.
Need to get 4,205 kB/4,574 kB of archives.
After this operation, 12.6 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrors.163.com/ubuntu/ precise-security/main php5-cli amd64 5.3.10-1ubuntu3.13 [3,051 kB]
Get:2 http://mirrors.163.com/ubuntu/ precise-security/main php5-mysql amd64 5.3.10-1ubuntu3.13 [76.6 kB]
Get:3 http://mirrors.163.com/ubuntu/ precise-security/main php5-gd amd64 5.3.10-1ubuntu3.13 [38.8 kB]
Get:4 http://mirrors.163.com/ubuntu/ precise-security/main libapache2-mod-php5 amd64 5.3.10-1ubuntu3.13 [3,137 kB]
Get:5 http://mirrors.163.com/ubuntu/ precise-security/main php5-common amd64 5.3.10-1ubuntu3.13 [1,774 kB]
Get:6 http://mirrors.163.com/ubuntu/ precise-security/main libsnmp-base all 5.4.3~dfsg-2.4ubuntu1.2 [217 kB]
Get:7 http://mirrors.163.com/ubuntu/ precise-security/main libsnmp15 amd64 5.4.3~dfsg-2.4ubuntu1.2 [1,334 kB]
Get:8 http://mirrors.163.com/ubuntu/ precise-security/main mysql-server all 5.5.38-0ubuntu0.12.04.1 [11.4 kB]
Get:9 http://mirrors.163.com/ubuntu/ precise-security/main php5-snmp amd64 5.3.10-1ubuntu3.13 [11.0 kB]
Get:10 http://mirrors.163.com/ubuntu/ precise-security/main snmp amd64 5.4.3~dfsg-2.4ubuntu1.2 [162 kB]
Fetched 9,813 kB in 16s (594 kB/s)
Preconfiguring packages …
Package configuration
下面是安装过程截图
选中 Apache2 以后,接下来再会安装一些软件
Selecting previously unselected package libsensors4.
(Reading database … 58559 files and directories currently installed.)
Unpacking libsensors4 (from …/libsensors4_1%3a3.3.1-2ubuntu1_amd64.deb) …
Preparing to replace php5-cli 5.3.10-1ubuntu3.10 (using …/php5-cli_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement php5-cli …
Preparing to replace php5-mysql 5.3.10-1ubuntu3.10 (using …/php5-mysql_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement php5-mysql …
Preparing to replace php5-gd 5.3.10-1ubuntu3.10 (using …/php5-gd_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement php5-gd …
Preparing to replace libapache2-mod-php5 5.3.10-1ubuntu3.10 (using …/libapache2-mod-php5_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement libapache2-mod-php5 …
Preparing to replace php5-common 5.3.10-1ubuntu3.10 (using …/php5-common_5.3.10-1ubuntu3.13_amd64.deb) …
Unpacking replacement php5-common …
Selecting previously unselected package libperl5.14.
Unpacking libperl5.14 (from …/libperl5.14_5.14.2-6ubuntu2.4_amd64.deb) …
Selecting previously unselected package libphp-adodb.
Unpacking libphp-adodb (from …/libphp-adodb_5.12-1_all.deb) …
Selecting previously unselected package libsnmp-base.
Unpacking libsnmp-base (from …/libsnmp-base_5.4.3~dfsg-2.4ubuntu1.2_all.deb) …
Selecting previously unselected package libsnmp15.
Unpacking libsnmp15 (from …/libsnmp15_5.4.3~dfsg-2.4ubuntu1.2_amd64.deb) …
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from …/mysql-server_5.5.38-0ubuntu0.12.04.1_all.deb) …
Selecting previously unselected package php5-snmp.
Unpacking php5-snmp (from …/php5-snmp_5.3.10-1ubuntu3.13_amd64.deb) …
Selecting previously unselected package snmp.
Unpacking snmp (from …/snmp_5.4.3~dfsg-2.4ubuntu1.2_amd64.deb) …
Selecting previously unselected package rrdtool.
Unpacking rrdtool (from …/rrdtool_1.4.7-1_amd64.deb) …
Selecting previously unselected package cacti.
Unpacking cacti (from …/cacti_0.8.7i-2ubuntu1_all.deb) …
Processing triggers for man-db …
Setting up libsensors4 (1:3.3.1-2ubuntu1) …
Setting up php5-common (5.3.10-1ubuntu3.13) …
Setting up php5-cli (5.3.10-1ubuntu3.13) …
Setting up libapache2-mod-php5 (5.3.10-1ubuntu3.13) …
* Reloading web server config apache2
…done.
Setting up php5-mysql (5.3.10-1ubuntu3.13) …
Setting up php5-gd (5.3.10-1ubuntu3.13) …
Setting up libperl5.14 (5.14.2-6ubuntu2.4) …
Setting up libphp-adodb (5.12-1) …
Setting up libsnmp-base (5.4.3~dfsg-2.4ubuntu1.2) …
Setting up libsnmp15 (5.4.3~dfsg-2.4ubuntu1.2) …
Setting up mysql-server (5.5.38-0ubuntu0.12.04.1) …
Setting up php5-snmp (5.3.10-1ubuntu3.13) …
Setting up snmp (5.4.3~dfsg-2.4ubuntu1.2) …
Setting up rrdtool (1.4.7-1) …
Setting up cacti (0.8.7i-2ubuntu1) …
dbconfig-common: writing config to /etc/dbconfig-common/cacti.conf
Creating config file /etc/dbconfig-common/cacti.conf with new version
Creating config file /etc/cacti/debian.php with new version
granting access to database cacti for cacti@localhost: success.
verifying access for cacti@localhost: success.
creating database cacti: success.
verifying database cacti exists: success.
populating database via sql… done.
dbconfig-common: flushing administrative password
Creating config file /etc/cacti/apache.conf with new version
Creating config file /etc/cacti/lighttpd.conf with new version
* Reloading web server config apache2
…done.
Processing triggers for libc-bin …
ldconfig deferred processing now taking place
————————————– 分割线 ————————————–
RHEL6.4 中使用 Cacti+Spine 监控主机实现发送邮件报警 http://www.linuxidc.com/Linux/2013-11/92795.htm
RHEL6.4 中使用 Cacti+Spine 监控远程主机 http://www.linuxidc.com/Linux/2013-11/92796.htm
CentOS 5.5 完整安装 Cacti+Spine http://www.linuxidc.com/Linux/2011-12/49701.htm
CentOS 6 下 Cacti 搭建文档 http://www.linuxidc.com/Linux/2013-06/86595.htm
RHEL5.9 下 Cacti 监控部署详解 http://www.linuxidc.com/Linux/2013-06/85427.htm
CentOS 6.3 下 Cacti 安装详解 http://www.linuxidc.com/Linux/2013-05/84279.htm
CentOS Linux 下快速安装配置 Cacti 中文版 http://www.linuxidc.com/Linux/2013-03/81627.htm
————————————– 分割线 ————————————–
更多详情见请继续阅读下一页的精彩内容 :http://www.linuxidc.com/Linux/2014-10/108129p2.htm