Skip to content

Commit 9b200d4

Browse files
committed
feat: add alertingtemplate commands
1 parent 4c2d9a4 commit 9b200d4

File tree

5 files changed

+183
-1
lines changed

5 files changed

+183
-1
lines changed

USAGE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ List, Reset, Disable AppDynamics Agents
8787
| toggleMachineAgent | Enable or Disable an machine agent by id Provide an agent id (-i) and the enabled (-m) flag (true/false) as parameter. | `act.sh agents toggleMachineAgent -i 15 -m false` |
8888

8989

90+
## alertingtemplate
91+
92+
These commands allow you to list, import and export action templates.
93+
94+
| Command | Description | Example |
95+
| ------- | ----------- | ------- |
96+
| delete | Delete an alerting template Provide the id of the alerting template (-a) as parameter. | `act.sh alertingtemplate delete -i 68` |
97+
| export | Export an alerting template Provide the id of the alerting template (-a) as parameter. | `act.sh alertingtemplate export -i 68` |
98+
| import | Import an alerting template Provide a json string or a file (with @ as prefix) as parameter (-d). | `act.sh alertingtemplate import -d examples/alertingTemplate.json` |
99+
| list | List all alerting templates This command requires no further arguments. | `act.sh alertingtemplate list ` |
100+
101+
90102
## analyticsmetric
91103

92104
Manage custom analytics metrics

act.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
ACT_VERSION="v21.4.0"
3-
ACT_LAST_COMMIT="bf2f495b83d0b30ca3c27ac97fd27189698e2ca0"
3+
ACT_LAST_COMMIT="4c2d9a48c1272ccab4fc3b39e3a7d11027e146dc"
44
USER_CONFIG="$HOME/.appdynamics/act/config.sh"
55
GLOBAL_CONFIG="/etc/appdynamics/act/config.sh"
66
CONFIG_CONTROLLER_COOKIE_LOCATION="/tmp/appdynamics-controller-cookie.txt"
@@ -107,6 +107,17 @@ agents_list() { apiCall -X POST -d '{"requestFilter":{"queryParams":{"applicatio
107107
rde agents_list "List all agents of a specific type" "Provide a type as parameter (-t). Possible types are appserver, machine, cluster." ""
108108
agents_toggleMachineAgent() { apiCall -X POST -d '[{{i:id}}]' '/controller/restui/agent/setting/toggleMachineAgentEnable?enabledFlag={{m:enabledFlag}}&entityType=MACHINE_INSTANCE' "$@" ; }
109109
rde agents_toggleMachineAgent "Enable or Disable an machine agent by id" "Provide an agent id (-i) and the enabled (-m) flag (true/false) as parameter." "-i 15 -m false"
110+
doc alertingtemplate << EOF
111+
These commands allow you to list, import and export action templates.
112+
EOF
113+
alertingtemplate_delete() { apiCall -X DELETE '/controller/alerting/rest/v1/templates/{{a:alerting_template_id}}' "$@" ; }
114+
rde alertingtemplate_delete "Delete an alerting template" "Provide the id of the alerting template (-a) as parameter." "-i 68"
115+
alertingtemplate_export() { apiCall -X POST '/controller/alerting/rest/v1/templates/{{a:alerting_template_id}}/export' "$@" ; }
116+
rde alertingtemplate_export "Export an alerting template" "Provide the id of the alerting template (-a) as parameter." "-i 68"
117+
alertingtemplate_import() { apiCall -X POST -d '{{d:alerting_template}}' '/controller/alerting/rest/v1/templates/import' "$@" ; }
118+
rde alertingtemplate_import "Import an alerting template" "Provide a json string or a file (with @ as prefix) as parameter (-d)." "-d examples/alertingTemplate.json"
119+
alertingtemplate_list() { apiCall '/controller/alerting/rest/v1/templates/details' "$@" ; }
120+
rde alertingtemplate_list "List all alerting templates" "This command requires no further arguments." ""
110121
doc analyticsmetric << EOF
111122
Manage custom analytics metrics
112123
EOF

commands.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,34 @@ actiontemplate:
134134
example:
135135
method: GET
136136
endpoint: /controller/restui/httpaction/getHttpRequestActionPlanList
137+
alertingtemplate:
138+
title: Alerting Templates
139+
description: These commands allow you to list, import and export action templates.
140+
list:
141+
title: List all alerting templates
142+
description: This command requires no further arguments.
143+
example:
144+
method: GET
145+
endpoint: /controller/alerting/rest/v1/templates/details
146+
import:
147+
title: Import an alerting template
148+
description: Provide a json string or a file (with @ as prefix) as parameter (-d).
149+
example: -d examples/alertingTemplate.json
150+
method: POST
151+
endpoint: /controller/alerting/rest/v1/templates/import
152+
payload: {{d:alerting_template}}
153+
export:
154+
title: Export an alerting template
155+
description: Provide the id of the alerting template (-a) as parameter.
156+
example: -i 68
157+
method: POST
158+
endpoint: /controller/alerting/rest/v1/templates/{{a:alerting_template_id}}/export
159+
delete:
160+
title: Delete an alerting template
161+
description: Provide the id of the alerting template (-a) as parameter.
162+
example: -i 68
163+
method: DELETE
164+
endpoint: /controller/alerting/rest/v1/templates/{{a:alerting_template_id}}
137165
adql:
138166
title: Run ADQL Queries
139167
description: These commands allow you to run ADQL queries agains the controller (not the event service!)

examples/alerting_template.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"healthRuleTemplateMemberConfig": {
3+
"matchType": "ALL",
4+
"ids": [
5+
0
6+
]
7+
},
8+
"applicationId": 7948,
9+
"description": "Example Alerting Template",
10+
"name": "Example"
11+
}

postman-collection.json

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,126 @@
448448
},
449449
"description": "Provide an agent id (-i) and the enabled (-m) flag (true/false) as parameter."
450450
}
451+
}]},{"name": "alertingtemplate","item": [{
452+
"name": "Delete an alerting template",
453+
"request": {
454+
"method": "DELETE",
455+
"header": [
456+
{
457+
"key": "Content-Type",
458+
"value": "application/json;charset=UTF-8",
459+
"type": "text"
460+
},
461+
{
462+
"key": "X-CSRF-TOKEN",
463+
"value": "{{X-CSRF-TOKEN}}",
464+
"type": "text"
465+
}
466+
],
467+
"body": {
468+
"mode": "raw",
469+
"raw": ""
470+
},
471+
"url": {
472+
"raw": "{{controller_host}}/controller/alerting/rest/v1/templates/{{a:alerting_template_id}}",
473+
"host": [
474+
"{{controller_host}}"
475+
],
476+
"path": ["controller","alerting","rest","v1","templates","{{alerting_template_id}}"],
477+
"query": []
478+
},
479+
"description": "Provide the id of the alerting template (-a) as parameter."
480+
}
481+
},{
482+
"name": "Export an alerting template",
483+
"request": {
484+
"method": "POST",
485+
"header": [
486+
{
487+
"key": "Content-Type",
488+
"value": "application/json;charset=UTF-8",
489+
"type": "text"
490+
},
491+
{
492+
"key": "X-CSRF-TOKEN",
493+
"value": "{{X-CSRF-TOKEN}}",
494+
"type": "text"
495+
}
496+
],
497+
"body": {
498+
"mode": "raw",
499+
"raw": ""
500+
},
501+
"url": {
502+
"raw": "{{controller_host}}/controller/alerting/rest/v1/templates/{{a:alerting_template_id}}/export",
503+
"host": [
504+
"{{controller_host}}"
505+
],
506+
"path": ["controller","alerting","rest","v1","templates","{{alerting_template_id}}","export"],
507+
"query": []
508+
},
509+
"description": "Provide the id of the alerting template (-a) as parameter."
510+
}
511+
},{
512+
"name": "Import an alerting template",
513+
"request": {
514+
"method": "POST",
515+
"header": [
516+
{
517+
"key": "Content-Type",
518+
"value": "application/json;charset=UTF-8",
519+
"type": "text"
520+
},
521+
{
522+
"key": "X-CSRF-TOKEN",
523+
"value": "{{X-CSRF-TOKEN}}",
524+
"type": "text"
525+
}
526+
],
527+
"body": {
528+
"mode": "raw",
529+
"raw": "{{alerting_template}}"
530+
},
531+
"url": {
532+
"raw": "{{controller_host}}/controller/alerting/rest/v1/templates/import",
533+
"host": [
534+
"{{controller_host}}"
535+
],
536+
"path": ["controller","alerting","rest","v1","templates","import"],
537+
"query": []
538+
},
539+
"description": "Provide a json string or a file (with @ as prefix) as parameter (-d)."
540+
}
541+
},{
542+
"name": "List all alerting templates",
543+
"request": {
544+
"method": "GET",
545+
"header": [
546+
{
547+
"key": "Content-Type",
548+
"value": "application/json;charset=UTF-8",
549+
"type": "text"
550+
},
551+
{
552+
"key": "X-CSRF-TOKEN",
553+
"value": "{{X-CSRF-TOKEN}}",
554+
"type": "text"
555+
}
556+
],
557+
"body": {
558+
"mode": "raw",
559+
"raw": ""
560+
},
561+
"url": {
562+
"raw": "{{controller_host}}/controller/alerting/rest/v1/templates/details",
563+
"host": [
564+
"{{controller_host}}"
565+
],
566+
"path": ["controller","alerting","rest","v1","templates","details"],
567+
"query": []
568+
},
569+
"description": "This command requires no further arguments."
570+
}
451571
}]},{"name": "analyticsmetric","item": [{
452572
"name": "Create analytics metric",
453573
"request": {

0 commit comments

Comments
 (0)