Skip to content

Commit b5b40ab

Browse files
committed
Verbosity + BT List
1 parent e3c01fe commit b5b40ab

File tree

5 files changed

+71
-8
lines changed

5 files changed

+71
-8
lines changed

adc.sh

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ GLOBAL_LONG_HELP_COUNTER=0
1717
declare -a GLOBAL_LONG_HELP_STRINGS
1818
declare -a GLOBAL_LONG_HELP_COMMANDS
1919
SCRIPTNAME=$(basename "$0")
20+
VERBOSITY_COUNTER=0
21+
declare -i VERBOSITY_COUNTER
2022
# register namespace_command help
2123
function register {
2224
GLOBAL_COMMANDS="$GLOBAL_COMMANDS $1"
@@ -190,7 +192,8 @@ function _help {
190192
COMMAND_RESULT="${COMMAND_RESULT}\t-H <controller-host>\t\t specify the host of the controller you want to connect to\n"
191193
COMMAND_RESULT="${COMMAND_RESULT}\t-C <controller-credentials>\t provide the credentials for the controller. Format: user@tenant:password\n"
192194
COMMAND_RESULT="${COMMAND_RESULT}\t-D <output-verbosity>\t\t Change the output verbosity. Provide a list of the following values: debug,error,warn,info,output\n"
193-
COMMAND_RESULT="${COMMAND_RESULT}\t-D <application-name>\t\t Provide a default application"
195+
COMMAND_RESULT="${COMMAND_RESULT}\t-D <application-name>\t\t Provide a default application\n"
196+
COMMAND_RESULT="${COMMAND_RESULT}\t-v[vv] \t\t\t\t Increase application verbosity: v = warn, vv = warn,info, vvv = warn,info,debug\n"
194197
COMMAND_RESULT="${COMMAND_RESULT}\nTo execute a action, provide a namespace and a command, e.g. \"metrics get\" to get a specific metric.\nFinally the following commands in the global namespace can be called directly:\n"
195198
local NAMESPACE=""
196199
local SORTED
@@ -443,6 +446,19 @@ register application_export Export an application from the controller
443446
describe application_export << EOF
444447
Export a application from the controller. Specifiy the application id as parameter.
445448
EOF
449+
function bt_list {
450+
local APPLICATION_ID=$*
451+
if [[ $APPLICATION_ID =~ ^[0-9]+$ ]]; then
452+
controller_call /controller/rest/applications/${APPLICATION_ID}/business-transactions
453+
else
454+
COMMAND_RESULT=""
455+
error "This is not a number: '$APPLICATION_ID'"
456+
fi
457+
}
458+
register bt_list List all business transactions for a given application
459+
describe bt_list << EOF
460+
List all business transactions for a given application. Provide the application id as parameter.
461+
EOF
446462
function metric_list {
447463
local APPLICATION=${CONFIG_CONTROLLER_DEFAULT_APPLICATION}
448464
local METRIC_PATH=""
@@ -791,7 +807,7 @@ else
791807
warning "File ${USER_CONFIG} not found!"
792808
fi
793809
# Parse global options
794-
while getopts "H:C:D:P:S:F:" opt;
810+
while getopts "H:C:D:P:S:F:v" opt;
795811
do
796812
case "${opt}" in
797813
H)
@@ -832,6 +848,20 @@ do
832848
CONFIG_CONTROLLER_HOST=${CONTROLLER_INFO_XML_SCHEMA}://${CONTROLLER_INFO_XML_HOST// /}:${CONTROLLER_INFO_XML_PORT// /}
833849
debug "Set CONFIG_CONTROLLER_HOST=${CONFIG_CONTROLLER_HOST}"
834850
;;
851+
v)
852+
case $VERBOSITY_COUNTER in
853+
0)
854+
CONFIG_OUTPUT_VERBOSITY="${CONFIG_OUTPUT_VERBOSITY},warn"
855+
;;
856+
1)
857+
CONFIG_OUTPUT_VERBOSITY="${CONFIG_OUTPUT_VERBOSITY},info"
858+
;;
859+
2)
860+
CONFIG_OUTPUT_VERBOSITY="${CONFIG_OUTPUT_VERBOSITY},debug"
861+
;;
862+
esac
863+
VERBOSITY_COUNTER=${VERBOSITY_COUNTER}+1
864+
;;
835865
esac
836866
done
837867
shiftOptInd

commands/bt/list.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
function bt_list {
4+
local APPLICATION_ID=$*
5+
if [[ $APPLICATION_ID =~ ^[0-9]+$ ]]; then
6+
controller_call /controller/rest/applications/${APPLICATION_ID}/business-transactions
7+
else
8+
COMMAND_RESULT=""
9+
error "This is not a number: '$APPLICATION_ID'"
10+
fi
11+
}
12+
13+
register bt_list List all business transactions for a given application
14+
15+
describe bt_list << EOF
16+
List all business transactions for a given application. Provide the application id as parameter.
17+
EOF

commands/help.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ function _help {
77
COMMAND_RESULT="${COMMAND_RESULT}\t-H <controller-host>\t\t specify the host of the controller you want to connect to\n"
88
COMMAND_RESULT="${COMMAND_RESULT}\t-C <controller-credentials>\t provide the credentials for the controller. Format: user@tenant:password\n"
99
COMMAND_RESULT="${COMMAND_RESULT}\t-D <output-verbosity>\t\t Change the output verbosity. Provide a list of the following values: debug,error,warn,info,output\n"
10-
COMMAND_RESULT="${COMMAND_RESULT}\t-D <application-name>\t\t Provide a default application"
10+
COMMAND_RESULT="${COMMAND_RESULT}\t-D <application-name>\t\t Provide a default application\n"
11+
COMMAND_RESULT="${COMMAND_RESULT}\t-v[vv] \t\t\t\t Increase application verbosity: v = warn, vv = warn,info, vvv = warn,info,debug\n"
1112
COMMAND_RESULT="${COMMAND_RESULT}\nTo execute a action, provide a namespace and a command, e.g. \"metrics get\" to get a specific metric.\nFinally the following commands in the global namespace can be called directly:\n"
1213
local NAMESPACE=""
1314
local SORTED

helpers/apiCall.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

main.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ declare -a GLOBAL_LONG_HELP_STRINGS
2222
declare -a GLOBAL_LONG_HELP_COMMANDS
2323
SCRIPTNAME=$(basename "$0")
2424

25+
VERBOSITY_COUNTER=0
26+
declare -i VERBOSITY_COUNTER
27+
2528
# register namespace_command help
2629
function register {
2730
GLOBAL_COMMANDS="$GLOBAL_COMMANDS $1"
@@ -54,6 +57,8 @@ source ./commands/portal/download.sh
5457
source ./commands/application/list.sh
5558
source ./commands/application/export.sh
5659

60+
source ./commands/bt/list.sh
61+
5762
source ./commands/metric/list.sh
5863
source ./commands/metric/get.sh
5964
source ./commands/metric/tree.sh
@@ -89,7 +94,7 @@ else
8994
fi
9095

9196
# Parse global options
92-
while getopts "H:C:D:P:S:F:" opt;
97+
while getopts "H:C:D:P:S:F:v" opt;
9398
do
9499
case "${opt}" in
95100
H)
@@ -130,6 +135,20 @@ do
130135
CONFIG_CONTROLLER_HOST=${CONTROLLER_INFO_XML_SCHEMA}://${CONTROLLER_INFO_XML_HOST// /}:${CONTROLLER_INFO_XML_PORT// /}
131136
debug "Set CONFIG_CONTROLLER_HOST=${CONFIG_CONTROLLER_HOST}"
132137
;;
138+
v)
139+
case $VERBOSITY_COUNTER in
140+
0)
141+
CONFIG_OUTPUT_VERBOSITY="${CONFIG_OUTPUT_VERBOSITY},warn"
142+
;;
143+
1)
144+
CONFIG_OUTPUT_VERBOSITY="${CONFIG_OUTPUT_VERBOSITY},info"
145+
;;
146+
2)
147+
CONFIG_OUTPUT_VERBOSITY="${CONFIG_OUTPUT_VERBOSITY},debug"
148+
;;
149+
esac
150+
VERBOSITY_COUNTER=${VERBOSITY_COUNTER}+1
151+
;;
133152
esac
134153
done
135154

0 commit comments

Comments
 (0)