3.4. 管理 CLI の操作
3.4.1. 管理 CLI によるリソースの属性の表示
前提条件
概要
read-attribute
オペレーションは、選択された属性の現在のランタイム値を読み取りするために使用されるグローバルオペレーションです。デフォルトの値や非定義の値を無視し、ユーザーによって設定された値のみを表示することが可能です。要求プロパティーには次のパラメーターが含まれます。
要求プロパティー
name
- 選択されたリソース下で値を取得する属性の名前。
include-defaults
false
を設定すると、デフォルト値を無視し、ユーザーによって設定された属性のみを表示するようオペレーション結果を制限できるブール変数パラメーター。
手順3.14 タスク
read-attribute
オペレーションの実行管理 CLI よりread-attribute
を使用してリソース属性の値を表示します。オペレーション要求の詳細は 「管理 CLI での操作とコマンドの使用」 を参照してください。[standalone@localhost:9999 /]
:read-attribute(name=name-of-attribute)
read-attribute
オペレーションの利点は、特定属性の現在のランタイム値を表示できることです。read-resource
オペレーションでも同様の結果を得ることができますが、include-runtime
要求プロパティーを追加した場合のみ可能で、そのノードに対して使用できる全リソース一覧の一部のみを表示することができます。次の例が示すように、read-attribute
オペレーションは細粒度の属性クエリを対象としています。
例3.5 read-attribute
オペレーションを実行してパブリックインターフェース IP を表示する
公開したい属性の名前を知っている場合は、
read-attribute
を使用して現在のランタイムの厳密値を返します。
[standalone@localhost:9999 /] /interface=public:read-attribute(name=resolved-address) { "outcome" => "success", "result" => "127.0.0.1" }
resolved-address
属性はランタイム値であるため、標準的な read-resource
オペレーションの結果には表示されません。
[standalone@localhost:9999 /] /interface=public:read-resource { "outcome" => "success", "result" => { "any" => undefined, "any-address" => undefined, "any-ipv4-address" => undefined, "any-ipv6-address" => undefined, "inet-address" => expression "${jboss.bind.address:127.0.0.1}", "link-local-address" => undefined, "loopback" => undefined, "loopback-address" => undefined, "multicast" => undefined, "name" => "public", "nic" => undefined, "nic-match" => undefined, "not" => undefined, "point-to-point" => undefined, "public-address" => undefined, "site-local-address" => undefined, "subnet-match" => undefined, "up" => undefined, "virtual" => undefined } }
resolved-address
や他のランタイム値を表示するには、include-runtime
要求プロパティーを使用する必要があります。
[standalone@localhost:9999 /] /interface=public:read-resource(include-runtime=true) { "outcome" => "success", "result" => { "any" => undefined, "any-address" => undefined, "any-ipv4-address" => undefined, "any-ipv6-address" => undefined, "inet-address" => expression "${jboss.bind.address:127.0.0.1}", "link-local-address" => undefined, "loopback" => undefined, "loopback-address" => undefined, "multicast" => undefined, "name" => "public", "nic" => undefined, "nic-match" => undefined, "not" => undefined, "point-to-point" => undefined, "public-address" => undefined, "resolved-address" => "127.0.0.1", "site-local-address" => undefined, "subnet-match" => undefined, "up" => undefined, "virtual" => undefined } }
結果
現在のランタイム属性値が表示されます。