LoginSignup
6
8

More than 5 years have passed since last update.

Performance Co-Pilotについてのメモ

Posted at

Performance Co-Pilotとは

Performance Co-Pilotは、サーバのメトリクス収集/分析ツールキット(ツールセット)。PCPと略されている事が多い。
2007年から開発されていて、今も活発なOSSなのだが、日本での利用事例はほとんど見つからない。
メトリクス取集、データ保存、可視化がモジュール化されていて拡張可能になっている。
調べている範囲では(使いやすい)SNMPという印象。

アーキテクチャ概要

図は、Administrator Guideから抜粋。
pcp01.png

pmcd
Performance Metrics Collection Daemon略。各サーバで動作する。コアとなるデーモンプログラム
PMDA
Performance Metrics Domain Agentの略。メトリクスの収集対象とpmcdを接続するためのPlugin。PMDAの下の四角がメトリクスを取得する対象で、CPU,Disk,Database,個別アプリケーションなどが相当する。
PMAPI
Performance Metrics Application Programming Interfaceの略。図にはないが、pmcdからメトリクスと収集するClientためのAPI。Monitorのpmcdの間
Monitor
pmcdからメトリクスと収集するClient。しきい値を超えるとアラートを投げるClient、過去データを分析するClientなどがある

主要モジュール

pmcd
前述の通り。コアとなるデーモンプログラム。
計測対象の全てのサーバで起動する。
pmlogger
pmcdからメトリクスを収集しファイルとして保管するデーモンプログラム。
取得メトリクスと時間間隔を設定する。リモートのpmcdから収集する事も可能。メトリクスを保存したいのならこのデーモンを動かす必要がある。
pmwebd
pmapiのHTTP版API(PMWEBAPI)を提供するデーモンプログラム
RESTfulなAPIになっている。NetflixのVectorが利用している。

主要クライアントツール

  • pminfo
    収集可能なメトリクスを表示する。
$ pminfo
kernel.all.load
kernel.all.intr
kernel.all.pswitch
...

$ pminfo -T kernel.percpu.cpu.idle
kernel.percpu.cpu.idle
Help:
percpu idle CPU time metric from /proc/stat
$ 
  • pmstat
    vmstatとほぼ同じシステムメトリクスを表示する。オプション指定でリモートサーバや過去ログの表示も可能。
$ pmstat -t 5
@ Thu Apr 16 08:38:51 2015
 loadavg                      memory      swap        io    system         cpu
   1 min   swpd   free   buff  cache   pi   po   bi   bo   in   cs  us  sy  id
    0.00      0 177984 189220 442728    0    0    0    9   11   19   0   0 100
    0.00      0 177952 189220 442728    0    0    0    0   10   18   0   0 100
    0.00      0 177952 189220 442728    0    0    0    0   11   20   0   0 100
    0.00      0 177952 189220 442728    0    0    0    0   10   18   0   0 100
  • pmval
    メトリクス値を表示する。オプション指定でリモートサーバや過去ログの表示も可能。
$ pmval -h localhost -t 5sec -s 4 kernel.percpu.cpu.idle
metric:    kernel.percpu.cpu.idle
host:      ip-xxx-xxx-xxx-xxx
semantics: cumulative counter (converting to rate)
units:     millisec (converting to time utilization)
samples:   4
interval:  5.00 sec
              cpu0
               0.9979
               0.9999
               1.000
               0.8079
  • pmie
    メトリクスの条件を設定し、アラートを投げることができる。独自スクリプトで記述する必要があるが、きめ細かい設定ができる。
    記述例:
// Some Common Performance Monitoring Scenarios
//
// The Disk Group
//
delta = 15 sec; // often enough for disks?
// common prefixes
//
disk = "disk";
// Any disk performing more than 40 I/Os per second, sustained over
// at least 30 seconds is probably busy
//
delta = 30 seconds;
disk_busy =
 some_inst (
 $disk.dev.total > 40 count/sec
 )
] -> shell "Mail -s 'Heavy systained disk traffic' sysadm";
// Try and catch bursts of activity ... more than 60 I/Os per second
// for at least 25% of 8 consecutive 3 second samples
//
delta = 3 sec;
disk_burst =
 some_inst (
 25%_sample (
 $disk.dev.total @0..7 > 60 count/sec
 )
 )
 -> alarm "Disk Burst? " "%i ";
// any SCSI disk controller performing more than 3 Mbytes per
// second is busy
// Note: the obscure 512 is to convert blocks/sec to byte/sec,
// and pmie handles the rest of the scale conversion
//
some_inst $disk.ctl.blktotal * 512 > 3 Mbyte/sec
 -> alarm "Busy Disk Controller: " "%i ";

PCPの設定

pmdcの設定

pmloggerの設定

PMDA一覧

PMDA(Performance Metrics Domain Agent)を使えば、様々なメトリクスを収集できる。

  • pmdaapache
    Exports performance metrics from the Apache Web Server.
  • pmdacisco
    Extracts performance metrics from one or more Cisco routers.
  • pmdaelasticseach
    Extracts performance metrics from an elasticsearch cluster.
  • pmdagfs2
    Exports performance metrics from the GFS2 clustered filesystem.
  • pmdagluster
    Extracts performance metrics from the Gluster filesystem.
  • pmdainfiniband
    Exports performance metrics from the Infiniband kernel driver.
  • pmdakvm
    Extracts performance metrics from the Linux Kernel Virtual Machine (KVM) infrastructure.
  • pmdalustrecomm
    Exports performance metrics from the Lustre clustered filesystem.
  • pmdamailq
    Exports performance metrics describing the current state of items in the sendmail queue.
  • pmdamemcache
    Extracts performance metrics from memcached, a distributed memory caching daemon commonly used to improve web serving performance.
  • pmdammv
    Exports metrics from instrumented applications linked with the pcp_mmv shared library or the Parfait framework for Java instrumentation. These metrics are custom developed per application, and in the case of Parfait, automatically include numerous JVM, Tomcat and other server or container statistics.
  • pmdamysql
    Extracts performance metrics from the MySQL relational database.
  • pmdanamed
    Exports performance metrics from the Internet domain name server, named.
  • pmdanginx
    Extracts performance metrics from the nginx HTTP and reverse proxy server.
  • pmdapostfix
    Export performance metrics from the Postfix mail transfer agent.
  • pmdapostgres
    Extracts performance metrics from the PostgreSQL relational database.
  • pmdaproc
    Exports performance metrics for running processes.
  • pmdarsyslog
    Extracts performance metrics from the Reliable System Log daemon.
  • pmdasamba
    Extracts performance metrics from Samba, a Windows SMB/CIFS server.
  • pmdasendmail
    Exports mail activity statistics from sendmail.
  • pmdashping
    Exports performance metrics for the availability and quality of service (response-time) for arbitrary shell commands.
  • pmdasnmp
    Extracts SNMP performance metrics from local or remote SNMP-enabled devices.
  • pmdasummary
    Derives performance metrics values from values made available by other PMDAs. It is a PMDA itself.
  • pmdasystemd
    Extracts performance metrics from the systemd and journald services.
  • pmdatrace
    Exports transaction performance metrics from application processes that use the pcp_trace library.
  • pmdavmware
    Extracts performance metrics from a VMWare virtualization host.
  • pmdaweblog
    Scans Web-server logs to extract metrics characterizing.
  • pmdaxfs
    Extracts performance metrics from the Linux kernel XFS filesystem implementation.
6
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
8