Actions

Difference between revisions of "Mahara日本語ドキュメント/システム管理者ガイド/MaharaをMuninで監視する"

From Mahara Wiki

< Mahara日本語ドキュメント‎ | システム管理者ガイド
Line 28: Line 28:
 
=== プラグインの設定 ===
 
=== プラグインの設定 ===
  
あなたは「<tt>plugin-conf.d</tt>」ディレクトリ内に設定ファイルを作成する必要があります。通常、このディレクトリは「<tt>/etc/munin/</tt>」となります。設定ファイル名に関して、特定の要件はありませんが、利便性のため「mahara」にした方が良いでしょう。設定には、標準[http://munin-monitoring.org/wiki/plugin-conf.d Muninプラグイン設定属性]、データベース接続設定のlibpq環境変数 (例 PGUSER, PGHOST等) および プラグイン独自の設定が含まれます。 Generally, it is easier if you run the the plugin directly on the database server as postgres user. In this case the minimum configuration will look like:
+
あなたは「<tt>plugin-conf.d</tt>」ディレクトリ内に設定ファイルを作成する必要があります。通常、このディレクトリは「<tt>/etc/munin/</tt>」となります。設定ファイル名に関して、特定の要件はありませんが、利便性のため「mahara」にした方が良いでしょう。設定には、標準[http://munin-monitoring.org/wiki/plugin-conf.d Muninプラグイン設定属性]、データベース接続設定のlibpq環境変数 (例 PGUSER, PGHOST等) および プラグイン独自の設定が含まれます。通常、postgresユーザとして、データベースサーバ上でプラグインを直接実行した方が簡単です。In this case the minimum configuration will look like:
  
 
<pre>
 
<pre>

Revision as of 04:05, 15 July 2013

作成中です - mits

Mahara munin plugin.jpg

さまざまなMahara統計データを生成できるMuninプラグインはランカスター大学 (Lancaster University) CISの無償提供により、GitHubにてダウンロードすることができます。これは複数グラフのためのワイルドカードMuninプラグインであり、Maharaデータベースから有用な統計を取得して美しいグラフに表示します。生成されるグラフは以下のとおりです:

  • 現在のログインユーザ
  • グループ
  • ディスク使用量
  • ページ
  • ユーザ活動

プラグインはMahara 1.5またはそれ以上で使用することができます。現在のところ、PostgreSQLデータベースのみで動作します

事前要件 (Pre-requires)

あなたのシステムにおいて、Muninをインストールおよび設定する必要があります。これはディスカッションの範囲を超えているため、詳細情報に関して、Munin documentationをご覧ください。

設定

これを動作させるため、あなたはプラグインをインストール、プラグイン設定ファイルの作成およびプラグインへのシンボリックリンク (Moodleデータベース名を反映させるため) を作成する必要があります。

プラグインのインストール

あなたはgitを使用してコピーするか、GitHubからプラグインをダウンロードすることができます。あなたがプラグインをダウンロードした場合、解凍してMunin標準プラグインディレクトリ (例 /usr/share/munin/plugins/) に入れること、またカスタムプラグインを分離したい場合はカスタムディレクトリに入れることができます。

mv /tmp/mahara_ /usr/share/munin/plugins/mahara_

プラグインの設定

あなたは「plugin-conf.d」ディレクトリ内に設定ファイルを作成する必要があります。通常、このディレクトリは「/etc/munin/」となります。設定ファイル名に関して、特定の要件はありませんが、利便性のため「mahara」にした方が良いでしょう。設定には、標準Muninプラグイン設定属性、データベース接続設定のlibpq環境変数 (例 PGUSER, PGHOST等) および プラグイン独自の設定が含まれます。通常、postgresユーザとして、データベースサーバ上でプラグインを直接実行した方が簡単です。In this case the minimum configuration will look like:

[mahara_*]
user postgres

If your plugin located on the different server, it will need an additional settings to accessing Mahara database. Given that plugin is using Munin::Plugin::Pgsql library, it supports all libpq variables, the most common of them are:

  • PGHOST - hostname to connect to
  • PGPORT - port number to connect to
  • PGUSER - username to connect as
  • PGPASSWORD - password to connect with, if a password is required

For using these variables in the plugin configuration, you need to pass them as environment setting, i.e. prepend them with env.

[mahara_*]
user root
env.PGHOST your_db_hostname
env.PGUSER your_db_username
env.PGPASSWORD your_db_password

Plugin also has some own configuration variables that need to be set as environment setting as well if you wish using them:

  • env.updatetime - you may configure the period for which the time-based data is calculated (e.g. used in the number of logged-in users reporting or assignments submissions). By default the value of 300 sec is used (which is 5 min Munin default update interval).
  • env.dbprefix - if you use prefix in Mahara database tables, pass the correct one using this parameter.
  • env.showdefaultpages - whether to show default/system pages on the graph (user dashboard, user profile, group home page). Can be enabled by setting this variable to 1. Disabled by default.

For more information on Munin plugins configuration see corresponding Munin wiki page.

シンボリックリンク (symlink) を作成する

The final bit that needs to be done is to create a symlink to the plugin in /etc/munin/plugins directory. Being a wildcard plugin, Mahara plugin will attempt to determine the database name it will be using from the symlink, thus the symlink need to contain the name of the Mahara database:

ln -s /usr/share/munin/plugins/mahara_ /etc/munin/plugins/mahara_yourmaharadatabasename

ls -la command run in /usr/share/munin/plugins directory will display that the symlink is correct:

lrwxrwxrwx 1 root root 52 Nov 21 16:29 mahara_mahara-db -> /usr/share/munin/plugins/mahara_

The database name in the example above is mahara-db

The wildcard plugin concept is especially useful for large scale systems when you have more than one Mahara database on the same database server. I this case you may create symlink for each Mahara database on the same system and have them all monitored.

設定およびプラグインのテスト

You will need to restart munin node on the client to make sure it picked up new plugins. Now, you may see what the plugin outputs when it is being queried by Munin service:

~# munin-run mahara_mahara-db

will output the current data values for each graph

multigraph maharausers
users.value 1

multigraph maharapages
groupportfolio.value 42
instportfolio.value 1
userportfolio.value 531
...

to see the graphs configuration that plugin returns run

~# munin-run mahara_mahara-db config

You may read more about plugin debugging in Munin wiki document.

役立つヒント

You may set up warning and critical thresholds for particular services on the Munin server side. When one of the values will be above defined limits, the service will be highlighted in the Munin web interface. You may elaborate this further and set up various alerts. For more info see page.

開発者メモ

This Munin Mahara plugin is using Munin::Plugin::Pgsql library, which makes it work with PostgreSQL database only at the moment. It is also a multigraph plugin which allows to keep all the graphs generation code within the same file. The wildcard plugin functionality is implemented the way that it takes database name from the symlink.

You are more than welcome to contribute to this work and create pull request for integration of your changes.

有用なリンク