Cacti2017. 9. 26. 13:22

http://blog.pages.kr/1413

 

 

Posted by 배움나눔
Cacti2016. 3. 10. 09:52

출처 : http://www.cacti.net/downloads/docs/html/cli_add_graph_template.html


It is recommended to maintain graph template associations by maintaining host templates. Each time, a graph template is added to a host template, it will automatically associated with all hosts related to that very host template.

Nevertheless, it is sometimes suitable to manually associate a certain graph template with a single host only without changing any host template. This is, where the script add_graph_template.php comes in. First, let's have a look at the whole list of features it provides. Calling the script with the parameter --help yields

shell>php -q add_graph_template.php --help

Add Graph Template Script 1.0, Copyright 2004-2013 - The Cacti Group

A simple command line utility to associate a graph template with a host in Cacti

usage: add_graph_template.php --host-id=[ID] --graph-template-id=[ID]
    [--quiet]

Required:
    --host-id             the numerical ID of the host
    --graph_template-id   the numerical ID of the graph template to be added

List Options:
    --list-hosts
    --list-graph-templates
    --quiet - batch mode value return

Let's first stick to the listing options

List all Hosts

shell>php -q add_graph_template.php --list-hosts

Known Hosts: (id, hostname, template, description)
1       127.0.0.1       8       Localhost
11      router          3       router.mydomain.com

List all Graph Template

shell>php -q add_graph_template.php --list-graph-templates

Known Graph Templates:(id, name)
2       Interface - Traffic (bits/sec)
3       ucd/net - Available Disk Space
4       ucd/net - CPU Usage
5       Karlnet - Wireless Levels
6       Karlnet - Wireless Transmissions
7       Unix - Ping Latency
8       Unix - Processes
9       Unix - Load Average
10      Unix - Logged in Users
11      ucd/net - Load Average
...

Add a Graph Template

shell>php -q add_graph_template.php --host-id=11 --graph-template-id=7

Success: Graph Template associated for host: (11: router) - graph-template: (7: Unix - Ping Latency)


Posted by 배움나눔
Cacti2015. 2. 16. 15:01

출처 : http://blog.network-outsourcing.de/cacti-howtos/cacti/installing-cacti/

Install Cacti on CentOS 6/7

In this posting you will be learning how to install Cacti on a freshly installed CentOS 6 system.

Addition Information

Do you want to have an on-demand cacti for your small office or large site ? look here: Cereus-Monitoring


Step 1 – Prerequisites

First we need to install some of the software packages needed for Cacti to run properly. Software which is not included or enabled in the base CentOS 6 installation are:

  • rrdtool
  • apache
  • mysql
  • cron
  • gcc

Let’s use yum to get these installed.

Centos 6:
yum -y install mysql-server php php-cli php-mysql net-snmp-utils rrdtool \
  php-snmp gcc mysql-devel net-snmp-devel autoconf automake libtool dos2unix

Centos 7:
yum -y install mariadb-server php php-cli php-mysql net-snmp-utils rrdtool \
  php-snmp gcc mariadb-devel net-snmp-devel autoconf automake libtool dos2unix

gcc and the devel packages are required for the installation of spine, hence that’s why we include it here.

Now let’s make sure that our webserver and the database are automatically starting up after a reboot. Use the following commands to enable these:

Centos 6:
chkconfig httpd on
chkconfig mysqld on
chkconfig crond on

Centos 7:
chkconfig httpd on
chkconfig mariadb on
chkconfig crond on

Now that we did make sure that these services start after a reboot, let’s start them manually now in order to continue the installation. Cron may already be running so don’t panic if you don’t see the usual start message:

service httpd restart
service mariadb restart
service crond restart

Step 2 – Cacti Files

Let’s now move to the actualy installation of Cacti. First we need to download and extract it. As of version 0.8.8, a fully patched Cacti including the Plugin Architecture (PIA) is officially available, so we’re downloading that one:

cd /var/www/html
wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz
tar -xzvf cacti-0.8.8b.tar.gz

I usually suggest to create a symbolic link to the newly created directory “cacti-0.8.8b”. This will make upgrades to never Cacti versions easier:

ln -s cacti-0.8.8b cacti

Step 3 – Cron and file permissions

Cacti uses cron (scheduled task) in order to execute its polling process.  It’s always a good idea to run this under a special user. Let’s create the system “cacti” user now:

adduser cacti

Having done that, we can now  add a new cron entry to your system for a 5 minute polling interval using the following command:

echo "*/5 * * * * cacti php /var/www/html/cacti/poller.php &>/dev/null" >> /etc/cron.d/cacti

Finally, we also need to make sure that the permissions on the log and rra directories are set correctly:

cd /var/www/html/cacti
chown -R cacti.apache rra log  
chmod 775 rra log

Now we patch Cacti:

wget http://www.cacti.net/downloads/patches/0.8.8b/security.patch
patch -p1 -N < security.patch

Step 4 – Cacti Database

Now that we have extracted the cacti files, we can move on preparing the database for the final installation step. Your first step should be securing the mysql database. The following command will help you with this task on a CentOS system. Make sure to select a strong password for root, e.g. MyN3wpassw0rd

/usr/bin/mysql_secure_installation

Let’s create a new database and assign a special user to it:

mysqladmin -u root -p create cacti
mysql -p cacti < /var/www/html/cacti/cacti.sql
mysql -u root -p

With the last command, you should be seing a mysql prompt where you can enter mysql commands. Here we are going to create the special cacti user. That user only needs to be able to connect from the local system and should have a strong password as well. Enter the following commands and make sure to replace the password:

GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'MyV3ryStr0ngPassword';
flush privileges;
exit

We now have the cacti files and the cacti database setup. The last step before moving to the web-based installer is setting the database credentials within the Cacti config file:

cd /var/www/html/cacti/include/
vi config.php

Change the $database_ lines to fit your new settings:

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "MyV3ryStr0ngPassword";
$database_port = "3306";
$database_ssl = false;

Depending on your installation, you should also uncomment the following line. In our example we have to make sure the following line is there:

$url_path = "/cacti/";

Step 5 – Adding firewall rules

The following settings will add access rules to http and https from outside:

Centos 7:
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

Step 6 – Running the Web-based installer

Let’s move on to the web-based installer.

Login with admin/admin and you’re ready to go !

Please go to “Console -> System Utilities” and click on “Rebuild Poller Cache” after the first login!

Posted by 배움나눔
Cacti2014. 1. 27. 19:01

출처 : http://www.unixmen.com/install-cacti-network-monitoring-tool-on-centos-6-4-rhel-6-4-scientific-linux-6-4/

Install required packages

Install the following required packages for Cacti. Cacti and some of the below prerequisites are not included in the CentOS official repository. So let us install them from EPEL repository. To install EPEL repository enter the following commands.

[root@server ~]# wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
[root@server ~]# rpm -ivh epel-release-6-8.noarch.rpm

Install Apache

Apache is used to display the the network graphs created by PHP and RRDtool.

[root@server ~]# yum install httpd httpd-devel -y

Install MySQL

MySQL is used to store the Cacti Database details.

[root@server ~]# yum install mysql mysql-server -y

Install PHP

PHP script is used to create graphs using RRDtool.

[root@server ~]# yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql -y

Install PHP-SNMP

It is an extension for SNMP to access data.

[root@server ~]# yum install php-snmp -y

Install NET-SNMP

It is used to manage network.

[root@server ~]# yum install net-snmp-utils net-snmp-libs php-pear-Net-SMTP -y

Install RRDtool

It is a database tool to manage and retrieve data’s like Network Bandwidth and CPU Load etc.

[root@server ~]# yum install rrdtool -y

After installing all the above softwares, start them.

[root@server ~]# /etc/init.d/httpd start
[root@server ~]# /etc/init.d/mysqld start
[root@server ~]# /etc/init.d/snmpd start

Let the above services to start automatically on every reboot.

[root@server ~]# chkconfig httpd on
[root@server ~]# chkconfig mysqld on
[root@server ~]# chkconfig snmpd on

Installing Cacti Tool

[root@server ~]# yum install cacti -y

Configure MySQL

Login to MySQL server as root user and create a database for Cacti. Here i use Cacti database name as cacti, username as cacti and password as centos respectively.

[root@server ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.69 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;
Query OK, 1 row affected (0.01 sec)

mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.00 sec)

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

mysql> exit
Bye

Now import Cacti Tables to Cacti Database. Find the location of the file cacti.sql and import it to cacti database. To find out this file, enter the following command.

[root@server ~]# rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti-0.8.8a/cacti.sql

Note down the path of cacti.sql file and import it using the following command.

[root@server ~]# mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8a/cacti.sql 
Enter password:

(오류 발생시에는 mysql root 계정의 패스워드 생성 후 다시 시도)

Now the tables are imported into cacti database.

Open the /etc/cacti/db.php and make the following changes.

[root@server ~]# vi /etc/cacti/db.php 
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";        ## Name of the Cacti Database ##
$database_hostname = "localhost";
$database_username = "cacti";       ## Username for Cacti database ##     
$database_password = "centos";              ## Database password ##
$database_port = "3306";
$database_ssl = false;

/*

Configure Apache server

Open the file /etc/httpd/conf.d/cacti.conf and add your network range or you can add a single ip. In this case, i add my local network ip range 192.168.1.0/24.

[root@server ~]# 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 192.168.1.0/24
        </IfModule>
</Directory>

Restart your apache server finally.

[root@server ~]# /etc/init.d/httpd restart

If you wanna to start the installer from a remote machine, you should allow the apache default port 80 through your iptables.

[root@server ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

Restart iptables.

[root@server ~]# /etc/init.d/iptables restart

Configure Cron for Cacti

Open the file /etc/cron.d/cacti and uncomment the following line.

[root@server ~]# vi /etc/cron.d/cacti
*/5 * * * *     cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

The above cron job runs the poller.php script every five minutes and collects the data of the known hosts by Cacti.

Run Cacti installer

Navigate to your web browser using the URL http://ip-address/cacti. The following screen should appear, Click Next.

cacti - Mozilla Firefox_001

Select New install from the drop down box and click Next.

cacti - Mozilla Firefox_002

In the next screen make sure that all the values are valid and click Finish.

cacti - Mozilla Firefox_003

Now the installation is completed and it will ask the cacti username and password to login to admin console. The default username and password of Cacti is admin.

Login to Cacti - Mozilla Firefox_007

It will ask you to change the admin password now. Enter the new password and click Save.

Login to cacti - Mozilla Firefox_009

Now you will get the main console window of Cacti.

Console - Mozilla Firefox_010

Create Graphs

Click New Graphs on the left pane of console screen. Select the Host or create a new one and Select SNMP – Generic OID Template in Graph Templates section and click Create.

Console -- Create New Graphs - Mozilla Firefox_013

Console -- Create New Graphs -- Create Graphs from Data Query - Mozilla Firefox_014

After creating the graphs, you can preview them using graphs tab on the menu bar. Here are some of my localhost Cacti screen-shots.

Localhost – Memory Usage Graph

Graphs -- Tree Mode -- Localhost - Memory Usage - Mozilla Firefox_016

Localhost – Disk space Graph

Graphs -- Tree Mode -- Localhost - Disk Space - -dev-mapper-vg_ - Mozilla Firefox_017

Localhost – Load Average Graph

Graphs -- Tree Mode -- Localhost - Load Average - Mozilla Firefox_018

Localhost – Logged in users Graph

Graphs -- Tree Mode -- Localhost - Logged in Users - Mozilla Firefox_019

Localhost – Processes Graph

Graphs -- Tree Mode -- Localhost - Processes - Mozilla Firefox_020

Thats it. Happy Monitoring!!!

For questions please refer to our Q/A forum at : http://ask.unixmen.com/
Posted by 배움나눔
Cacti2013. 8. 16. 18:58

[root@localhost ~]# service ntpd stop

 

[root@localhost ~]# ntpdate 123.123.123.123

 

[root@localhost ~]# service ntpd start

 

부팅시에 ntpd 데몬이 실행되도록 등록

[root@localhost ~]# chkconfig ntpd on

 

 

Posted by 배움나눔
Cacti2013. 5. 27. 18:45

SPINE: Poller[0] FATAL: Connection Failed, Error:'1040', Message:'Too many connections' (Spine thread)

MYSQL 세션 제한에 따른 오류로 MYSQL 동시 세션수를 늘려 주면된다

 

# vi /etc/my.cnf

[mysqld]

max_connections=999

 

 

MYSQL 재시작

# service mysqld restart

 

Posted by 배움나눔
Cacti2013. 5. 10. 17:55

CACTI 에서 TCP PORT 카운트 하기

아래는 TCP 22 를 카운트 한 명령어.

 

snmpwalk -Oa -c wz123n -v 2c 1.1.1.30 | grep 22 | grep  est | grep tcpConnS | wc -l

Posted by 배움나눔
Cacti2013. 4. 8. 14:40

출처 : http://dikehtonon.blogspot.kr/2012/03/cacti-http-to-https.html

원본 :

Though may not be required for most users to use Secured HTTP for their Cacti System, some may be required as a basic policy requirements especially for financial institutions. The simple PHP code below will redirect all http request to https, this is also the simplest method that will do the job compared to other methods that you may find on the web.

------------------------------------------------------------------------------------

<?php
if ($_SERVER['SERVER_PORT']!=443)
{
$url = "https://". $_SERVER['SERVER_NAME'] . ":443".$_SERVER['REQUEST_URI'];
header("Location: $url");
}
?>

------------------------------------------------------------------------------------

1. Edit the index.php located on cacti's root folder

#cd /var/www/cacti
#vi index.php

copy the PHP code above and insert it on the first line of index.php

2. Exit from vi saving the changes and restart httpd service

#service httpd restart

 

cactiez 0.8

Edit the index.php located on cacti's root folder

#cd /var/www/html/index.php
#vi index.php

Posted by 배움나눔
Cacti2013. 3. 29. 18:31

 

출처 : http://blog.naver.com/PostView.nhn?blogId=pcbman75&logNo=70042373129&parentCategoryNo=&categoryNo=&viewDate=&isShowPopularPosts=false&from=memoPostView

1. Cacti가 설치된 리눅스에 ssh로 로그인후

2. vi 편집기로 아래 파일의 4~50번째 줄에 있는 아래 내용을 편집

   vi /var/www/html/scripts/ss_host_disk.php

   Code: 아래 부분을 찾아서 주석 처리 해준다.

   변경전 :    if ($arr2[$i] > 100000)   

   변경후 : /*   if ($arr2[$i] > 100000)    */

재시작 후 완료

Posted by 배움나눔
Cacti2012. 5. 29. 11:31

출처 : http://www.mimul.com/pebble/default/2012/05/16/1337154545185.html

 

Cacti로 MySQL 모니터링 및 튜닝 포인트

모니터링 도구로 Nagios, Zabbix, Ganglia 등 많지만, 저는 Cacti를 사용해 왔고(많이 사용한 건 아니지만) 최근 들어 많은 기능이 고도화(알림, 템플릿, 다루기 쉬움)되어서 나름 괜찮다고 생각해 Cacti를 가지고 MySQL을 모니터링하고 일부 튜닝 포인트도 잡을 수 있는 내용으로 기술해 봅니다.

모니터링하기 위해 Cacti를 설치하고, Plugin을 등록하자.

기존에 Cacti 설치 매뉴얼은 여기를 참조하면 설치가 가능하다. 이번에는 추가적으로 자주 활용되는 Cacti Plugin을 더 설치하였다.
> wget http://www.cacti.net/downloads/cacti-0.8.7i-PIA-3.1.zip
> unzip cacti-0.8.7i-PIA-3.1.zip
> cd /home/k2/www/cacti
> patch -p1 -N < /logs/src/cacti-0.8.7i-PIA-3.1/cacti-plugin-0.8.7e-PA-v2.6.diff

> cd /home/k2/www/cacti
> wget http://docs.cacti.net/_media/plugin:settings-v0.71-1.tgz -O settings.tgz
> tar zxvf settings*.tgz -C /home/k2/www/cacti/plugins
> chown -R apache:apache /home/k2/www/cacti/plugins/settings
> wget http://docs.cacti.net/_media/plugin:clog-v1.7-1.tgz -O clog.tgz 
> tar zxvf clog*.tgz -C /home/k2/www/cacti/plugins 
> chown -R apache:apache /home/k2/www/cacti/plugins/clog
> wget http://docs.cacti.net/_media/plugin:thold-v0.4.9-3.tgz -O thold.tgz 
> tar zxvf thold*.tgz -C /home/k2/www/cacti/plugins 
> chown -R apache:apache /home/k2/www/cacti/plugins/thold
> wget http://docs.cacti.net/_media/plugin:monitor-v1.3-1.tgz -O monitor.tgz
> tar zxvf monitor*.tgz -C /home/k2/www/cacti/plugins 
> chown -R apache:apache /home/k2/www/cacti/plugins/monitor
MySQL 모니터링을 위한 Cacti 템플릿으로 사용한 것은 better-cacti-templates(percona-monitoring-plugins)이다.
해당 플러그인을 다운로드 받은 다음 cacti 디렉토리의 ss_get_by_ssh.php, ss_get_mysql_stats.php 파일을 Cacti가 설치된 디렉토리의 scripts디렉토리(/home/k2/www/cacti/scripts)에 카피한다.
그리고 아래와 같이 MySQL의 계정 정보를 수정해 준다.
> vi ss_get_mysql_stats.php
$mysql_user = 'cactiuser';
$mysql_pass = 'cactipassword';
$mysql_port = 3306;
그 다음 다운받은 percona-monitoring-plugins Templates를 Cacti UI를 통해 아래와 같이 Import를 해준다.

Console -> Import Templates -> Import Template from Local File 에 cacti_host_template_percona_mysql_server_ht_0.8.6i-sver1.0.0.xml 파일을 업로드 한다.
그려면 success라는 응답을 내려주면서 정상적으로 Template이 등록이 완료된다.

그 다음 MySQL 서버가 Cacti 서버와 분리되어 있다면 Create Devices를 통해 호스트 등록을 하면서 Template과 함께 등록한다.
저는 Cacti 서버에 설치된 MySQL을 모니터링하기 때문에 기존 등록된 localhost에 template을 반영하도록 했다.

  • Console -> Devices -> Associated Graph Templates 에서 percona 템플릿 추가한다.
  • Console -> Data Sources Add 버튼을 클릭해서 데이터 소스 등록한다.
  • Console -> Graph Management Graph Add 하고 해당 Data Source 등록한다.

MySQL 성능 모니터링 관련 지표들을 몇가지 살펴보면

프로젝트 오픈 전에는 log-slow-queries, log_queries_not_using_indexes 등을 설정하여 인덱스를 사용하지 않는 쿼리, 인덱스를 사용해도 전체 Scan하는 쿼리를 모두 기록하고 그것을 튜닝한다. 그런데 전수 조사하기에는 분명 빠지는 부분이 있을 것이다.
그러나 오픈 후에는 성능상의 이유로 이런 기능을 disable시켜 놓게 된다. 하지만 문제되는 쿼리들은 분명 나오게 되는데 이를 해결하기 위해서는 모니터링 도구를 통해 즉각 대응할 수 있어야 한다. 그래서 Template에 사용되는 MySQL의 모니터링 도구에 표시되는 그래프를 통해 튜닝 포인트를 찾아내는 방법에 대해서 알아본다.

1) 트랜잭션 상황을 파악하는 MySQL Transaction Handler이 그래프는 트랜젝션 완료 갯수와 롤백 개수를 나타낸다.


롤백의 현황을 통해 쿼리의 오류 정도를 확인 가능하고 Deadlock을 예측해 볼 수도 있다.

2) SQL의 종류를 확인하는 MySQL Command Counters
이 그래프는 어떤 종류의 SQL 문장이 실행되었는지를 나타내주는 그래프다. 단위 간격(기본 5분)마다 횟수이다 m는 밀리, 즉 1/1000이다. 예를 들면 100m라는 것은 5분 동안 발생 횟수가 0.1회하는 것으로, 50분만에 1번 발생했다는 것을 나타낸다.


Com은 Command의 약자로 Com Select/Delete/Insert/Update/Replace는 이름 그대로 SQL 실행 횟수이다. Com xxx Multi는 여러 테이블을 일괄적으로 Update하는 수를 나타낸다.
Questions은 MySQL 서버 시작 후 지금까지 요청된 쿼리 수.

3) SELECT의 실행 계획을 확인하는 MySQL Select Types
이 그래프는 개별 쿼리에 대해 EXPLAIN을함으로써 어떤 실행 계획을 사용하는지 알 수 있다.


인덱스가 없는 칼럼을 조회하는 Select Full Join에 표시되고 범위 지정도 역시 인덱스를 타지 않고 Join을 했을 경우 Select Full Range Join을 보면 된다.
이런 값들이 발생할 경우 튜닝의 대상으로 삼아야 한다.

4) 쿼리의 I/O 동작을 알수 있는 MySQL Handlers
MySQL 쿼리 실행 후 스토리지 엔진 API를 통해 일어나는 파일이나 디스크 I/O를 볼 수 있게 해 준다. show session status 값.


- Handler Read First : 테이블이나 인덱스의 Full Index Scan 시의 먼저 첫 번째 레코드 수. -> 튜닝 대상.
- Handler Read Key : 인덱스 키값에 따라 점프하여 읽는 횟수.
- Handler Read Next : 키 값에 따라 레코드를 확인한 후 후속 행을 읽은 횟수.
- Handler Read Prev : 키 값에 따라 이전 레코드 읽는 횟수.
- Handler Read Rnd : Random Read 값.
- Handler Read Rnd Next : Random Read 후속 읽기 횟수. -> 튜닝 대상.

5) 쿼리 캐시 감시하는 MySQL Query Cache
이 그래프는 캐시의 사용 변화 추이를 살펴 보면서 캐시를 효율적으로 사용하는지 파악하는 데 도움을 준다.


- Qcache_hits : 캐시에서 질의를 가져올 때마다 값이 증가.
- Qcache_inserts : 질의가 들어올 때마다 증가. inserts를 hits로 나누면 비적중률을, 1에서 비적중률을 빼면 적중률 계산이 가능함.
- Qcache_lowmem_prunes : 캐시를 위한 메모리가 부족해져 더 많은 질의를 위한 공간을 확보하기 위해 정리되어야 하는 횟수. 증가 추세에 있다면 단편화가 심각하거나 메모리가 부족하다는 징후.
- Qcache_not_cached : 일반적으로 SELECT 구문이 아니기 때문에 캐시 후보에서 제외된 질의 숫자.

6) 키 효율성 확인하는 MyISAM Indexes
키 버퍼는 MyISAM 테이블을 위한 인덱스 블록을 저장한다. 이상적인 경우 이 블록에 대한 요청은 디스크가 아니라 메모리에서 일어나야 한다는점을 알아두자.


- Key_reads : 디스크에서 요청한 숫자.
- Key_read_requests : 전체 숫자. Key_reads를 Key_read_requests로 나누면 비적중률 계산 가능. 비적중률이 높다면 키 버퍼를 늘려야 하는 등의 튜닝을 가해야 함.


Posted by 배움나눔