Cacti インストール
スポンサーリンク
CentOSについての記事です。
環境
CentOS 6.5
必要なもの
Apache
MySQL
Perl
RPDtool
Net-SNMP
PHP
インストール
rrdtoolのバージョン確認
# yum info rrdtool
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
Available Packages
Name : rrdtool
Arch : i686
Version : 1.3.8
Release : 6.el6
Size : 294 k
Repo : base
Summary : Round Robin Database Tool to store and display time-series data
URL : http://oss.oetiker.ch/rrdtool/
License : GPLv2+ with exceptions
Description : RRD is the Acronym for Round Robin Database. RRD is a system to store and
: display time-series data (i.e. network bandwidth, machine-room temperature,
: server load average). It stores the data in a very compact way that will not
: expand over time, and it presents useful graphs by processing the data to
: enforce a certain data density. It can be used either via simple wrapper
: scripts (from shell or Perl) or via frontends that poll network devices and
: put a friendly user interface on it.
Name : rrdtool
Arch : x86_64
Version : 1.3.8
Release : 6.el6
Size : 293 k
Repo : base
Summary : Round Robin Database Tool to store and display time-series data
URL : http://oss.oetiker.ch/rrdtool/
License : GPLv2+ with exceptions
Description : RRD is the Acronym for Round Robin Database. RRD is a system to store and
: display time-series data (i.e. network bandwidth, machine-room temperature,
: server load average). It stores the data in a very compact way that will not
: expand over time, and it presents useful graphs by processing the data to
: enforce a certain data density. It can be used either via simple wrapper
: scripts (from shell or Perl) or via frontends that poll network devices and
: put a friendly user interface on it.
rrdptoolのインストール
# yum -y install rrdtool
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rrdtool.x86_64 0:1.3.8-6.el6 will be installed
--> Processing Dependency: dejavu-sans-mono-fonts for package: rrdtool-1.3.8-6.el6.x86_64
--> Processing Dependency: dejavu-lgc-sans-mono-fonts for package: rrdtool-1.3.8-6.el6.x86_64
--> Running transaction check
---> Package dejavu-lgc-sans-mono-fonts.noarch 0:2.30-2.el6 will be installed
--> Processing Dependency: dejavu-fonts-common = 2.30-2.el6 for package: dejavu-lgc-sans-mono-fonts-2.30-2.el6.noarch
---> Package dejavu-sans-mono-fonts.noarch 0:2.30-2.el6 will be installed
--> Running transaction check
---> Package dejavu-fonts-common.noarch 0:2.30-2.el6 will be installed
--> Processing Dependency: fontpackages-filesystem for package: dejavu-fonts-common-2.30-2.el6.noarch
--> Running transaction check
---> Package fontpackages-filesystem.noarch 0:1.41-1.1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
rrdtool x86_64 1.3.8-6.el6 base 293 k
Installing for dependencies:
dejavu-fonts-common noarch 2.30-2.el6 base 59 k
dejavu-lgc-sans-mono-fonts noarch 2.30-2.el6 base 393 k
dejavu-sans-mono-fonts noarch 2.30-2.el6 base 450 k
fontpackages-filesystem noarch 1.41-1.1.el6 base 8.8 k
Transaction Summary
==============================================================================================
Install 5 Package(s)
Total download size: 1.2 M
Installed size: 2.7 M
Downloading Packages:
(1/5): dejavu-fonts-common-2.30-2.el6.noarch.rpm | 59 kB 00:00
(2/5): dejavu-lgc-sans-mono-fonts-2.30-2.el6.noarch.rpm | 393 kB 00:00
(3/5): dejavu-sans-mono-fonts-2.30-2.el6.noarch.rpm | 450 kB 00:00
(4/5): fontpackages-filesystem-1.41-1.1.el6.noarch.rpm | 8.8 kB 00:00
(5/5): rrdtool-1.3.8-6.el6.x86_64.rpm | 293 kB 00:00
----------------------------------------------------------------------------------------------
Total 1.7 MB/s | 1.2 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : fontpackages-filesystem-1.41-1.1.el6.noarch 1/5
Installing : dejavu-fonts-common-2.30-2.el6.noarch 2/5
Installing : dejavu-sans-mono-fonts-2.30-2.el6.noarch 3/5
Installing : dejavu-lgc-sans-mono-fonts-2.30-2.el6.noarch 4/5
Installing : rrdtool-1.3.8-6.el6.x86_64 5/5
Verifying : fontpackages-filesystem-1.41-1.1.el6.noarch 1/5
Verifying : rrdtool-1.3.8-6.el6.x86_64 2/5
Verifying : dejavu-sans-mono-fonts-2.30-2.el6.noarch 3/5
Verifying : dejavu-lgc-sans-mono-fonts-2.30-2.el6.noarch 4/5
Verifying : dejavu-fonts-common-2.30-2.el6.noarch 5/5
Installed:
rrdtool.x86_64 0:1.3.8-6.el6
Dependency Installed:
dejavu-fonts-common.noarch 0:2.30-2.el6 dejavu-lgc-sans-mono-fonts.noarch 0:2.30-2.el6
dejavu-sans-mono-fonts.noarch 0:2.30-2.el6 fontpackages-filesystem.noarch 0:1.41-1.1.el6
Complete!
net-snmpのバージョン確認
# yum info net-snmp
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
Available Packages
Name : net-snmp
Arch : x86_64
Epoch : 1
Version : 5.5
Release : 49.el6
Size : 305 k
Repo : base
Summary : A collection of SNMP protocol tools and libraries
URL : http://net-snmp.sourceforge.net/
License : BSD
Description : SNMP (Simple Network Management Protocol) is a protocol used for
: network management. The NET-SNMP project includes various SNMP tools:
: an extensible agent, an SNMP library, tools for requesting or setting
: information from SNMP agents, tools for generating and handling SNMP
: traps and a version of the netstat command which uses SNMP. This
: package contains the snmpd and snmptrapd daemons, documentation, etc.
:
: You will probably also want to install the net-snmp-utils package,
: which contains NET-SNMP utilities.
net-snmpのインストール
# yum -y install net-snmp
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package net-snmp.x86_64 1:5.5-49.el6 will be installed
--> Processing Dependency: net-snmp-libs = 1:5.5-49.el6 for package: 1:net-snmp-5.5-49.el6.x86_64
--> Processing Dependency: libsensors.so.4()(64bit) for package: 1:net-snmp-5.5-49.el6.x86_64
--> Processing Dependency: libnetsnmptrapd.so.20()(64bit) for package: 1:net-snmp-5.5-49.el6.x86_64
--> Processing Dependency: libnetsnmpmibs.so.20()(64bit) for package: 1:net-snmp-5.5-49.el6.x86_64
--> Processing Dependency: libnetsnmphelpers.so.20()(64bit) for package: 1:net-snmp-5.5-49.el6.x86_64
--> Processing Dependency: libnetsnmpagent.so.20()(64bit) for package: 1:net-snmp-5.5-49.el6.x86_64
--> Processing Dependency: libnetsnmp.so.20()(64bit) for package: 1:net-snmp-5.5-49.el6.x86_64
--> Running transaction check
---> Package lm_sensors-libs.x86_64 0:3.1.1-17.el6 will be installed
---> Package net-snmp-libs.x86_64 1:5.5-49.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
net-snmp x86_64 1:5.5-49.el6 base 305 k
Installing for dependencies:
lm_sensors-libs x86_64 3.1.1-17.el6 base 38 k
net-snmp-libs x86_64 1:5.5-49.el6 base 1.5 M
Transaction Summary
==============================================================================================
Install 3 Package(s)
Total download size: 1.9 M
Installed size: 6.3 M
Downloading Packages:
(1/3): lm_sensors-libs-3.1.1-17.el6.x86_64.rpm | 38 kB 00:00
(2/3): net-snmp-5.5-49.el6.x86_64.rpm | 305 kB 00:00
(3/3): net-snmp-libs-5.5-49.el6.x86_64.rpm | 1.5 MB 00:00
----------------------------------------------------------------------------------------------
Total 4.9 MB/s | 1.9 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lm_sensors-libs-3.1.1-17.el6.x86_64 1/3
Installing : 1:net-snmp-libs-5.5-49.el6.x86_64 2/3
Installing : 1:net-snmp-5.5-49.el6.x86_64 3/3
Verifying : 1:net-snmp-libs-5.5-49.el6.x86_64 1/3
Verifying : 1:net-snmp-5.5-49.el6.x86_64 2/3
Verifying : lm_sensors-libs-3.1.1-17.el6.x86_64 3/3
Installed:
net-snmp.x86_64 1:5.5-49.el6
Dependency Installed:
lm_sensors-libs.x86_64 0:3.1.1-17.el6 net-snmp-libs.x86_64 1:5.5-49.el6
Complete!
snmpd.confのコピーを作成して編集
# cp -p /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org
# vi /etc/snmp/snmpd.conf
####
# First, map the community name "public" into a "security name"
# sec.name source community
#com2sec notConfigUser default public コメントアウト
com2sec local localhost private ← 追加
com2sec mynetwork 10.10.100.1/24 ← 追加
####
# Second, map the security name into a group name:
# groupName securityModel securityName
#group notConfigGroup v1c notConfigUser ← コメントアウト
#group notConfigGroup v2c notConfigUser ← コメントアウト
group MyROGroup v1 local ← 追加
group MyROGroup v2c local ← 追加
group MyROGroup v1 mynetwork ← 追加
group MyROGroup v2c mynetwork ← 追加
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
#view systemview included .1.3.6.1.2.1.1 ← コメントアウト
#view systemview included .1.3.6.1.2.1.25.1.1 ← コメントアウト
view all included .1 80
####
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
#access notConfigGroup "" any noauth exact systemview none none ← コメントアウト
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
###############################################################################
# disk checks
#
# The agent can check the amount of available disk space, and make
# sure it is above a set limit.
# disk PATH [MIN=100000]
#
# PATH: mount path to the disk in question.
# MIN: Disks with space below this value will have the Mib's errorFlag set.
# Default value = 100000.
# Check the / partition and make sure it contains at least 10 megs.
#disk / 10000
disk / 10000 ←追加
snmpd起動
# /etc/init.d/snmpd start
Starting snmpd: [ OK ]
snmpdの自動起動と自動起動確認
# chkconfig snmpd on
# chkconfig --list snmpd
snmpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Cactiのインストール
CactiのバイナリパッケージはCentOS 6の標準リポジトリには含まれていない。
「Extra Packages for Enterprise Linux(EPEL)」というリポジトリからダウンロードします。
# cd /usr/local/src
# wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6Server/i386/cacti-0.8.8b-3.el6.noarch.rpm
--2014-03-04 22:48:29-- http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6Server/i386/cacti-0.8.8b-3.el6.noarch.rpm
Resolving ftp.jaist.ac.jp... 150.65.7.130, 2001:df0:2ed:feed::feed
Connecting to ftp.jaist.ac.jp|150.65.7.130|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2304652 (2.2M) [application/octet-stream]
Saving to: “cacti-0.8.8b-3.el6.noarch.rpm”
100%[====================================================>] 2,304,652 1.36M/s in 1.6s
2014-03-04 22:48:31 (1.36 MB/s) - “cacti-0.8.8b-3.el6.noarch.rpm” saved [2304652/2304652]
# ls -al
drwxr-xr-x. 4 root root 4096 Mar 4 22:48 .
drwxr-xr-x. 12 root root 4096 Feb 5 17:08 ..
-rw-r--r-- 1 root root 2304652 Sep 11 00:31 cacti-0.8.8b-3.el6.noarch.rpm
# yum -y install cacti-0.8.8b-3.el6.noarch.rpm
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
Setting up Install Process
Examining cacti-0.8.8b-3.el6.noarch.rpm: cacti-0.8.8b-3.el6.noarch
Marking cacti-0.8.8b-3.el6.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package cacti.noarch 0:0.8.8b-3.el6 will be installed
--> Processing Dependency: net-snmp-utils for package: cacti-0.8.8b-3.el6.noarch
--> Processing Dependency: php-mysql for package: cacti-0.8.8b-3.el6.noarch
--> Processing Dependency: php-snmp for package: cacti-0.8.8b-3.el6.noarch
--> Running transaction check
---> Package net-snmp-utils.x86_64 1:5.5-49.el6 will be installed
---> Package php-mysql.x86_64 0:5.3.3-27.el6_5 will be installed
--> Processing Dependency: php-pdo(x86-64) for package: php-mysql-5.3.3-27.el6_5.x86_64
---> Package php-snmp.x86_64 0:5.3.3-27.el6_5 will be installed
--> Running transaction check
---> Package php-pdo.x86_64 0:5.3.3-27.el6_5 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
cacti noarch 0.8.8b-3.el6 /cacti-0.8.8b-3.el6.noarch 6.2 M
Installing for dependencies:
net-snmp-utils x86_64 1:5.5-49.el6 base 173 k
php-mysql x86_64 5.3.3-27.el6_5 updates 81 k
php-pdo x86_64 5.3.3-27.el6_5 updates 75 k
php-snmp x86_64 5.3.3-27.el6_5 updates 31 k
Transaction Summary
==============================================================================================
Install 5 Package(s)
Total size: 6.6 M
Total download size: 361 k
Installed size: 7.0 M
Is this ok [y/N]: n
Exiting on user Command
[root@centostest src]# yum -y install cacti-0.8.8b-3.el6.noarch.rpm
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
Setting up Install Process
Examining cacti-0.8.8b-3.el6.noarch.rpm: cacti-0.8.8b-3.el6.noarch
Marking cacti-0.8.8b-3.el6.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package cacti.noarch 0:0.8.8b-3.el6 will be installed
--> Processing Dependency: net-snmp-utils for package: cacti-0.8.8b-3.el6.noarch
--> Processing Dependency: php-mysql for package: cacti-0.8.8b-3.el6.noarch
--> Processing Dependency: php-snmp for package: cacti-0.8.8b-3.el6.noarch
--> Running transaction check
---> Package net-snmp-utils.x86_64 1:5.5-49.el6 will be installed
---> Package php-mysql.x86_64 0:5.3.3-27.el6_5 will be installed
--> Processing Dependency: php-pdo(x86-64) for package: php-mysql-5.3.3-27.el6_5.x86_64
---> Package php-snmp.x86_64 0:5.3.3-27.el6_5 will be installed
--> Running transaction check
---> Package php-pdo.x86_64 0:5.3.3-27.el6_5 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
cacti noarch 0.8.8b-3.el6 /cacti-0.8.8b-3.el6.noarch 6.2 M
Installing for dependencies:
net-snmp-utils x86_64 1:5.5-49.el6 base 173 k
php-mysql x86_64 5.3.3-27.el6_5 updates 81 k
php-pdo x86_64 5.3.3-27.el6_5 updates 75 k
php-snmp x86_64 5.3.3-27.el6_5 updates 31 k
Transaction Summary
==============================================================================================
Install 5 Package(s)
Total size: 6.6 M
Total download size: 361 k
Installed size: 7.0 M
Downloading Packages:
(1/4): net-snmp-utils-5.5-49.el6.x86_64.rpm | 173 kB 00:00
(2/4): php-mysql-5.3.3-27.el6_5.x86_64.rpm | 81 kB 00:00
(3/4): php-pdo-5.3.3-27.el6_5.x86_64.rpm | 75 kB 00:00
(4/4): php-snmp-5.3.3-27.el6_5.x86_64.rpm | 31 kB 00:00
----------------------------------------------------------------------------------------------
Total 1.6 MB/s | 361 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-snmp-5.3.3-27.el6_5.x86_64 1/5
Installing : 1:net-snmp-utils-5.5-49.el6.x86_64 2/5
Installing : php-pdo-5.3.3-27.el6_5.x86_64 3/5
Installing : php-mysql-5.3.3-27.el6_5.x86_64 4/5
Installing : cacti-0.8.8b-3.el6.noarch 5/5
Verifying : php-mysql-5.3.3-27.el6_5.x86_64 1/5
Verifying : php-pdo-5.3.3-27.el6_5.x86_64 2/5
Verifying : 1:net-snmp-utils-5.5-49.el6.x86_64 3/5
Verifying : php-snmp-5.3.3-27.el6_5.x86_64 4/5
Verifying : cacti-0.8.8b-3.el6.noarch 5/5
Installed:
cacti.noarch 0:0.8.8b-3.el6
Dependency Installed:
net-snmp-utils.x86_64 1:5.5-49.el6 php-mysql.x86_64 0:5.3.3-27.el6_5
php-pdo.x86_64 0:5.3.3-27.el6_5 php-snmp.x86_64 0:5.3.3-27.el6_5
Complete!
cactiデータベース作成
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or ¥g.
Your MySQL connection id is 10
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '¥h' for help. Type '¥c' to clear the current input statement.
mysql> create database cacti; ←cactiのデータベースを作成
Query OK, 1 row affected (0.00 sec)
grant all privileges on cacti.* to cactiuser@localhost identified by 'cacti'; ←cactiuserを作成。パスワードはcacti
Query OK, 0 rows affected (0.00 sec)
mysql> show databases; ←cactiのデータベースを確認
+--------------------+
| Database |
+--------------------+
| information_schema |
| cacti |
| mysql |
+--------------------+
4 rows in set (0.00 sec)
mysql> exit
Bye
cacti.sqlを探し取り込み
# updatedb
# locate cacti.sql
/usr/share/doc/cacti-0.8.8b/cacti.sql
# mysql -u cactiuser -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql
Enter password:
config.phpの編集をしてMySQLの情報を設定する
# cd /usr/share/cacti/
# vi include/config.php
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
$database_port = "3306";
$database_ssl = false;
# vi /etc/httpd/conf.d/cacti.conf
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 10.10.100.1/24 ←アクセスを許可するネットワークアドレスを設定
</IfModule>
</Directory>
Apache再起動
# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for centostest
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
シンボリックリンクの作成
ln -s /usr/share/cacti /var/www/html/cacti
スポンサーリンク
Webからアクセス
http://10.10.100.213/cacti
FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php’が表示されたらinclude/config.phpの設定を見直す必要がある。
初回起動時はこのような画面になる。