質問
Contrast Webインターフェース (Contrast UI) でサーバ名がlocalhostとなるのはなぜですか?
回答
Contrastエージェントは、オペレーティングシステムのコマンドを用いてエージェントがインストールされているマシンのホスト名を取得し、それをContrast Webインターフェース上のサーバ名として用います。しかしながらそのような方法でホスト名を取得できない場合には、localhostをサーバ名とします。
また、Contrastエージェントが取得したサーバ名を、別の名前にカスタマイズすることができます。サーバ名は、以下の方法でカスタマイズできます。
contrast_security.yaml ファイルを使用している場合:
server:
name: foo
環境変数を使用している場合:
CONTRAST__SERVER__NAME=foo
JVM引数を使用している場合:
-Dcontrast.server.name=foo
.NETエージェントにおいてweb.configファイルを使用している場合:
<configuration> <appSettings> <add key="contrast.server.name" value="foo" /> </appSettings> <system.web> ...
サーバ名に加えて、以下のオプションによってサーバのメタデータを設定可能:
# ==============================================================================
# server
# Use the settings in this section to set metadata for the server
# hosting this agent. Contrast recognizes common, supported server
# names, paths, types and environments. Doing this may require a new
# server or license, and it may affect functionality of some features.
# ==============================================================================
# server:
# Override the reported server name.
# name: localhost
# Override the reported server path.
# path: NEEDS_TO_BE_SET
# Override the reported server type.
# type: NEEDS_TO_BE_SET
# Set the environment directly to override the default set
# by the Contrast UI. This allows the user to configure the
# environment dynamically at startup rather than manually
# updating the Server in the Contrast UI themselves afterwards.
#
# Valid values include `QA`, `PRODUCTION` and `DEVELOPMENT`.
# For example, `PRODUCTION` registers this Server as
# running in a `PRODUCTION` environment, regardless of the
# organization's default environment in the Contrast UI.
#
# environment: NEEDS_TO_BE_SET
# Apply a list of labels to the server. Labels
# must be formatted as a comma-delimited list.
# Example - `label1,label2,label3`
#
# tags: NEEDS_TO_BE_SET
他のYAML設定オプションはこちらで閲覧できます: JavaのYAML設定ファイルのテンプレート。
それぞれのエージェント言語のサンプルテンプレートはこちらのContrastのドキュメントサイトにございます。