M/Monit を Mac に入れてみる
前回、monit を入れましたが、今回は M/Monit。
monit の管理者みたいなものです。
30日間は無料で使えますが、それ以降は有料となりますので注意。
金額は 129 ユーロから。詳しくは この辺。
以下、インストールメモ。
使用 DB は MySQL としますが、MySQL 自体のインストールは割愛。
基本インストール
本家ページの Setup にもありますが、以下
1. First, check that M/Monit is supported on your OS platform
2. Get the latest release from http://mmonit.com/download/
3. Download and unpack the tar.gz file in a directory, any directory will do,
but unpacking in /opt or /usr/local are good choices.
4. Go to the unpacked mmonit-directory
5. Run M/Monit using: ./bin/mmonit
6. Point your Browser to the host where monit is installed (or "localhost"
if running on the same machine), for example: http://localhost:8080/
and login as user "admin" with password "swordfish".
適当に訳すと‥
- まず、こちら でサポートしている OS を確認
- 最新を こちら から取得
- ダウンロードした tar.gz ファイルを適当なフォルダで解凍 ( /opt か /usr/local を推奨)
- 解凍した mmonit-
フォルダへ移動 - ./bin/mmonit で M/Monit を実行
- monit が動いているホスト または 同一 PC 上なら localhost を表示して、例えば http://localhost:8080/ に ユーザ名: admin 、パスワード: swordfish でログイン
ここまでが最初のステップ。
DB 作成
続いてDB 作成。
$ sudo mysqladmin create mmonit
作成確認
$ sudo mysql --user=root
mysql>show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mmonit | | mysql | | test | +--------------------+ 4 rows in set (0.00 sec)
ユーザ作成
M/Monit が使用するユーザを作成します。
$ sudo mysql --user=root
mysql> GRANT ALL ON mmonit.* to mmonit@localhost identified by 'monitor';
確認
mysql> SELECT host,user FROM mysql.user; +-----------+--------+ | host | user | +-----------+--------+ | 127.0.0.1 | root | | localhost | | | localhost | mmonit | | localhost | root | +-----------+--------+ 4 rows in set (0.00 sec)
スキーマ作成
$ mysql -u mmonit mmonit -p < ./mmonit/db/mmonit-schema.mysql Enter password: <monitor>
M/Monit の設定修正
DB 設定を MySQL にします
mmonit/conf/server.xml 内の以下をコメントアウト解除
<Realm url="mysql://mmonit:mmonit@127.0.0.1:3306/mmonit" minConnections="5" maxConnections="30" reapConnections="300" />
再起動
$ ./bin/mmonit