Ubuntu 16.04
Sponsored Link

Cacti : インストール
2016/06/08
 
Cacti をインストールし、システムの状態を監視できるようにします。
[1]
[2]
[3]
[4] Cacti, SNMP をインストールします。
root@dlp:~#
apt-get -y install cacti snmp snmpd snmp-mibs-downloader php-mysql php-snmp rrdtool
# apache2 を選択
   +-------------------------+ Configuring cacti +--------------------------+
   | Please select the web server for which Cacti should be automatically   |
   | configured.                                                            |
   |                                                                        |
   | Select "None" if you would like to configure the web server manually.  |
   |                                                                        |
   | Web server:                                                            |
   |                                                                        |
   |                                apache2                                 |
   |                                lighttpd                                |
   |                                None                                    |
   |                                                                        |
   |                                                                        |
   |                                 <Ok>                                   |
   |                                                                        |
   +------------------------------------------------------------------------+

# No を選択
 +---------------------------+ Configuring cacti +---------------------------+
 |                                                                           |
 | The cacti package must have a database installed and configured before    |
 | it can be used.  This can be optionally handled with dbconfig-common.     |
 |                                                                           |
 | If you are an advanced database administrator and know that you want to   |
 | perform this configuration manually, or if your database has already      |
 | been installed and configured, you should refuse this option.  Details    |
 | on what needs to be done should most likely be provided in                |
 | /usr/share/doc/cacti.                                                     |
 |                                                                           |
 | Otherwise, you should probably choose this option.                        |
 |                                                                           |
 | Configure database for cacti with dbconfig-common?                        |
 |                                                                           |
 |                    <Yes>                       <No>                       |
 |                                                                           |
 +---------------------------------------------------------------------------+
[5] SNMP (Simple Network Management Protocol) を設定します。
root@dlp:~#
vi /etc/snmp/snmp.conf
# 4行目:コメントにする

#
mibs :
root@dlp:~#
vi /etc/snmp/snmpd.conf
# 49行目:コメント解除してコミュニティ名を任意の名前に変更

rocommunity
Serverworld
localhost
# 51行目:コメントにする

#
rocommunity public default -V systemonly
root@dlp:~#
systemctl restart snmpd

# 動作確認 (「Serverworld」の箇所は設定したコミュニティ名)

root@dlp:~#
snmpwalk -v 2c -c Serverworld localhost system

SNMPv2-MIB::sysDescr.0 = STRING: Linux dlp.srv.world 4.4.0-22-generic 
    #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1732) 0:00:17.32
.....
.....
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.10 = Timeticks: (1) 0:00:00.01
[6] Cacti 用のユーザーとデータベースを MariaDB に登録し、テーブルをインポートしておきます。
root@dlp:~#
mysql -u root -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 10.0.24-MariaDB-7 Ubuntu 16.04

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# 「Cacti」データベース作成 ( 'password'の箇所は設定するパスワードを入力 )

MariaDB [(none)]>
create database cacti;

Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
grant all privileges on cacti.* to cacti@'localhost' identified by 'password';

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
flush privileges;

Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
exit

Bye
root@dlp:~#
mysql -u cacti -p cacti < /usr/share/doc/cacti/cacti.sql

Enter password:    
# cacti ユーザーのパスワード
[7] Cacti の設定です。
root@dlp:~#
vi /usr/share/cacti/site/include/config.php
# 42行目:DB接続情報を変更

$database_type = "mysqli";
$database_default = "
cacti
";
$database_hostname = "localhost";
$database_username = "
cacti
";
$database_password = "
password
";
$database_port = "
3306
";
$database_ssl = false;
root@dlp:~#
vi /etc/apache2/conf-available/cacti.conf
# 7行目:必要に応じてアクセス許可範囲を変更

#
Require all granted
Require host localhost
Require ip 10.0.0.0/24
root@dlp:~#
systemctl restart apache2

 
Tweet