JMX モニタリングの設定
JMX モニタリングを有効にしてみましょう。手順は英語ですが、
https://www.opends.org/wiki/page/AccessingOpenDSMonitoringInformationThroughJconsole
に書かれています。dsconfig コマンドを使って設定していますが、ここでは試しに dsconfig コマンドの
Interactive Mode を使って設定してみます。長い文字列を打ち込まなくて済むので、私のようにタイプミス
が多い人には楽かもしれません。ドキュメントなどにはコマンドラインからオプションを指定して設定してしまう方法で書かれていると思います。実際のところ今回 Interactive Mode でこの blog エントリーを書いてみたのですが、ものすごく冗長になってしまいました。これは dsconfig に Interactive Mode があるという紹介も兼ねてますので今回はこのまま出します。
実際の操作で、コマンドラインから値をすべて指定してしまうのか、Interactive Mode を使うのは好みの問題ですので、使いやすいと思った方で設定してください。
まず、interactive mode でサーバーに接続します。ここでは前回インストールしたサーバーのうち2つ目
を選択しています。
% ./dsconfig -h localhost -p 2389 -D "cn=directory manager" -w password
次に LDAP を選択します。
>>>> Specify OpenDS LDAP connection parameters
How do you want to connect?
1) LDAP
2) LDAP with SSL
3) LDAP with StartTLS
Enter choice [1]: 1 <-- 1 を選択
dsconfig で行える操作一覧が出てきます。まずは、Connection Handler を選択します。
>>>> OpenDS configuration console main menu
What do you want to configure?
1) Access Control Handler 20) Log Rotation Policy
2) Account Status Notification Handler 21) Matching Rule
3) Alert Handler 22) Monitor Provider
4) Attribute Syntax 23) Password Generator
5) Backend 24) Password Policy
6) Certificate Mapper 25) Password Storage Scheme
7) Connection Handler 26) Password Validator
8) Crypto Manager 27) Plugin
9) Debug Target 28) Plugin Root
10) Entry Cache 29) Replication Domain
11) Extended Operation Handler 30) Replication Server
12) Global Configuration 31) Root DN
13) Group Implementation 32) Root DSE Backend
14) Identity Mapper 33) SASL Mechanism Handler
15) Key Manager Provider 34) Synchronization Provider
16) Local DB Index 35) Trust Manager Provider
17) Local DB VLV Index 36) Virtual Attribute
18) Log Publisher 37) Work Queue
19) Log Retention Policy
q) quit
Enter choice: 7 <-- 7 を選択します
次に Connection Handler の作成をします。私は 4 で一度 JMX Connection Handler を
消してから再作成すているため 2 を選択していますが、既にある場合は(インストール直後は
あります)3 の編集を選択してください。
>>>> Connection Handler management menu
What would you like to do?
1) List existing Connection Handlers
2) Create a new Connection Handler
3) View and edit an existing Connection Handler
4) Delete an existing Connection Handler
b) back
q) quit
Enter choice [b]: 2 <-- 2 を選択(あるいは 3 を選択してください)
JMX Connection Handler を選択します。
>>>> Select the type of Connection Handler that you want to create:
1) JMX Connection Handler
2) LDAP Connection Handler
3) LDIF Connection Handler
?) help
c) cancel
q) quit
Enter choice [c]: 1 <-- 1 を選択
まず、JMX Connection Handler を有効にします。
>>>> Enter a name for the JMX Connection Handler that you want to create: JMX Connection Handler
>>>> Configuring the "enabled" property
Indicates whether the Connection Handler is enabled.
Select a value for the "enabled" property:
1) true
2) false
?) help
c) cancel
q) quit
Enter choice [c]: 1 <-- 1 を選択
次にポートを設定します。Multi-Master Replication 構成で同じホストにインストール
した場合、両方とも同じポートを設定しているはずです。この場合重ならないように別々の
ポートを選択してください。規定値は 1689 になっている場合が多いと思いますが、ここでは 1000 足して 2689 にしています。
>>>> Configuring the "listen-port" property
Specifies the port number on which the JMX Connection Handler will listen
for connections from clients.
Only a single port number may be provided.
Syntax: 1 <= INTEGER <= 65535
Enter a value for the "listen-port" property: 2689 <-- 2689 を選択
今回は SSL 等は設定してませんので、他の項目は変更しません。
>>>> Configure the properties of the JMX Connection Handler
Property Value(s)
-----------------------------------------------------------------------
1) allowed-client All clients with addresses that do not match an
address on the deny list are allowed. If there is
no deny list, then all clients are allowed.
2) denied-client If an allow list is specified, then only clients
with addresses on the allow list are allowed.
Otherwise, all clients are allowed.
3) enabled true
4) key-manager-provider -
5) listen-port 2689
6) ssl-cert-nickname Let the server decide.
7) use-ssl false
?) help
f) finish - apply any changes to the JMX Connection Handler
c) cancel
q) quit
Enter choice [f]: f <-- 変更を適用する
The JMX Connection Handler was created successfully
Press RETURN to continue
>>>> Connection Handler management menu
What would you like to do?
1) List existing Connection Handlers
2) Create a new Connection Handler
3) View and edit an existing Connection Handler
4) Delete an existing Connection Handler
b) back
q) quit
Enter choice [b]:
>>>> OpenDS configuration console main menu
What do you want to configure?
1) Access Control Handler 20) Log Rotation Policy
2) Account Status Notification Handler 21) Matching Rule
3) Alert Handler 22) Monitor Provider
4) Attribute Syntax 23) Password Generator
5) Backend 24) Password Policy
6) Certificate Mapper 25) Password Storage Scheme
7) Connection Handler 26) Password Validator
8) Crypto Manager 27) Plugin
9) Debug Target 28) Plugin Root
10) Entry Cache 29) Replication Domain
11) Extended Operation Handler 30) Replication Server
12) Global Configuration 31) Root DN
13) Group Implementation 32) Root DSE Backend
14) Identity Mapper 33) SASL Mechanism Handler
15) Key Manager Provider 34) Synchronization Provider
16) Local DB Index 35) Trust Manager Provider
17) Local DB VLV Index 36) Virtual Attribute
18) Log Publisher 37) Work Queue
19) Log Retention Policy
q) quit
Enter choice: q
以上です。
次に、root DN に JMX read, write, notify privilege を与えます。
先ほどと同様、まずは接続です。
% ./dsconfig -h localhost -p 2389 -D "cn=directory manager" -w password
>>>> Specify OpenDS LDAP connection parameters
How do you want to connect?
1) LDAP
2) LDAP with SSL
3) LDAP with StartTLS
Enter choice [1]: 1
Root DN の変更なので、31 を選択します。
>>>> OpenDS configuration console main menu
What do you want to configure?
1) Access Control Handler 20) Log Rotation Policy
2) Account Status Notification Handler 21) Matching Rule
3) Alert Handler 22) Monitor Provider
4) Attribute Syntax 23) Password Generator
5) Backend 24) Password Policy
6) Certificate Mapper 25) Password Storage Scheme
7) Connection Handler 26) Password Validator
8) Crypto Manager 27) Plugin
9) Debug Target 28) Plugin Root
10) Entry Cache 29) Replication Domain
11) Extended Operation Handler 30) Replication Server
12) Global Configuration 31) Root DN
13) Group Implementation 32) Root DSE Backend
14) Identity Mapper 33) SASL Mechanism Handler
15) Key Manager Provider 34) Synchronization Provider
16) Local DB Index 35) Trust Manager Provider
17) Local DB VLV Index 36) Virtual Attribute
18) Log Publisher 37) Work Queue
19) Log Retention Policy
q) quit
Enter choice: 31 <-- 31 を選択
変更を加えるため、1を選択します。
>>>> Root DN management menu
What would you like to do?
1) View and edit the Root DN
b) back
q) quit
Enter choice [b]: 1 <-- 1 を選択
1 の default-root-privilege-name を変更するので 1 を選択します。
>>>> Configure the properties of the Root DN
Property Value(s)
-----------------------------------------------------------------------
1) default-root-privilege-name backend-backup, backend-restore,
bypass-acl, cancel-request, config-read,
config-write, disconnect-client,
ldif-export, ldif-import, modify-acl,
password-reset, privilege-change,
server-restart, server-shutdown,
unindexed-search, update-schema
?) help
f) finish - apply any changes to the Root DN
c) cancel
q) quit
Enter choice [f]: 1 <-- 1 を選択
read, write, notify privilege を追加するため、2 を選択します。
>>>> Configuring the "default-root-privilege-name" property
Specifies the names of the privileges that root users will be granted by
default.
The "default-root-privilege-name" property has the following values:
*) backend-backup *) ldif-import
*) backend-restore *) modify-acl
*) bypass-acl *) password-reset
*) cancel-request *) privilege-change
*) config-read *) server-restart
*) config-write *) server-shutdown
*) disconnect-client *) unindexed-search
*) ldif-export *) update-schema
Do you want to modify the "default-root-privilege-name" property?
1) Keep these default values
2) Add one or more values
3) Remove one or more values
4) Remove all values
?) help
q) quit
Enter choice [1]: 2 <-- 2 を選択
jmx-read, jmx-write, jmx-notify を選択します。
Select the values you wish to add:
1) data-sync
2) jmx-notify
3) jmx-read
4) jmx-write
5) proxied-auth
6) Add all values
?) help
c) cancel
q) quit
Enter one or more choices separated by commas [c]: 2,3,4 <-- 2, 3, 4 を選択
Press RETURN to continue
変更後の情報が出力されるので、この値を使うよう指定します。
>>>> Configuring the "default-root-privilege-name" property (Continued)
The "default-root-privilege-name" property has the following values:
*) backend-backup *) ldif-export
*) backend-restore *) ldif-import
*) bypass-acl *) modify-acl
*) cancel-request *) password-reset
*) config-read *) privilege-change
*) config-write *) server-restart
*) disconnect-client *) server-shutdown
*) jmx-notify *) unindexed-search
*) jmx-read *) update-schema
*) jmx-write
Do you want to modify the "default-root-privilege-name" property?
1) Use these values
2) Add one or more values
3) Remove one or more values
4) Remove all values
5) Reset to the default values: backend-backup, backend-restore,
bypass-acl, cancel-request, config-read, config-write,
disconnect-client, ldif-export, ldif-import, modify-acl,
password-reset, privilege-change, server-restart, server-shutdown,
unindexed-search, update-schema
6) Revert changes
?) help
q) quit
Enter choice [1]: 1 <-- 1 を選択
Press RETURN to continue
変更を適用します。
>>>> Configure the properties of the Root DN
Property Value(s)
-----------------------------------------------------------------------
1) default-root-privilege-name backend-backup, backend-restore,
bypass-acl, cancel-request, config-read,
config-write, disconnect-client,
jmx-notify, jmx-read, jmx-write,
ldif-export, ldif-import, modify-acl,
password-reset, privilege-change,
server-restart, server-shutdown,
unindexed-search, update-schema
?) help
f) finish - apply any changes to the Root DN
c) cancel
q) quit
Enter choice [f]: f <-- f を選択
The Root DN was modified successfully
Press RETURN to continue
以上です。Status Panel から OpenDS を一度停止し、再度起動してください。
jconsole の起動
次は jconsole を起動して、接続します。jconsole は JAVA_HOME/bin にインストールされています。
J2SE 5.0 と Java 6 で多少 UI が異なりますが、やることは JMX URL の指定と、user 名、パスワード
の指定です。
- JMX URL: service:jmx:rmi:///jndi/rmi://localhost:2689/org.opends.server.protocols.jmx.client-unknown
- Username: cn=directory manager
- password: password
以上で、
https://www.opends.org/wiki/page/AccessingOpenDSMonitoringInformationThroughJconsole
に書かれているように jconsole からモニタリングができます。ぜひお試しください。