PEM command line interface#
PEM CLIを使用すると、アラートテンプレートまたはプローブをPEMサーバーから別のPEMサーバーにエクスポートおよびインポートできます。
edb.repo
リポジトリとは別にパッケージedb-pem-cli-8.5.0-1-<platform_name>
を使用してPEM
CLIをインストールできます。バイナリファイル/usr/edb/pem/cli/bin/pem
とライセンスファイル/usr/edb/pem/edb-pem-cli-license.txt
を作成します。
PEM CLIパッケージをインストールした後、 ./pem -h
コマンドを使用して、使用可能なすべてのオプションを表示します。
$ ./pem -h
__OUTPUT__
PEM CLI (Postgres Enterprise Manager Command Line Interface)
Usage: ./pem [OPTIONS] [SUBCOMMAND]
Options:
-h,--help Print this help message and exit
-v,--version Show the app version and exit
Logging:
--log-file [/home/asheshvashi/.pem-cli.log]
Set the log file
NOTE: Directory must exist
-l,--log-level :value in {FATAL->1,ERROR->2,WARNING->3,DEBUG->5,INFO->4,VERBOSE->6} OR {1,2,3,5,4,6} [INFO]
Set the log level
PEM Information:
-p,--pem-url REQUIRED (Env:PEM_SERVER_URL)
Set the URL for accessing Postgres Enterprise Manager
e.g.
https://127.0.0.1:8443/pem
https:://pem_host:8443/pem
-u,--pem-user REQUIRED (Env:PEM_API_USER)
User to access the PEM REST API
-f,--password-file (Env:PEM_PASSWORD_FILE)
Location of the file, which contains the password.
The permission on a password file must disallow any access to world or group.
NOTE:
- The first non-empty line in the file will be treated as a
password.
- Environment variable PEM_API_PASSWORD can be used for
providing the password instead of the password file
-i,--insecure Set the insecure connection
Subcommands:
import-alert-templates Import the alert template(s) into the PEM server.
list-alert-templates List the alert templates in the PEM server.
export-alert-templates Export the custom (user-defined) alert templates from the PEM server.
import-probes Import the probe(s) into the PEM server.
export-probes Export the custom (user-defined) probes from the PEM server.
list-probes List the probes in the PEM server.
import-alert-templates
サブコマンドで使用可能なすべてのオプションを表示できます。
$ ./pem import-alert-templates -h
__OUTPUT__
Import the alert template(s) into the PEM server.
Usage: ./pem import-alert-templates [OPTIONS]
Options:
-h,--help Print this help message and exit
-i,--in-file Alert template file
--ignore-existing Ignore the existing alert template in the PEM server
--ignore-existing-probes Ignore the existing probes in the PEM server
list-alert-templates
サブコマンドで使用可能なすべてのオプションを表示できます。
$ ./pem list-alert-templates -h
__OUTPUT__
List the alert templates in the PEM server.
Usage: ./pem list-alert-templates [OPTIONS]
Options:
-h,--help Print this help message and exit
-c,--alert-template-category :value in {ALL->2,CUSTOM->1,SYSTEM->0} OR {2,1,0} [CUSTOM]
List down the alert templates of this category
export-alert-templates
サブコマンドで使用可能なすべてのオプションを表示できます。
$ ./pem export-alert-templates -h
__OUTPUT__
Export the custom (user-defined) alert templates from the PEM server
Usage: ./pem export-alert-templates [OPTIONS]
Options:
-h,--help Print this help message and exit
-i,--id INT ... List of id for the custom alert templates to be exported
-o,--out-file [Standard output (console)]
Output file name
-w,--overwrite Overwrite the existing output file
import-probes
サブコマンドで使用可能なすべてのオプションを表示できます。
$ ./pem import-probes -h
__OUTPUT__
Import the probe(s) into the PEM server.
Usage: ./pem import-probes [OPTIONS]
Options:
-h,--help Print this help message and exit
-i,--in-file Probes file
--ignore-existing Ignore the existing custom probes in the PEM server
export-probes
サブコマンドで使用可能なすべてのオプションを表示できます。
$ ./pem export-probes -h
__OUTPUT__
Export the custom (user-defined) probes from the PEM server
Usage: ./pem export-probes [OPTIONS]
Options:
-h,--help Print this help message and exit
-i,--probe-id INT ... List of the custom probe-ids to be exported
-o,--out-file [Standard output (console)]
Output file name
-w,--overwrite Overwrite the existing output file
list-probes
サブコマンドで使用可能なすべてのオプションを表示できます。
$ ./pem list-probes -h
__OUTPUT__
List the probes in the PEM server.
Usage: ./pem list-probes [OPTIONS]
Options:
-h,--help Print this help message and exit
-c,--probe-category :value in {ALL->2,CUSTOM->1,SYSTEM->0} OR {2,1,0} [CUSTOM]
List down the probes of this category
例#
すべてのプローブシステムおよびカスタムプローブをリストするには、
-c all オプションを使用します。
$ PEM_PASSWORD_FILE=/tmp/pass PEM_API_USER=postgres PEM_SERVER_URL=https://172.17.0.4/pem ./pem -i list-probes -c all
そこで
PEM_PASSWORD_FILE=/tmp/passは、postgresユーザーのパスワードを含むパスワードファイルです。PEM_API_USER=postgresは、PEM CLIを実行しているユーザー名です。PEM_SERVER_URL=https://172.17.0.4/pemは、プローブを含むPEMサーバーのURLです。-i list-probesは、list-probesサブコマンドを使用したinsecureオプションであり、安全でない接続を許可し、プローブをリストします。-c allは、すべてのシステムとカスタムプローブをリストするためのall値を備えた-cオプションです。