テンプレートのテストと監視
テストおよびモニタータイプのテンプレートは、Paragon Active Assuranceフロントエンドユーザーインターフェイスから手動で設定する必要があります。これを行う方法については、アプリ内ヘルプの「テストとモニター」>「テンプレートの作成」で説明されています。
テストおよびモニターテンプレートのエクスポート
以下のコードは、モニターテンプレートをJSON形式でエクスポートする方法を示しています。テストのエクスポートも同様です(の定義urlで に置き換えるtest_templatesだけですmonitor_templates)。
# Request settings
url = '%s/accounts/%s/monitor_templates/export/' % (args.ncc_url, args.account)
# Export templates
print url
response = requests.get(url=url, headers={'API-Token': args.token})
以前にエクスポートされたモニターテンプレートは、次のようにコントロールセンターにインポートして戻すことができます(ここでも、テストテンプレートは同様に処理されます)。
# Request settings
url = '%s/accounts/%s/monitor_templates/import/' % (args.ncc_url, args.account)
json_data = json.dumps({
"templates": [
{
"input": [
{
"require_bridge": False,
残りの JSON 文字列をここに挿入します。
"description": "Monitor for HTTP",
"name": "mtpl-2"
}
],
"version": "2.29",
"export_date": "2019-05-16T10:03:37.042474Z"
})
# Import monitor templates
response = requests.post(url=url, data=json_data, headers={
'API-Token': args.token,
'Accept': 'application/json; indent=4',
'Content-Type': 'application/json',
})