2011년 1월 31일 월요일

[CentOS] 시스템 자원 모니터링 툴, Cacti 설정

cacti : RRDTool의 데이터를 수집하여 그래픽으로 보여주는 MRTG 솔루션




1. yum에 cacti 설정
[root@image ~]# vi /etc/yum.repos.d/cacti.repo
[cacti]
name=Dag RPM Repository for CentOS
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=0
enabled=1
protect=0


2. yum update
[root@image ~]# yum update


3. 필수 package 설치
[root@image ~]# yum install gcc gcc-c++ kernel kernel-devel net-snmp net-snmp-utils mysql mysql-server httpd php php-mysql php-snmp rrdtool tcl clamav libtool


4. cacti 설치 및 conf 설정
[root@image ~]# yum install cacti

[root@image ~]# vi /etc/httpd/conf.d/cacti.conf
Alias /cacti/ /var/www/cacti/
<Directory /var/www/cacti/>
    DirectoryIndex index.php
    Options -Indexes
    AllowOverride all
    order deny,allow
    deny from all
    allow from all
    AddType application/x-httpd-php .php
    php_flag magic_quotes_gpc on
    php_flag track_vars on
</Directory>

[root@image ~]# service httpd start


5. mysql 설정(참고: /var/www/cacti/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 = "cactiuser";
$database_port = "3306";


6. DB 접속 및 cacti 계정/ DB 생성
[root@image ~]# service mysqld start

[root@image ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3391
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> grant all on cacti.* to cactiuser@localhost identified by 'cactiuser';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)



7. cacti DB importing
[root@image ~]# cd /var/www/cacti/
[root@image ~]# mysql -u cactiuser -p cacti < cacti.sql


8. cacti DB 확인
[root@image ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3391
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cacti              |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql>


9. snmp 설정 및 실행
[root@image ~]# vi /etc/snmp/snmpd.conf
com2sec public default      public        <= 41행
group   public          v1           public        <= 48행
group   public          v2c          public        <=49행
view    all             included .1         <= 59행
60행 주석(#)처리 또는 삭제
access  public ""      any       noauth    exact  all none none        <= 65행
:wq!

[root@image ~]# service snmpd start


10. 기타 설정
[root@image ~]# chown -R cacti /var/www/cacti
[root@image ~]# chmod 777 rra log


웹브라우저에 아래와 같이 실행하면 됩니다.
http://cacti서버ip/cacti/

ID/PW : admin/admin => 암호 수정하라고 나옵니다.

cacti 초기 화면입니다. 자원관리할 서버 및 category 만들어 사용하시면 됩니다.


댓글 없음:

댓글 쓰기