Skip to content

Commit 9409b6c

Browse files
authored
Merge pull request #2 from michaelenglert/master
Name changes / More generic build.sh
2 parents 32bce10 + 5ee1585 commit 9409b6c

File tree

7 files changed

+80
-139
lines changed

7 files changed

+80
-139
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
# AppDynamics Commandline Tool (ADC)
1+
# API Commandline Tool
22

3-
The AppDynamics Commandline Tool (ADC) is a shell script wrapper around [API](https://docs.appdynamics.com/display/PRO43/AppDynamics+APIs#AppDynamicsAPIs-apiindex) calls towards an AppDynamics controller.
3+
The API Commandline Tool (ACT) is a shell script wrapper around [API](https://docs.appdynamics.com/display/latest/AppDynamics+APIs#AppDynamicsAPIs-apiindex) calls towards an AppDynamics controller.
44

55
## Installation
66

7-
To use the latest release of ADC just download the raw version of [adc.sh](https://github.com/Appdynamics/adc/blob/master/adc.sh)
7+
To use the latest release of ACT just download the raw version of [act.sh](https://github.com/Appdynamics/api-commandline-tool/blob/master/act.sh)
88

9-
Afterwards run `adc.sh config` to provide your controller host and credentials. This will create a configuration file at `~/.appdynamics/adc/config.sh`, e.g.:
9+
Afterwards run `act.sh config` to provide your controller host and credentials. This will create a configuration file at `~/.appdynamics/act/config.sh`, e.g.:
1010

1111
```bash
1212
CONFIG_CONTROLLER_HOST=https://appdynamics.example.com:8090
1313
CONFIG_CONTROLLER_CREDENTIALS=me@customer1:secure2
14-
CONFIG_CONTROLLER_COOKIE_LOCATION=/home/ubuntu/.appdynamics/adc/cookie.txt
14+
CONFIG_CONTROLLER_COOKIE_LOCATION=/home/ubuntu/.appdynamics/act/cookie.txt
1515
```
1616

1717
If you want to change your configuration, you can either edit this file or you can re-run the self setup:
1818

1919
```
20-
adc.sh config -f
20+
act.sh config -f
2121
```
2222

2323
## Usage
2424

25-
`adc.sh` integrates different commands to interact with your AppDynamics controller. Call `adc.sh help` to get a full list of commands.
25+
`act.sh` integrates different commands to interact with your AppDynamics controller. Call `act.sh help` to get a full list of commands.
2626

2727
A simple work flow example is listing, exporting and deleting a dashboard:
2828

2929
```
30-
adc.sh dashboard list
31-
adc.sh dashboard export 13
32-
adc.sh dashboard delete 13
30+
act.sh dashboard list
31+
act.sh dashboard export 13
32+
act.sh dashboard delete 13
3333
```
3434

35-
Another example is getting a notification while your on premise controller is starting up. Combine adc.sh with the notification tool of your choice ([noti](https://github.com/variadico/noti/), [terminal-notifier](https://github.com/julienXX/terminal-notifier), ...) or run commands after the controller is running:
35+
Another example is getting a notification while your on premise controller is starting up. Combine act.sh with the notification tool of your choice ([noti](https://github.com/variadico/noti/), [terminal-notifier](https://github.com/julienXX/terminal-notifier), ...) or run commands after the controller is running:
3636

3737
```
38-
noti adc.sh controller isup
39-
adc.sh controller isup | terminal-notifier
40-
adc.sh controller isup ; adc.sh applications list
38+
noti act.sh controller isup
39+
act.sh controller isup | terminal-notifier
40+
act.sh controller isup ; act.sh applications list
4141
```
4242

43-
Also, you can use `adc.sh` to easily create custom events, like code deployments:
43+
Also, you can use `act.sh` to easily create custom events, like code deployments:
4444

4545
```
46-
adc.sh event create -s INFO -c "This release fixes some minor issues with the mini cart functionality" -e APPLICATION_DEPLOYMENT -a 145 "Version 3.5.1 released"
46+
act.sh event create -s INFO -c "This release fixes some minor issues with the mini cart functionality" -e APPLICATION_DEPLOYMENT -a 145 "Version 3.5.1 released"
4747
```
4848

4949
If a certain API call is not yet wrapped into a command, you can use `controller call` as general interface:
5050

5151
```
52-
adc.sh controller call /controller/rest/applications?output=JSON
52+
act.sh controller call /controller/rest/applications?output=JSON
5353
```
5454

5555
## Plugins
5656

57-
If you want to use custom plugins with `adc.sh` you can place shell scripts into a plugin folder (default: `~/.appdynamics/adc/plugins`) and they will be sourced automatically. A command plugin requires the following structure:
57+
If you want to use custom plugins with `act.sh` you can place shell scripts into a plugin folder (default: `~/.appdynamics/act/plugins`) and they will be sourced automatically. A command plugin requires the following structure:
5858

5959
```
6060
#!/bin/bash
@@ -72,15 +72,15 @@ function tier_nodes {
7272
}
7373
```
7474

75-
The command `adc.sh tier nodes` will now take two arguments (via -a and -t) and send the given request to the AppDynamics controller.
75+
The command `act.sh tier nodes` will now take two arguments (via -a and -t) and send the given request to the AppDynamics controller.
7676

7777
Since all other sub commands are loaded, you can reuse them in your plugin. Most importantly `call_controller` to send requests to the controller.
7878

7979
Please note, that your plugins will not be validated, so you can change global behaviour or break the script.
8080

8181
## Build
8282

83-
To make working on `adc.sh` easier this git repository includes a very simple build system: The file `main.sh` is merged with all scripts in the sub directories, that are `source`d. So, if you want to build a custom version of `adc.sh` clone this directory, edit `main.sh` or any of the other files in this repository and run `build.sh` to update the script. Any changes you made directly to `adc.sh` will be overwritten.
83+
To make working on `act.sh` easier this git repository includes a very simple build system: The file `main.sh` is merged with all scripts in the sub directories, that are `source`d. So, if you want to build a custom version of `act.sh` clone this directory, edit `main.sh` or any of the other files in this repository and run `build.sh` to update the script. Any changes you made directly to `act.sh` will be overwritten.
8484

8585
## License
8686

adc.sh renamed to act.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
2-
ADC_VERSION="v0.3.0"
3-
ADC_LAST_COMMIT="3d87e045974500038f0d5dc50084d7872fd2c4bb"
4-
USER_CONFIG="$HOME/.appdynamics/adc/config.sh"
5-
GLOBAL_CONFIG="/etc/appdynamics/adc/config.sh"
2+
ACT_VERSION="v0.3.0"
3+
ACT_LAST_COMMIT="3d87e045974500038f0d5dc50084d7872fd2c4bb"
4+
USER_CONFIG="$HOME/.appdynamics/act/config.sh"
5+
GLOBAL_CONFIG="/etc/appdynamics/act/config.sh"
66
CONFIG_CONTROLLER_COOKIE_LOCATION="/tmp/appdynamics-controller-cookie.txt"
77
CONFIG_PORTAL_COOKIE_LOCATION="/tmp/appdynamics-portal-cookie.txt"
88
# Configure default output verbosity. May contain a combination of the following strings:
@@ -221,18 +221,18 @@ function _config {
221221
local CONTROLLER_CREDENTIALS=""
222222
local PORTAL_PASSWORD=""
223223
local PORTAL_USER=""
224-
local OUTPUT_DIRECTORY="${HOME}/.appdynamics/adc"
225-
local USER_PLUGIN_DIRECTORY="${HOME}/.appdynamics/adc/plugins"
224+
local OUTPUT_DIRECTORY="${HOME}/.appdynamics/act"
225+
local USER_PLUGIN_DIRECTORY="${HOME}/.appdynamics/act/plugins"
226226
local CONTROLLER_COOKIE_LOCATION="${OUTPUT_DIRECTORY}/cookie.txt"
227227
if [ $GLOBAL -eq 1 ] ; then
228-
OUTPUT_DIRECTORY="/etc/appdynamics/adc"
229-
CONTROLLER_COOKIE_LOCATION="/tmp/appdynamics-adc-cookie.txt"
228+
OUTPUT_DIRECTORY="/etc/appdynamics/act"
229+
CONTROLLER_COOKIE_LOCATION="/tmp/appdynamics-act-cookie.txt"
230230
fi
231231
if [ $SHOW -eq 1 ] ; then
232232
if [ -r $OUTPUT_DIRECTORY/config.sh ] ; then
233233
COMMAND_RESULT=$(<$OUTPUT_DIRECTORY/config.sh)
234234
else
235-
COMMAND_RESULT="adc is not configured."
235+
COMMAND_RESULT="act is not configured."
236236
fi
237237
else
238238
echo -n "Controller Host location (e.g. https://appdynamics.example.com:8090)"
@@ -276,9 +276,9 @@ function _config {
276276
fi
277277
fi
278278
}
279-
register _config Initialize the adc configuration file
279+
register _config Initialize the act configuration file
280280
describe _config << EOF
281-
Initialize the adc configuration file
281+
Initialize the act configuration file
282282
EOF
283283
function _help {
284284
if [ "$1" = "" ] ; then
@@ -320,7 +320,7 @@ function _help {
320320
}
321321
register _help Display the global usage information
322322
function _version {
323-
COMMAND_RESULT="$ADC_VERSION ~ $ADC_LAST_COMMIT"
323+
COMMAND_RESULT="$ACT_VERSION ~ $ACT_LAST_COMMIT"
324324
}
325325
register _version Print the current version of $SCRIPTNAME
326326
describe _version << EOF

build.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
LATEST_RELEASE=`git tag | tail -n 1`
33
LATEST_COMMIT=`git rev-parse HEAD`
4-
awk '
5-
$1 == "source" {system("tail -n +2 " $2); next}
6-
{print}
7-
' main.sh | sed '/^\s*$/d' \
8-
| sed "s/ADC_VERSION=\"vx.y.z\"/ADC_VERSION=\"$LATEST_RELEASE\"/" \
9-
| sed "s/ADC_LAST_COMMIT=\"xxxxxxxxxx\"/ADC_LAST_COMMIT=\"$LATEST_COMMIT\"/" > adc.sh
4+
find ./ -maxdepth 3 -mindepth 2 -iname "*.sh" -exec /bin/bash -c "tail -n +2 {}" \; >> temp.sh
5+
awk '/#script_placeholder/ {system("cat temp.sh")} {print}' main.sh \
6+
| sed '/^\s*$/d' \
7+
| sed "s/ACT_VERSION=\"vx.y.z\"/ACT_VERSION=\"$LATEST_RELEASE\"/" \
8+
| sed "s/ACT_LAST_COMMIT=\"xxxxxxxxxx\"/ACT_LAST_COMMIT=\"$LATEST_COMMIT\"/" > act.sh
9+
rm -rf temp.sh

commands/config.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ function _config {
2929
local CONTROLLER_CREDENTIALS=""
3030
local PORTAL_PASSWORD=""
3131
local PORTAL_USER=""
32-
local OUTPUT_DIRECTORY="${HOME}/.appdynamics/adc"
33-
local USER_PLUGIN_DIRECTORY="${HOME}/.appdynamics/adc/plugins"
32+
local OUTPUT_DIRECTORY="${HOME}/.appdynamics/act"
33+
local USER_PLUGIN_DIRECTORY="${HOME}/.appdynamics/act/plugins"
3434
local CONTROLLER_COOKIE_LOCATION="${OUTPUT_DIRECTORY}/cookie.txt"
3535

3636
if [ $GLOBAL -eq 1 ] ; then
37-
OUTPUT_DIRECTORY="/etc/appdynamics/adc"
38-
CONTROLLER_COOKIE_LOCATION="/tmp/appdynamics-adc-cookie.txt"
37+
OUTPUT_DIRECTORY="/etc/appdynamics/act"
38+
CONTROLLER_COOKIE_LOCATION="/tmp/appdynamics-act-cookie.txt"
3939
fi
4040

4141
if [ $SHOW -eq 1 ] ; then
4242
if [ -r $OUTPUT_DIRECTORY/config.sh ] ; then
4343
COMMAND_RESULT=$(<$OUTPUT_DIRECTORY/config.sh)
4444
else
45-
COMMAND_RESULT="adc is not configured."
45+
COMMAND_RESULT="act is not configured."
4646
fi
4747
else
4848

@@ -93,7 +93,7 @@ function _config {
9393
fi
9494
}
9595

96-
register _config Initialize the adc configuration file
96+
register _config Initialize the act configuration file
9797
describe _config << EOF
98-
Initialize the adc configuration file
98+
Initialize the act configuration file
9999
EOF

commands/version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
function _version {
4-
COMMAND_RESULT="$ADC_VERSION ~ $ADC_LAST_COMMIT"
4+
COMMAND_RESULT="$ACT_VERSION ~ $ACT_LAST_COMMIT"
55
}
66

77
register _version Print the current version of $SCRIPTNAME

main.sh

Lines changed: 5 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
2-
ADC_VERSION="vx.y.z"
3-
ADC_LAST_COMMIT="xxxxxxxxxx"
4-
USER_CONFIG="$HOME/.appdynamics/adc/config.sh"
5-
GLOBAL_CONFIG="/etc/appdynamics/adc/config.sh"
2+
ACT_VERSION="vx.y.z"
3+
ACT_LAST_COMMIT="xxxxxxxxxx"
4+
USER_CONFIG="$HOME/.appdynamics/act/config.sh"
5+
GLOBAL_CONFIG="/etc/appdynamics/act/config.sh"
66

77
CONFIG_CONTROLLER_COOKIE_LOCATION="/tmp/appdynamics-controller-cookie.txt"
88
CONFIG_PORTAL_COOKIE_LOCATION="/tmp/appdynamics-portal-cookie.txt"
@@ -44,66 +44,7 @@ function describe {
4444
GLOBAL_LONG_HELP_STRINGS[${#GLOBAL_LONG_HELP_STRINGS[@]}]=$(cat)
4545
}
4646

47-
source ./helpers/output.sh
48-
source ./helpers/httpClient.sh
49-
source ./helpers/shiftOptInd.sh
50-
source ./helpers/urlencode.sh
51-
source ./helpers/recursiveSource.sh
52-
source ./helpers/apiCall.sh
53-
54-
source ./commands/config.sh
55-
source ./commands/help.sh
56-
source ./commands/version.sh
57-
58-
source ./commands/controller/login.sh
59-
source ./commands/controller/call.sh
60-
source ./commands/controller/ping.sh
61-
source ./commands/controller/status.sh
62-
source ./commands/controller/version.sh
63-
source ./commands/controller/isup.sh
64-
65-
source ./commands/portal/login.sh
66-
source ./commands/portal/download.sh
67-
68-
source ./commands/application/list.sh
69-
source ./commands/application/create.sh
70-
source ./commands/application/delete.sh
71-
source ./commands/application/export.sh
72-
73-
source ./commands/bt/list.sh
74-
75-
source ./commands/server/list.sh
76-
77-
source ./commands/tier/list.sh
78-
source ./commands/tier/get.sh
79-
source ./commands/tier/nodes.sh
80-
81-
source ./commands/metric/list.sh
82-
source ./commands/metric/get.sh
83-
source ./commands/metric/tree.sh
84-
85-
source ./commands/dbmon/create.sh
86-
source ./commands/dbmon/get.sh
87-
source ./commands/dbmon/list.sh
88-
source ./commands/dbmon/delete.sh
89-
90-
source ./commands/event/create.sh
91-
source ./commands/event/list.sh
92-
93-
source ./commands/timerange/create.sh
94-
source ./commands/timerange/list.sh
95-
source ./commands/timerange/delete.sh
96-
97-
source ./commands/dashboard/list.sh
98-
source ./commands/dashboard/export.sh
99-
source ./commands/dashboard/import.sh
100-
source ./commands/dashboard/delete.sh
101-
source ./commands/dashboard/update.sh
102-
103-
source ./commands/federation/createkey.sh
104-
source ./commands/federation/establish.sh
105-
source ./commands/federation/setup.sh
106-
47+
#script_placeholder
10748

10849
if [ -f "${GLOBAL_CONFIG}" ]; then
10950
debug "Sourcing global config from ${GLOBAL_CONFIG} "

0 commit comments

Comments
 (0)