差分
このページの2つのバージョン間の差分を表示します。
ja:documentation:05_big_environments:08_optimization [2022/02/11 12:50] – [KeyBuffer の大きさ] junichi | ja:documentation:05_big_environments:08_optimization [Unknown date] (現在) – 削除 - 外部編集 (Unknown date) 127.0.0.1 | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Pandora FMS の最適化と問題解決 ====== | ||
- | {{indexmenu_n> | ||
- | |||
- | [[ja: | ||
- | |||
- | ===== Pandora FMS の最適化と問題解決 ===== | ||
- | |||
- | ==== 概要 ==== | ||
- | |||
- | Pandora FMS server can monitor about 2000 devices (between 5 and 80 thousands modules, [[: | ||
- | |||
- | Pandora FMS サーバは、約 2000のデバイス(5 から 8万モジュール、[[: | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round tip 60%>\\ | ||
- | This article also explains some techniques to detect and solve problems of your Pandora FMS installation.\\ | ||
- | </ | ||
- | |||
- | <WRAP center round tip 60%>\\ | ||
- | この章ではまた、Pandora FMS の問題発見および解決のためのテクニックについて説明します。 | ||
- | </ | ||
- | |||
- | ===== Enterprise 版のための MySQL 最適化 ===== | ||
- | |||
- | <WRAP center round tip 60%>To learn more about "Data Backup and Recovery in Pandora FMS", [[: | ||
- | |||
- | <WRAP center round tip 60%>" | ||
- | |||
- | |||
- | ==== 一般的に推奨する設定 ==== | ||
- | |||
- | To work with tables larger than 2 GiB it is necessary to follow some guidelines: | ||
- | |||
- | 2GiBを超えるテーブルを持つ巨大なシステムを必要とするのであれば、次のガイドラインに従う必要があります。 | ||
- | |||
- | * MySQL® recommends using a 64-bit system. 32-bit systems may have serious problems from the [[https:// | ||
- | * The more RAM and the more CPU, the better the performance. In our experience, RAM is more important than CPU. The minimum for an enterprise level system will be 4 GiB. A good choice for a large system is 16 GiB. Remember that more RAM can speed up key updates by keeping the most used key pages in RAM. | ||
- | * It is a good idea to be able to remove the system in case of failure. For systems where the database is on another dedicated server for the database use Gigabit Ethernet, preferably with fiber optics rather than copper. Latency is as important as performance. | ||
- | * Disk optimization is very important for very large databases: databases and tables will have to be split on different disks. In MySQL® you can use symbolic links for this. Use different disks for the system and the database. | ||
- | |||
- | * MySQL® は 64Bit システムの利用を推奨します。32Bit システムでは、[[https:// | ||
- | * よりよいパフォーマンスを得るために十分なメモリとCPUを用意します。われわれの経験では、CPUよりもメモリのほうが重要です。エンタープライズレベルであれば最低 4GiB 必要です。巨大なシステムであれば、16GiB 割り当てるというのもよいでしょう。メモリが十分あれば、利用されるインデックスの大半をメモリ上に置くことでインデックスの更新が高速化されるということを忘れてはいけません。 | ||
- | * 障害が発生した場合にシステムを切り離すようにできるようにするのが良いでしょう。特定のサーバにデータベースがあるシステムの場合は、ギガビットイーサを利用すべきです。待ち時間はパフォーマンスにとって重要です。 | ||
- | * ディスクの最適化は、とても大きなデータベースにとっては大変重要です。データベースおよびテーブルを異なるディスクに分割すべきです。MySQL では、シンボリックリンクを使うことができます。システムおよび、データベースで異なるディスクを使い、一つのハードディスクのアクセスを減らすようにすることが重要です。 | ||
- | |||
- | <WRAP center round tip 60%> The use of [[https:// | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | システムの応答時間を早めるために、SSD を利用することをお勧めします。 | ||
- | </ | ||
- | |||
- | * Use '' | ||
- | * If you start the client and MySQL in the same machine, use sockets instead of TCP/IP connexions when connecting with MySQL® (this could result in an improvement of a 7.5%). Do it without specifying the host name or the //localhost // when connecting with MySQL®: disallow the start of the binary session an the // | ||
- | * Using recent versions of MySQL® (5.5 or later) over older versions of MySQL® (5.0.x) can offer up to a 20% difference in performance. | ||
- | * We recommend the use of the modified version of MySQL® ([[https:// | ||
- | |||
- | * 可能であれば、'' | ||
- | * もし、MySQLサーバとクライアントを同じマシン上で起動するなら、TCP/ | ||
- | * MySQL® の最近のバージョン(5.5以降)を利用することにより、古いバージョン(5.0.x)よりも 20% ほどパフォーマンスが向上します。 | ||
- | * よりパフォーマンスの高い、修正版の MySQL ([[https:// | ||
- | |||
- | Please note that performance is greatly affected by the following points: | ||
- | |||
- | 以下の点においてパフォーマンスは大きく影響を受けることに注意してください。 | ||
- | |||
- | * Only use binary logs if you use a MySQL® configuration with replication. | ||
- | * Do not use query traceability logs or slowquery logs. | ||
- | |||
- | * MySQL® でレプリケーション設定を行う時のみ binary log を利用してください。 | ||
- | * クエリのトレースログや slowquery ログは利用しないでください。 | ||
- | |||
- | ==== MySQL の設定をチェックするためのツール ==== | ||
- | MySQL サーバの設定を " | ||
- | |||
- | Mattew Montgomery の **MySQL Tuning Primer** は、MySQL のパフォーマンスをチェックする(コマンドライン)ツールです。そして、それを改善するためのちょっとした提案をしてくれます。https:// | ||
- | |||
- | ==== バイナリログ出力の停止 ==== | ||
- | |||
- | <WRAP center round important 60%> If you have configured a [[: | ||
- | |||
- | <WRAP center round important 60%> [[: | ||
- | |||
- | It is enabled by default on most GNU/Linux distros. To disable it, edit the '' | ||
- | |||
- | 多くの Linux ディストリビューションにおいてデフォルトで有効になっています。無効にするには、'' | ||
- | |||
- | < | ||
- | |||
- | # log-bin=mysql-bin | ||
- | # binlog_format=mixed | ||
- | |||
- | </ | ||
- | |||
- | Comment both lines, **and then restart MySQL Server**. | ||
- | |||
- | 両方の行をコメントアウトし、**MySQL サーバを再起動します**。 | ||
- | |||
- | ==== ディスク I/O パフォーマンス ==== | ||
- | |||
- | <WRAP center round tip 60%>To learn more about “Data Backup and Recovery in Pandora FMS”, [[: | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 60%>" | ||
- | </ | ||
- | |||
- | There are three very important configuration tokens, directly related to disk IO, and should be considered because improper IO access is usually the most important bottleneck in MySQL. | ||
- | |||
- | ディスク I/O に直結し、考慮すべきとても重要な 3つの設定があります。MySQL において、不適切な I/O アクセスは、通常最も重要なボトルネックになります。 | ||
- | |||
- | **innodb_log_file_size** | ||
- | < | ||
- | |||
- | innodb_log_file_size = 64M | ||
- | |||
- | </ | ||
- | |||
- | This value is set by default, which can be higher (even 512M) without any risk, except for recovery in case of any problem or higher disk occupation. The default value of MySQL is 5M, which is very low for production environments with high transaction volume. **To change this value with an already running system:** | ||
- | |||
- | デフォルトではこの値が設定されていますが、問題が発生した場合の回復とディスク占有率が増えることを除いては、事前検証なしに高くすることができます(512Mでも)。 MySQL のデフォルト値は 5M です。これは、トランザクション量が多い本番環境では非常に低い値です。 | ||
- | 稼働中のシステムで値を変更するには、次のようにします。 | ||
- | |||
- | - First make a complete DUMP in the databases. | ||
- | - Delete the **Innodb** | ||
- | - Change file '' | ||
- | - Restart MySQL. | ||
- | - Load the SQL DUMP. | ||
- | |||
- | - データベースのフルバックアップ(SQL ダンプ)を行います。 | ||
- | - Innodb バイナリインデックスファイル(通常は ''/ | ||
- | - my.cnf を編集します。 | ||
- | - MySQL を再起動します。 | ||
- | - ダンプを読み込みます。 | ||
- | |||
- | Since the process is the same as the one to activate the ''// | ||
- | |||
- | サーバは、新たなトランザクションログファイルを新たなサイズで再生成し、通常通り動きだします。この処理は '' | ||
- | |||
- | **innodb_io_capacity** | ||
- | < | ||
- | innodb_io_capacity = 100 | ||
- | |||
- | </ | ||
- | |||
- | This parameter has the value 100 by default, but you have to know the IOPS of the system disk. You can know exactly by looking for IOPS and the exact hard disk model (obtained via smartctl), where the recommended values are: 7500RPM → 100 IOPS, 15000 RPM → 190 IOPS, SSD → 1500 IOPS. | ||
- | |||
- | デフォルトでは、このパラメータの値は 100 です。ただし、事前にシステムのディスクの IOPS を知る必要があります。正確な IOPS およびハードディスクのモデルを(smartctlを使って)知ることができます。ここでのお勧めの値は、7500RPM → 100 IOPS, 15000 RPM → 190 IOPS, SSD → 1500 IOPS です。 | ||
- | |||
- | <WRAP center round tip 60%>To install **smarctl** | ||
- | |||
- | '' | ||
- | |||
- | '' | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | |||
- | '' | ||
- | |||
- | '' | ||
- | |||
- | </ | ||
- | |||
- | **innodb_file_per_table** | ||
- | |||
- | Using a table space for each table ( [[https:// | ||
- | |||
- | テーブルごとにファイルを作成します。 | ||
- | |||
- | In MySQL 5.0, it is possible to store each InnoDB table and its index in its own file. This feature is called “multiple tablespaces” because each table has its own table space. | ||
- | |||
- | MySQL 5.0 では、各 InnoDB テーブルとそのインデックスを独自のファイルに保存することができます。この機能は、各テーブルに独自のテーブルスペースがあるため、" | ||
- | |||
- | The use of multiple space tables can be useful for users that want to move specific tables to separate physical disks or the ones who want to restore table back ups without interrupting the use of the rest of the InnoDB tables. | ||
- | |||
- | 複数のスペーステーブルの使用は、特定のテーブルを別々の物理ディスクに移動したい場合や、残りの InnoDB テーブルの使用を中断せずにテーブルのバックアップを復元したい場合に役立ちます。 | ||
- | |||
- | It is possible to activate multiple table spaces adding this line to the my.cnf Mysqld section | ||
- | |||
- | my.cnf の mysqld セクションに以下の設定を追加することにより、複数のテーブルスペースを有効化できます。 | ||
- | |||
- | < | ||
- | |||
- | [mysqld] | ||
- | innodb_file_per_table | ||
- | |||
- | </ | ||
- | |||
- | After restarting the server, InnoDB will store each new created table in its own '' | ||
- | |||
- | サーバーを再起動した後、InnoDB は、新しく作成された各テーブルを、テーブルが属するデータベースディレクトリ内の独自の '' | ||
- | |||
- | For InnoDB, data and index are kept together in the '' | ||
- | |||
- | InnoDB の場合、データとインデックスは '' | ||
- | |||
- | **innodb_file_per_table** | ||
- | |||
- | **innodb_file_per_table** は、テーブルの作成にのみ影響します。 このオプションを使用してサーバを起動すると、'' | ||
- | |||
- | ==== トランザクションごとのディスク書き込みの回避 ==== | ||
- | |||
- | MySQL establishes '' | ||
- | |||
- | デフォルトでは、MySQLは各接続開始時の autocommit の値を '' | ||
- | |||
- | さて, なぜディスクへの書き込みがよくないのでしょうか? | ||
- | |||
- | ディスクの書き込みに平均9msかかるとすると、おおよそ1秒当たり67コミットに制限されます。これは非常に遅いです。そして、ディスクのあるセクタに書き込み中は、そのセクタを読み込むことはできません。InnoDBはこれらの制限のいくつかを複数の書き込みを同時に実行することで回避しています。しかしそれでも制約が存在します。 | ||
- | |||
- | InnoDB can avoid some of this limitations by associating some writing together, but, even with this, this restriction still exists. You can prevent if from writing at the end of each transaction, | ||
- | |||
- | システムによる“自動”書き込み(およそ1秒ごとに書き込みを行う)を利用することで、各トランザクションが完了するたびにディスクへ書き込むことを回避することができます。問題が発生した場合、最近1秒のデータが失われますが、パフォーマンス向上を得ようとしていることを考慮すれば、許容できる範囲でしょう。デフォルトでは、'' | ||
- | |||
- | ==== KeyBuffer の大きさ ==== | ||
- | システムに搭載された物理メモリ量に依存しますが、非常に重要なグローバル変数であり、これを設定することでDELETEおよびSELECTの実行速度が改善されます。 | ||
- | |||
- | < | ||
- | key_buffer_size = 4M | ||
- | |||
- | </ | ||
- | |||
- | 上記は、デフォルトの設定値です。 | ||
- | |||
- | ==== 他の重要なバッファ ==== | ||
- | いくつかのディストリビューションでは、デフォルトで設定されていないいくつかのバッファがあります。これらのパラメータを設定することによりデフォルトより高いパフォーマンスを得ることができます。これらのトークンが MySQL の設定ファイルに存在するかどうかを確認することが重要です。 | ||
- | |||
- | < | ||
- | query_cache_size = 64M | ||
- | query_cache_limit = 2M | ||
- | join_buffer_size = 4M | ||
- | </ | ||
- | |||
- | ==== InnoDB の同時実行スレッド ==== | ||
- | Pandora の MySQL サーバパフォーマンスを向上に有効なパラメータがあります。そのパラメータは、' | ||
- | |||
- | * MySQL バージョン。異なるバージョンの MySQL では、このパラメータはとても異なる動作をします。 | ||
- | * 物理プロセッサ数。 | ||
- | |||
- | MySQL の公式ドキュメントは、[[http:// | ||
- | |||
- | お勧めの値は、(物理的な)CPU数の2倍に、InnoDB が置かれているディスクの数を足した数です。MySQL の最近のバージョン (> 5.0.21) では、デフォルトは 8 です。0 に設定すると、" | ||
- | |||
- | < | ||
- | |||
- | innodb_thread_concurrency = 0 | ||
- | |||
- | </ | ||
- | |||
- | 他に (([[http:// | ||
- | |||
- | |||
- | ==== MySQL フラグメンテーション ==== | ||
- | ファイルシステムのように、データベースもフラグメンテーションが発生しシステム全体の速度が低下します。Pandora のように高いパフォーマンスを必要とするシステムでは、高速で信頼性の高いデータベースが必要です。高負荷なシステムでは、監視システムが停止する可能性があります。 | ||
- | |||
- | Pandora FMS で良いパフォーマンスを得るには、MySQL の設定がとても重要です。パフォーマンスの問題がある場合は、MySQL の設定やデータベースに関する問題である可能性があります。 | ||
- | |||
- | ===my.ini/ | ||
- | |||
- | Let us start with my.ini, the "basic configuration" | ||
- | |||
- | MySQL サーバの " | ||
- | |||
- | < | ||
- | |||
- | mysqld --help --verbose | more | ||
- | |||
- | </ | ||
- | |||
- | {{ : | ||
- | |||
- | This file in your setup should be similar to this one (this is for a 4GB RAM Server using old (2013) average server hardware). Make sure that you have these tokens inside your [mysqld] section: | ||
- | |||
- | このファイルは以下のような設定ファイルになっています(この例は、メモリ 4GB の 2013 年の古い平均的なサーバハードウエアです)。[mysqld] セクション内のトークンを確認します。 | ||
- | |||
- | < | ||
- | |||
- | [mysqld] | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | If there is any change in the .cnf file, restart the MySQL. Take a look at the end of the / | ||
- | |||
- | .cnf ファイルを変更した場合は、MySQL を再起動する必要があります。エラーの確認には / | ||
- | |||
- | === データベースのリストア === | ||
- | |||
- | .cnf ファイルを変更する場合の共通の問題としては、トランザクションログの値があります。 | ||
- | ログに次のようなエラーが出た場合は、 | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | 以前の設定をリストアするには、データベースのバックアップを生成し次の手順を実行します。 | ||
- | |||
- | 1. バックアップを作成したら、MySQL サービスを停止します。 | ||
- | |||
- | systemctl stop mysql | ||
- | |||
- | 2. MySQL データファイルがあるフォルダ(デフォルトは / | ||
- | |||
- | cd /var/lib/ | ||
- | |||
- | 3. フォルダを他の場所へ移動します。(/ | ||
- | |||
- | mv mysql mysql_old | ||
- | |||
- | 4. 新たなフォルダを作成します。(/ | ||
- | |||
- | mkdir mysql | ||
- | |||
- | 5. フォルダのオーナーを設定します。 | ||
- | |||
- | chown -R mysql. mysql. | ||
- | |||
- | 6. MySQL データでフォルダを初期化します。 | ||
- | |||
- | mysql_install_db --datadir=/ | ||
- | |||
- | 7. サービスを開始します。 | ||
- | |||
- | systemctl start mysql | ||
- | |||
- | 8. 設定プログラムを起動し、ウィザードに従います。 | ||
- | |||
- | mysql_secure_installation | ||
- | |||
- | 9. データベースを再構築します。 | ||
- | |||
- | mysql> create database pandora; | ||
- | |||
- | 10. ユーザに権限を割り当てます。 | ||
- | |||
- | < | ||
- | mysql> grant all privileges on pandora.* to pandora@' | ||
- | mysql> grant all privileges on pandora.* to pandora@' | ||
- | </ | ||
- | |||
- | 11. バックアップを読み込みます。 | ||
- | |||
- | mysql> source / | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 時々、MySQL/ | ||
- | </ | ||
- | |||
- | mysql を再起動したのち、設定が反映されて動作しているかを確認する必要があります。それには、SHOW VARIABLES コマンドを用います。 | ||
- | |||
- | < | ||
- | mysql> show variables like ' | ||
- | +-----------------------------------------+------------------------+ | ||
- | | Variable_name | ||
- | +-----------------------------------------+------------------------+ | ||
- | | innodb_adaptive_hash_index | ||
- | | innodb_additional_mem_pool_size | ||
- | | innodb_autoextend_increment | ||
- | | innodb_autoinc_lock_mode | ||
- | | innodb_buffer_pool_size | ||
- | | innodb_checksums | ||
- | | innodb_commit_concurrency | ||
- | | innodb_concurrency_tickets | ||
- | | innodb_data_file_path | ||
- | | innodb_data_home_dir | ||
- | | innodb_doublewrite | ||
- | | innodb_fast_shutdown | ||
- | | innodb_file_io_threads | ||
- | | innodb_file_per_table | ||
- | | innodb_flush_log_at_trx_commit | ||
- | | innodb_flush_method | ||
- | | innodb_force_recovery | ||
- | | innodb_lock_wait_timeout | ||
- | | innodb_locks_unsafe_for_binlog | ||
- | | innodb_log_buffer_size | ||
- | | innodb_log_file_size | ||
- | | innodb_log_files_in_group | ||
- | | innodb_log_group_home_dir | ||
- | | innodb_max_dirty_pages_pct | ||
- | | innodb_max_purge_lag | ||
- | | innodb_mirrored_log_groups | ||
- | | innodb_open_files | ||
- | | innodb_rollback_on_timeout | ||
- | | innodb_stats_method | ||
- | | innodb_stats_on_metadata | ||
- | | innodb_support_xa | ||
- | | innodb_sync_spin_loops | ||
- | | innodb_table_locks | ||
- | | innodb_thread_concurrency | ||
- | | innodb_thread_sleep_delay | ||
- | | innodb_use_legacy_cardinality_algorithm | ON | | ||
- | +-----------------------------------------+------------------------+ | ||
- | </ | ||
- | |||
- | === 各テーブルごとに分割されたデータファイルがアクティブであるか確認 === | ||
- | |||
- | ls -lah / | ||
- | |||
- | " | ||
- | |||
- | すでに単一のデータベースで実行している場合は、設定を変更し MySQL を再起動したあとにデータベースを再作成する必要があります。 | ||
- | |||
- | === テーブルごとのフラグメンテーションを確認 === | ||
- | MySQL の CLI を使って、以下のクエリを実行します。 | ||
- | |||
- | Select ENGINE, TABLE_NAME, | ||
- | |||
- | フラグメンテーションのあるテーブルが次のように表示されます。 | ||
- | |||
- | < | ||
- | +--------+-------------------------+-------------+--------------+-----------+------------+ | ||
- | | ENGINE | TABLE_NAME | ||
- | +--------+-------------------------+-------------+--------------+-----------+------------+ | ||
- | | InnoDB | tserver_export_data | ||
- | | InnoDB | tagent_module_inventory | 0 | 0 | 6 | 25.6000 | | ||
- | | InnoDB | tagente_datos_inventory | 4 | 0 | 40 | | ||
- | | InnoDB | tsesion_extended | ||
- | | InnoDB | tagent_access | ||
- | | InnoDB | tpending_mail | ||
- | | InnoDB | tagente_modulo | ||
- | | InnoDB | tgis_data_history | ||
- | | InnoDB | tsesion | ||
- | | InnoDB | tupdate | ||
- | | InnoDB | tagente_datos | ||
- | | InnoDB | tagente_datos_string | ||
- | | InnoDB | tevento | ||
- | | InnoDB | tagente_datos | ||
- | | InnoDB | tagente_datos_string | ||
- | +--------+-------------------------+-------------+--------------+-----------+------------+ | ||
- | </ | ||
- | |||
- | 10% 以上フラグメンテーションがあるテーブルに対してのみ対応します。 | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 10% 以上のフラグメンテーションがあるテーブルのみを対象とします。大きなテーブル(tagente_datos など)は、フラグメンテーションが大きいと最適化に長時間かかります。本番システムでは大きなインパクトとなりますので、注意してください。 | ||
- | </ | ||
- | |||
- | " | ||
- | |||
- | optimize table tagent_module_inventory; | ||
- | |||
- | 次のような警告メッセージが表示されます。 | ||
- | |||
- | "Table does not support optimize, doing recreate + analyze instead" | ||
- | |||
- | 再度確認すると、フラグメンテーションが無くなっていることがわかります。 | ||
- | |||
- | < | ||
- | +--------+-------------------------+-------------+--------------+-----------+------------+ | ||
- | | ENGINE | TABLE_NAME | ||
- | +--------+-------------------------+-------------+--------------+-----------+------------+ | ||
- | | InnoDB | tserver_export_data | ||
- | | InnoDB | tagente_datos_inventory | 4 | 0 | 40 | | ||
- | | InnoDB | tsesion_extended | ||
- | | InnoDB | tagent_access | ||
- | | InnoDB | tpending_mail | ||
- | | InnoDB | tagente_modulo | ||
- | | InnoDB | tgis_data_history | ||
- | | InnoDB | tsesion | ||
- | | InnoDB | tupdate | ||
- | | InnoDB | tagente_datos | ||
- | | InnoDB | tagente_datos_string | ||
- | | InnoDB | tevento | ||
- | | InnoDB | tagente_datos | ||
- | | InnoDB | tagente_datos_string | ||
- | +--------+-------------------------+-------------+--------------+-----------+------------+ | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 最適化を実行するには、操作を実行できるだけのディスクの空き容量が必要です。そうでないとエラーとなり処理が実行されません。 | ||
- | </ | ||
- | |||
- | === システム負荷 === | ||
- | |||
- | より一般的な事として、システムの(ディスク) I/O がボトルネックになっていないことを確認する必要があります。システムの状態を取得するのに、vmstat コマンドを実行します。 | ||
- | |||
- | vmstat 1 10 | ||
- | |||
- | 最後のカラム (CPU WA) を見て、10より大きい値であればディスク I/O の問題があり、解決する必要があります。CPU US が高いのは通常です。CPU SY は 10~15 を超えないようにすべきです。swap si/so はゼロであるべきです。そうでなければシステムがスワップメモリを使っていることを意味し、パフォーマンスを落とします。メモリを増やすか、アプリケーションが使うメモリを減らす(Pandora サーバのスレッド、MySQL のバッファの調整など)必要があります。 | ||
- | |||
- | 以下は、" | ||
- | |||
- | < | ||
- | procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu----- | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | ==== テーブルパーティショニングの利用 ==== | ||
- | // | ||
- | |||
- | MySQL 5.1 では、巨大なテーブルを小さい複数の論理的なテーブルに分割することができるテーブルパーティショニングを行えるようになりました。 | ||
- | (詳細は MySQL のマニュアルを参照して下さい: | ||
- | |||
- | もし Pandora FMS データベースに大量のデータがあり、グラフ描画のようなデータを参照する処理がとても遅いと感じるなら、テーブルパーティショニングを行うことでパフォーマンスを改善できるでしょう。 | ||
- | |||
- | 最初に、innodb_file_per_table が有効であり、データベースがそれを使用していることを確認してください。/ | ||
- | |||
- | innodb_file_per_table があることを確認したら、固定日付に基づいて 2つのメインデータテーブルを異なるパーティションに分割します。 この例では、2015年以降のデータを分割していますが、自分のニーズに合わせて変更できます。 | ||
- | |||
- | これには十分なディスク容量が必要です。 tagente_datos.ibd の大きさを確認してください。10G の場合、操作を開始するには少なくとも 15GB の空きが必要です。 | ||
- | |||
- | テーブルサイズによっては、この操作に時間がかかる場合があります。例えば、100日間(50, | ||
- | |||
- | MySQL の CLI 以下のクエリを実行します。 | ||
- | |||
- | < | ||
- | ALTER TABLE tagente_datos PARTITION BY RANGE (utimestamp) ( | ||
- | PARTITION Ene15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Feb15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Mar15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Apr15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION May15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Jun15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Jul15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Ago15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Sep15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Oct15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Nov15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION Dec15 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION pActual VALUES LESS THAN (MAXVALUE) | ||
- | ); | ||
- | </ | ||
- | |||
- | パーティション分割を再編成するには、毎月以下のクエリを実行します。 | ||
- | |||
- | < | ||
- | ALTER TABLE tagente_datos REORGANIZE PARTITION pActual INTO ( | ||
- | PARTITION Feb16 VALUES LESS THAN (UNIX_TIMESTAMP(' | ||
- | PARTITION pActual VALUES LESS THAN MAXVALUE); | ||
- | </ | ||
- | |||
- | " | ||
- | |||
- | tagente_datos をモジュールIDに応じて100のパーティションに分割する場合は、次のクエリを実行します: | ||
- | |||
- | ALTER TABLE tagente_datos PARTITION BY HASH(id_agente_modulo) PARTITIONS 100; | ||
- | |||
- | " | ||
- | |||
- | < | ||
- | [root@firefly pandora_history]# | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | ==== データベースの再構成 ==== | ||
- | |||
- | === 部分的再構成 === | ||
- | |||
- | MySQLは他のデータベースシステム、たとえばOracle (tm)と同様、時間がたつにつれ、性能が劣化していきます。これは大きなテーブルに対してデータの削除と追加を続けることによって発生するデータのフラグメンテーションによるものです。大量のトラフィックが発生する大きな環境において、性能の改善および劣化を防ぐ非常に簡単な方法があります。それは定期的にデータベースの再構築を実施することです。 | ||
- | |||
- | そのために、1時間程度のサービス停止を計画すべきです。 | ||
- | |||
- | <WRAP center round info 60%>In this service stop, stop the Pandora FMS WEB console and the server too (**be careful**, leave the Tentacle server so that it can still receive data and these will be processed as soon as the server works again).</ | ||
- | |||
- | <WRAP center round info 60%> | ||
- | (**注意** tentacle サーバはデータを受け取れるようにしておき、サーバが復旧次第データを処理できるようにします)</ | ||
- | |||
- | サービス停止後、データベースのダンプを取得(エクスポート)します。 | ||
- | |||
- | < | ||
- | | ||
- | Enter password: | ||
- | |||
- | </ | ||
- | |||
- | データベースを削除します。 | ||
- | |||
- | |||
- | < | ||
- | Enter password: | ||
- | |||
- | </ | ||
- | |||
- | < | ||
- | | ||
- | Query OK, 87 rows affected (1 min 34.37 sec) | ||
- | |||
- | </ | ||
- | |||
- | データベースを作成し、先ほどエクスポートしたデータをインポートします。 | ||
- | |||
- | < | ||
- | | ||
- | Query OK, 1 row affected (0.01 sec) | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | 巨大でハードウエア性能があまり高くないシステムでは、この処理全体で数分かかります。たとえば、1500エージェントおよび 100, | ||
- | |||
- | <WRAP center round important 60%>It is possible to automatize this process, but, because it is very delicate, the best option is carry it out manually.</ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | |||
- | === 全体の再構築 === | ||
- | |||
- | この節の説明は、Innodb データベースのみ該当します。Pandora FMS は、Innodb データベースを利用しています。 | ||
- | |||
- | 時間ともに MySQL のパフォーマンスが落ちると、システム全体のパフォーマンスに影響します。この場合は、すべてのデータベーススキーマをゼロから再構築する以外に解決策はありません。MySQL がデータの保存に利用しているバイナリファイルを利用し、またそれを再構築します。 | ||
- | |||
- | / | ||
- | |||
- | < | ||
- | -rw-rw---- | ||
- | -rw-rw---- | ||
- | -rw-rw---- | ||
- | </ | ||
- | |||
- | |||
- | ibdata1 は、すべての Innodb データを保存する先です。非常に断片化されたシステムでは、再構築やインストールをした効率の良いシステムと比べると非常に処理時間を要します。前に言及した **innodb_file_per_table** パラメータは、このパフォーマンスを調整します。 | ||
- | |||
- | それぞれのデータベースは / | ||
- | |||
- | 手順はとても簡単です。 | ||
- | |||
- | - (mysqldump にて)全スキーマをディスクにダンプします。\\ < | ||
- | - MySQL を停止します。 | ||
- | - ibdata1, ib_logfile0, | ||
- | - MySQL を再起動します。 | ||
- | - バックアップファイル(all.sql)をインポートします。\\ < | ||
- | | ||
- | |||
- | システムが高速化します。 | ||
- | |||
- | ==== インデックスオプション ==== | ||
- | 他のシステムリソースを犠牲にして、MySQL パフォーマンスを最適化できるいくつかの場合があります。 | ||
- | |||
- | 以下のインデックスの最適化はグラフ生成を(とても)高速化しますが、多くのディスクスペースを必要とします。また、インデックスのオーバーヘッドにより、若干 INSERT/ | ||
- | |||
- | ALTER TABLE `pandora`.`tagente_datos` | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | 現在、MySQL の Pandora FMS の最も重いテーブルでは、この最適化がデフォルトになっています。MySQL テーブルを最適化する前に専門家に相談するのが良いです。 | ||
- | </ | ||
- | |||
- | ==== スロウクエリ ==== | ||
- | いくつかのシステムでは保持している情報によって、通常よりもシステムのパフォーマンスが悪いスロウクエリが見られることがあります。テーブルを最適化するために、(システムのパフォーマンスに影響する)一定時間を超えたこのタイプのクエリをログに記録するようにできます。これを有効にするには次のようにします。 | ||
- | |||
- | * [[: | ||
- | |||
- | * my.cnf を編集し、次の設定を加えます。 | ||
- | |||
- | < | ||
- | |||
- | slow_query_log = 1 | ||
- | long_query_time = 2 | ||
- | slow_query_log_file = / | ||
- | |||
- | </ | ||
- | |||
- | * To be able to use it and set the admin rules: | ||
- | |||
- | * 利用できるように次のように設定します。 | ||
- | |||
- | < | ||
- | touch / | ||
- | chown mysql:mysql / | ||
- | chmod 640 / | ||
- | |||
- | </ | ||
- | |||
- | * Restart mysql. | ||
- | * When finishing analyzing which ones are the slow queries, remember to reset the file '' | ||
- | |||
- | * mysql を再起動します。 | ||
- | * スロウクエリの分析が終了したら、ファイル '' | ||
- | |||
- | ==== 特定のテーブルのオプティマイズ ==== | ||
- | 他のあまり“過激”ではないフラグメンテーションの問題を解決する方策として、Pandora FMSのテーブルのいくつかに対してMYSQL OPTIMIZEツールを使用するというのがあります。 | ||
- | |||
- | < | ||
- | OPTIMIZE table tagente_datos; | ||
- | OPTIMIZE table tagente; | ||
- | OPTIMIZE table tagente_datos_string; | ||
- | OPTIMIZE table tagent_access; | ||
- | OPTIMIZE table tagente_modulo; | ||
- | OPTIMIZE table tagente_estado; | ||
- | </ | ||
- | |||
- | この作業によって、パフォーマンスが改善されるでしょう。この作業は 1週間に複数回実行する必要はありません。システムの稼働中にさっと完了するでしょう。 | ||
- | 巨大な環境においては、OPTIMIZE コマンドがブロックされるかもしれません。このような場合、一番よい代替案はDBの再構築です。 | ||
- | |||
- | これらの作業を実施した後、以下のコマンドを実行すべきです。 | ||
- | |||
- | FLUSH TABLES; | ||
- | |||
- | MySQLのマニュアルから、 | ||
- | |||
- | InnoDB のテーブルに対しては OPTIMIZE TABLE は ALTER TABLE にマップされており、インデックス統計の更新とクラスタされたインデックス内の使用されていないスペースを解放するためにテーブルが再構築されます。 | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | 7.0 OUM715 以降のインストールでは、デフォルトで以下の設定が適用されます。 | ||
- | </ | ||
- | |||
- | **注意:** Pandora FMS バージョン 7.0 OUM 715 より前では、データベース(通常の DB とヒストリ DB 共)に以下の対応をすることをお勧めします。 | ||
- | |||
- | alter table tagente_datos add index (id_agente_modulo, | ||
- | |||
- | この操作は、// | ||
- | |||
- | ==== MySQL の特別なトークン ==== | ||
- | |||
- | There are some very " | ||
- | |||
- | MySQL には、いくつかの " | ||
- | |||
- | * '' | ||
- | < | ||
- | # Set to 0 in mysql 5.1.12 or higher | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | This parameter in versions 5.1.12 or higher, on 0 value, means there is no limit on concurrency, | ||
- | |||
- | この // | ||
- | |||
- | * '' | ||
- | < | ||
- | innodb_flush_method = O_DIRECT | ||
- | |||
- | </ | ||
- | |||
- | This important parameter has an effect on how information is written on the disk. | ||
- | |||
- | この重要なパラメータは、ディスクにデータをどう書くかに影響します。 | ||
- | |||
- | * '' | ||
- | < | ||
- | innodb_lock_wait_timeout = 90 | ||
- | |||
- | </ | ||
- | |||
- | This helps when there is a bottleneck, so that MySQL does not go away and stops. **If it lasts more than 90 lock, there is a real problem.** | ||
- | |||
- | これは、データベースが長いトランザクションによりロックし" | ||
- | |||
- | ==== 参考情報 ==== | ||
- | 参考: | ||
- | |||
- | * http:// | ||
- | * http:// | ||
- | |||
- | ===== MySQL Percona XTraDB ===== | ||
- | |||
- | Percona is an improved version of MySQL, particularly regarding scalability (fast growth without affecting or slightly affecting work operations and routines). Make the most out of all the system' | ||
- | |||
- | Percona は、MySQL の " | ||
- | |||
- | To configure your percona server, use their excelent online configuration wizard, which will generate the /// | ||
- | |||
- | percona サーバを設定するには、/// | ||
- | |||
- | ==== Pandora FMS のキャパシティ計測 ==== | ||
- | この章では、高いキャパシティが必要な環境での Pandora FMS を設定するための異なる手法を説明します。また、処理を実行する環境を調整するのに便利な負荷テストを行うためのツールについても説明します。 | ||
- | |||
- | Pandora FMS は、1つのサーバでデータベース、コンソール、サーバを動かした場合、2500エージェントに対応できるように設定されています。推奨するエージェント数は、1システムあたり 2500 です。しかし、この数は、XML エージェントの割合、リモートモジュールの割合、監視間隔、システムのメモリ量に応じて変化します。 | ||
- | |||
- | これらの全ての要素が、1つのシステムで管理できるエージェント数に関わります。テスト環境では、通常のハードウエアの 1台のサーバで 10000 エージェントを実行できましたが、高度な最適化をしています。 | ||
- | |||
- | ==== 高キャパシティサーバの設定例 ==== | ||
- | 例えば、16GB の RAM および 4 CPU のマシンで、データサーバが最大のパフォーマンス (XML 処理) を出すように最適化したいと思います。 | ||
- | |||
- | ==== my.cnf ==== | ||
- | |||
- | <WRAP center round info 60%>Only the most important parameters are shown).</ | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | < | ||
- | [mysqld] | ||
- | datadir=/ | ||
- | socket=/ | ||
- | user=mysql | ||
- | character-set-server=utf8 | ||
- | skip-character-set-client-handshake | ||
- | # Disabling symbolic-links is recommended to prevent assorted security risks | ||
- | symbolic-links=0 | ||
- | # Mysql optimizations for Pandora FMS | ||
- | # Please check the documentation in http:// | ||
- | max_allowed_packet = 64M | ||
- | innodb_buffer_pool_size = 800M | ||
- | innodb_lock_wait_timeout = 90 | ||
- | innodb_file_per_table | ||
- | innodb_flush_log_at_trx_commit = 0 | ||
- | innodb_flush_method = O_DIRECT | ||
- | innodb_log_file_size = 64M | ||
- | innodb_log_buffer_size = 16M | ||
- | innodb_io_capacity = 100 | ||
- | thread_cache_size = 8 | ||
- | thread_stack | ||
- | max_connections = 100 | ||
- | wait_timeout = 900 | ||
- | key_buffer_size=4M | ||
- | read_buffer_size=128K | ||
- | read_rnd_buffer_size=128K | ||
- | sort_buffer_size=128K | ||
- | join_buffer_size=4M | ||
- | query_cache_type = 1 | ||
- | query_cache_size = 64M | ||
- | query_cache_min_res_unit = 2k | ||
- | query_cache_limit = 256K | ||
- | sql_mode="" | ||
- | [mysqld_safe] | ||
- | log-error=/ | ||
- | pid-file=/ | ||
- | |||
- | </ | ||
- | |||
- | ==== pandora_server.conf ==== | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | 以下の点を認識しておく必要があります。 | ||
- | |||
- | * The '' | ||
- | |||
- | * '' | ||
- | |||
- | * A high number (15) of the parameter '' | ||
- | |||
- | * パラメータ '' | ||
- | |||
- | * A very high number of threads (more than 5) set in '' | ||
- | |||
- | * '' | ||
- | |||
- | * Some configuration parameters could affect a lot Pandora FMS performance, | ||
- | |||
- | * '' | ||
- | |||
- | ==== キャパシティ分析ツール (Capacity) ==== | ||
- | Pandora FMS には、ハードウエアおよびソフトウエアで、取得可能なデータ量を適切に計測できるいくつかのツールがあります。一つは、ダミーデータで直接データベースへアクセスするもの (dbstress)、もう一つは、ダミーの XML ファイルを生成するもの (xml_stress) です。 | ||
- | |||
- | === Pandora FMS の XML 負荷 === | ||
- | |||
- | This is an small script that generates XML data files like the ones sent by Pandora FMS agents. It is placed on: | ||
- | |||
- | Pandora FMS エージェントから送られるような XML データファイルを生成する小さなスクリプトが以下にあります。 | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | The scripts read agent names from a text file and generate XML data files for each agent according to a configuration file, where modules are defined as templates. | ||
- | |||
- | スクリプトは、テキストファイルからエージェント名を読み取り、設定ファイルに従って各エージェントの XML データファイルを生成します。ここで、モジュールはテンプレートとして定義されています。 | ||
- | |||
- | モジュールの値はランダムな値になります。モジュールデータの初期値および変化率は設定可能です。 | ||
- | |||
- | スクリプトは次のように実行します。 | ||
- | |||
- | < | ||
- | ./ | ||
- | |||
- | </ | ||
- | |||
- | Sample configuration file called '' | ||
- | |||
- | '' | ||
- | |||
- | < | ||
- | # Maximum number of threads, 10 by default. | ||
- | | ||
- | |||
- | # File containing a list of agent names (one per line). | ||
- | | ||
- | |||
- | # Directory where XML data files will be placed, /tmp by default. | ||
- | | ||
- | |||
- | # Pandora FMS XML Stress log file, logs to stdout by default. | ||
- | | ||
- | |||
- | # XML version, 1.0 by default. | ||
- | | ||
- | |||
- | # XML encoding, ISO-8859-1 by default. | ||
- | | ||
- | |||
- | # Operating system (shared by all agents), Linux by default. | ||
- | | ||
- | |||
- | # Operating system version (shared by all agents), 2.6 by default. | ||
- | | ||
- | |||
- | # Agent interval, 300 by default. | ||
- | | ||
- | |||
- | # Data file generation start date, now by default. | ||
- | | ||
- | |||
- | # Data file generation end date, now by default. | ||
- | | ||
- | |||
- | # Delay after generating the first data file for each agent to avoid | ||
- | # race conditions when auto-creating the agent, 2 by default. | ||
- | | ||
- | |||
- | # Address of the Tentacle server where XML files will be sent (optional). | ||
- | # server_ip 192.168.50.1 | ||
- | |||
- | # Port of the Tentacle server, 41121 by default | ||
- | # server_port 41121 | ||
- | |||
- | # Module definitions. Similar to pandora_agent.conf. | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | | ||
- | | ||
- | | ||
- | | ||
- | # Initial data. | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | **エージェントのローカル設定の送受信** | ||
- | |||
- | If you activate in your '' | ||
- | |||
- | '' | ||
- | |||
- | {{: | ||
- | |||
- | {{: | ||
- | |||
- | Besides this, you may configure where to store locally the '' | ||
- | |||
- | ほかにも、'' | ||
- | |||
- | **設定ファイル** | ||
- | |||
- | * **max_threads** スクリプトの実行スレッド数。処理率を改善します。 | ||
- | * **agent_file** 行ごとに名前を書いたファイルのパス。 | ||
- | * **temporal** 架空の XML データファイルを生成するディレクトリのパス。 | ||
- | * **log_file** スクリプトの実行について情報を出力するログのパス。 | ||
- | * **xml_version** XML データファイルのバージョン。(デフォルトは 1.0) | ||
- | * **encoding** XML データファイルのエンコーディング。(デフォルトは ISO-8859-1) | ||
- | * **os_name** 仮想エージェントの OS 名。(デフォルトは Linux) | ||
- | * **os_version** 仮想エージェントの OS バージョン。(デフォルトは 2.6) | ||
- | * **agent_interval** 仮想エージェントの実行秒間隔。(デフォルトは 300) | ||
- | * **time_from** 仮想 XML データの開始時間。" | ||
- | * **time_to** 仮想 XML データの終了時間。" | ||
- | * **get_and_send_agent_conf** 0 または 1 の値です。有効な場合、仮想エージェントは、リモート設定により、より新しいエージェントの設定ファイルをダウンロードしようとします。Pandora FMS Enterprise のコンソールから編集可能になります。 | ||
- | * **startup_delay** それぞれのエージェントがファイル生成を開始するまでの時間を秒で指定します。競合を回避するために利用します。 | ||
- | * **timezone_offset** タイムゾーンのオフセット値です。 | ||
- | * **timezone_offset_range** ランダムに指定した範囲でタイムゾーンを生成します。 | ||
- | * **latitude_base** 数値です。仮想エージェントを表示する緯度です。 | ||
- | * **longitude_base** 数値です。仮想エージェントを表示する経度です。 | ||
- | * **altitude_base** 数値です。仮想エージェントを表示する高度です。 | ||
- | * **position_radius** 数値です。指定した半径内の円に仮想エージェントがランダムに表示されます。 | ||
- | |||
- | **モジュール定義** | ||
- | |||
- | スクリプト設定の中に一つのモジュール定義があり、リモート設定を有効にした場合も一緒で、次の通りです。 | ||
- | |||
- | < | ||
- | module_begin | ||
- | module_name < | ||
- | module_type < | ||
- | module_description < | ||
- | module_exec type=< | ||
- | module_unit < | ||
- | module_min_critical <値> | ||
- | module_max_critical <値> | ||
- | module_min_warning <値> | ||
- | module_max_warning <値> | ||
- | module_end | ||
- | </ | ||
- | |||
- | それぞれの項目は次のように設定可能です。 | ||
- | |||
- | * **type_generation_xml_stress**: | ||
- | * **module_attenuation < | ||
- | * **module_attenuation_wdays <値> <値> ... < | ||
- | |||
- | < | ||
- | module_begin | ||
- | module_name Network Traffic | ||
- | module_type generic_data | ||
- | module_description Incoming network traffic (Kbit/s) | ||
- | module_exec type=RANDOM; | ||
- | module_unit Kbit/s | ||
- | module_min_critical 900000 | ||
- | module_attenuation 0.5 | ||
- | module_attenuation_wdays 0 6 | ||
- | module_end | ||
- | </ | ||
- | |||
- | * **module_incremental < | ||
- | * **その他**: | ||
- | |||
- | <WRAP center round info 60%>Note that '' | ||
- | |||
- | <WRAP center round info 60%>'' | ||
- | |||
- | ==RANDOM== | ||
- | |||
- | 次のオプションがあります。 | ||
- | |||
- | * **variation** 前回の値から変化が発生する可能性を % で指定します。 | ||
- | * **min** 値の最小値を指定します。 | ||
- | * **max** 値の最大値を指定します。 | ||
- | |||
- | **Numeric** | ||
- | |||
- | **min** と **max** の間の数値をランダムに生成します。 | ||
- | |||
- | **Boleans** | ||
- | |||
- | 0 または 1 の値を生成します。 | ||
- | |||
- | **String** | ||
- | |||
- | **min** と **max** の間の長さの文字列を生成します。文字は、A から Z の間のランダムで、大文字、小文字を含み、また数字や記号を含みます。 | ||
- | |||
- | **外部データソース (SOURCE)** | ||
- | |||
- | データのソースとしてプレーンテキストファイルを利用することができます。次のオプションがあります。 | ||
- | |||
- | * **src**: ソースデータファイル | ||
- | |||
- | ファイルは、1行に1データを含む形式で、行数に制限はありません。例えば次の通りです。 | ||
- | |||
- | < | ||
- | 4 | ||
- | 5 | ||
- | 6 | ||
- | 10 | ||
- | </ | ||
- | |||
- | 二種類のデータ(数値と文字列)を扱うことができます。これらのモジュールは、ファイルのデータ順番に読み込んで、Pandora でのモジュールデータを生成します。上記のデータの例では、次のように表示されます。 | ||
- | |||
- | 4 5 6 10 4 5 6 10 4 5 6 10 4 5 6 10 4 5 6 10 4 5 6 10 | ||
- | |||
- | ==SCATTER== | ||
- | |||
- | 数値データの場合のみ有用で、ハートビートのようなグラフを生成します。これは通常の値で、ある時間に //" | ||
- | |||
- | 次のオプションがあります。 | ||
- | |||
- | * **min** とりうる最小の値。 | ||
- | * **max** とりうる最大の値。 | ||
- | * **prob** //" | ||
- | * **avg** //" | ||
- | |||
- | ==CURVE== | ||
- | |||
- | 三角関数を使った曲線でモジュールデータを生成します。 | ||
- | 次のオプションがあります。 | ||
- | |||
- | * **min** とりうる最小の値。 | ||
- | * **max** とりうる最大の値。 | ||
- | * **time_wave_length** 山が出現する時間。 | ||
- | * **time_offset** モジュールの値が 0 の時の波形の開始タイミングを秒で指定します。(正弦波に似ています) | ||
- | |||
- | {{ wiki:Curve module xml stress.v2.png? | ||
- | |||
- | **注意事項** | ||
- | |||
- | * This tool is preconfigured to look for, in all agents, " | ||
- | |||
- | * このツールは、すべてのエージェントで、300秒から 30日の間隔を使用する " | ||
- | |||
- | === データサーバの処理能力の計測方法 === | ||
- | |||
- | There is a small script called '' | ||
- | |||
- | '' | ||
- | |||
- | This script takes into account only the packages currently existing, and it take them away from the packages existing 10 seconds ago, then divides the result by 10, and these will be the files that have been processed in the last 10 seconds, showing the rate per second. It is a rudimentary solution but it is helpful to fix the server configuration. | ||
- | |||
- | このスクリプトは、現在存在するファイルをカウントし、10秒前に処理したものを除外し、結果を 10 で割ることによって、1秒間の処理率を求めています。これは初歩的なソリューションですが、サーバの設定を修正するための情報を提供します。 | ||
- | |||
- | === Pandora FMS の DB 負荷 === | ||
- | データベースパフォーマンスを確認するためのツールがあります。これはまた、架空のデータを定期的もしくは不定期に生成するためにも利用できます。エージェントを作成し、このツールを使って自動的にデータを挿入するためのモジュールを作成しておく必要があります。 | ||
- | |||
- | * //random//: 不定期データを生成します。 | ||
- | * //curve//: 三角関数を利用して曲線データを生成します。異なる間隔で補完を見るのに便利です。 | ||
- | * // | ||
- | |||
- | //random//, //curve// および //boolean// という語を含む任意の名前を使うことができます。 | ||
- | |||
- | * random_1 | ||
- | * curve_other | ||
- | |||
- | data_server モジュールのみ選択することができます。 | ||
- | |||
- | |||
- | **//Pandora FMS の DB 負荷// ツールの調整** | ||
- | |||
- | このツールは、すべてのエージェントから、// | ||
- | |||
- | もしこの設定を変更したい場合は、// | ||
- | |||
- | < | ||
- | # Configure here target (AGENT_ID for Stress) | ||
- | my $target_module = -1; # -1 for all modules of that agent | ||
- | my $target_agent = -1; | ||
- | my $target_interval = 300; | ||
- | my $target_days = 30; | ||
- | |||
- | </ | ||
- | |||
- | - The first line of the variable corresponding with '' | ||
- | - The second line of variable must match '' | ||
- | - The third line must match '' | ||
- | - The fourth line is '' | ||
- | |||
- | - 最初の行の '' | ||
- | - 2行目の '' | ||
- | - 3行目の '' | ||
- | - 4行目の '' | ||
- | |||
- | ===== Pandora FMS の診断ツール ===== | ||
- | 時々、ユーザが問題に遭遇し、Pandora の開発者もユーザのシステムについての詳細情報が無くて手助けできないことがあります。バージョン 3.0 では、ユーザの問題を解決する手助けとなる 2つの小さなツールを作成しました。 | ||
- | |||
- | ==== 診断情報 ==== | ||
- | Pandora FMS の最新バージョンには、Pandora FMS のインストールに関する診断情報を取得する機能があります。 | ||
- | |||
- | It is inside the section of **Admin tools → Diagnostic Info** | ||
- | |||
- | それは、**管理ツール(Admin tools) -> 診断情報(Diagnostic Info)** にあります。 | ||
- | |||
- | {{ : | ||
- | |||
- | このウインドウでは、Pandora FMS と MySQL の設定情報を見ることができるのに加えて、自己監視システムのグラフを見ることができます。 | ||
- | |||
- | ==== pandora_diagnostic.sh ==== | ||
- | |||
- | {{ : | ||
- | |||
- | /// | ||
- | |||
- | * CPU 情報 | ||
- | * Uptime および CPU ロードアベレージ | ||
- | * Memory 情報 | ||
- | * Kernel/ | ||
- | * mysql 設定ファイルの内容 | ||
- | * PandoraFMS サーバ設定ファイルの内容 (パスワードはフィルタリングされます) | ||
- | * Pandora FMS ログ情報 (ただし、全ログではありません) | ||
- | * Disk 情報 | ||
- | * Pandora FMS プロセス情報 | ||
- | * kernel ログ情報 (dmesg) | ||
- | |||
- | すべての情報は、.txt ファイル内に生成されるので、この情報を手助けしてくれる人に送信することができます。たとえば、Pandora FMS ユーザフォーラムや Pandora FMS public メーリングリストなどです。この情報には、機密情報は含まれません。// | ||
- | |||
- | 以下に実行例を示します。 | ||
- | |||
- | < | ||
- | $ ./ | ||
- | |||
- | Pandora FMS Diagnostic Script v1.0 (c) ArticaST 2009 | ||
- | http:// | ||
- | |||
- | Please wait while this script is collecting data | ||
- | | ||
- | Output file with all information is in '/ | ||
- | </ | ||
- | |||
- | また、出力ファイルの例を示します。 | ||
- | |||
- | < | ||
- | Information gathered at 20090601_164511 | ||
- | Linux raz0r 2.6.28-12-generic #43-Ubuntu SMP Fri May 1 19:27:06 UTC 2009 i686 GNU/Linux | ||
- | ========================================================================= | ||
- | ----------------------------------------------------------------- | ||
- | CPUINFO | ||
- | ----------------------------------------------------------------- | ||
- | processor : 0 | ||
- | vendor_id : GenuineIntel | ||
- | cpu family : 6 | ||
- | . | ||
- | . | ||
- | ----------------------------------------------------------------- | ||
- | Other System Parameters | ||
- | ----------------------------------------------------------------- | ||
- | Uptime: | ||
- | ----------------------------------------------------------------- | ||
- | PROC INFO (Pandora) | ||
- | ----------------------------------------------------------------- | ||
- | slerena | ||
- | slerena | ||
- | ----------------------------------------------------------------- | ||
- | MySQL Configuration file | ||
- | ----------------------------------------------------------------- | ||
- | # | ||
- | # The MySQL database server configuration file. | ||
- | # | ||
- | # You can copy this to one of: | ||
- | # - "/ | ||
- | . | ||
- | . | ||
- | . | ||
- | ----------------------------------------------------------------- | ||
- | Pandora FMS Logfiles information | ||
- | ----------------------------------------------------------------- | ||
- | total 3032 | ||
- | drwxr-xrwx | ||
- | drwxr-xr-x 17 root root 4096 2009-06-01 11:24 .. | ||
- | -rw-r----- | ||
- | -rw-r--r-- | ||
- | -rw-r--r-- | ||
- | -rw-r--r-- | ||
- | -rw-rw-rw- | ||
- | -rw-rw-rw- | ||
- | -rw-r--r-- | ||
- | -rw-rw-rw- | ||
- | ----------------------------------------------------------------- | ||
- | System disk | ||
- | ----------------------------------------------------------------- | ||
- | S.ficheros | ||
- | / | ||
- | tmpfs 1003M 0 1003M 0% / | ||
- | varrun | ||
- | varlock | ||
- | udev | ||
- | tmpfs 1003M 480K 1002M 1% /dev/shm | ||
- | lrm 1003M 2,4M 1000M 1% / | ||
- | ----------------------------------------------------------------- | ||
- | Vmstat (5 execs) | ||
- | ----------------------------------------------------------------- | ||
- | procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | ----------------------------------------------------------------- | ||
- | System dmesg | ||
- | ----------------------------------------------------------------- | ||
- | [ 0.000000] BIOS EBDA/lowmem at: 0009f000/ | ||
- | [ 0.000000] Initializing cgroup subsys cpuset | ||
- | [ 0.000000] Initializing cgroup subsys cpu | ||
- | [ 0.000000] Linux version 2.6.28-12-generic (buildd@rothera) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) # | ||
- | 19:27:06 UTC 2009 (Ubuntu 2.6.28-12.43-generic) | ||
- | . | ||
- | . | ||
- | ----------------------------------------------------------------- | ||
- | END OF FILE | ||
- | ----------------------------------------------------------------- | ||
- | 560e8fa02818916d4abb59bb50d91f6a | ||
- | </ | ||