@@ -120,14 +120,14 @@ function apiCall {
120
120
OLDIFS=$IFS
121
121
IFS=" \$ "
122
122
for MATCH in $PAYLOAD ; do
123
- if [ " ${MATCH:: 1} " = " {" ] ; then
123
+ if [ " ${MATCH:: 1} " = " {" ] && [ " ${MATCH : 2 : 1} " = " } " ] ; then
124
124
MATCH=${MATCH: 1}
125
125
OPT=${MATCH%% \} * } :
126
126
OPTS=" ${OPTS}${OPT} "
127
127
fi
128
128
done ;
129
129
for MATCH in $ENDPOINT ; do
130
- if [ " ${MATCH:: 1} " = " {" ] ; then
130
+ if [ " ${MATCH:: 1} " = " {" ] && [ " ${MATCH : 2 : 1} " = " } " ] ; then
131
131
MATCH=${MATCH: 1}
132
132
OPT=${MATCH%% \} * } :
133
133
OPTS=" ${OPTS}${OPT} "
@@ -143,6 +143,14 @@ function apiCall {
143
143
shiftOptInd
144
144
shift $SHIFTS
145
145
fi
146
+ while [[ $PAYLOAD =~ \$ {[^}]* } ]] ; do
147
+ if [ -z " $1 " ] ; then
148
+ error " Please provide an argument for paramater -${BASH_REMATCH: 2: 1} "
149
+ return ;
150
+ fi
151
+ PAYLOAD=${PAYLOAD// ${BASH_REMATCH[0]} / $1 }
152
+ shift
153
+ done
146
154
while [[ $ENDPOINT =~ \$ {[^}]* } ]] ; do
147
155
if [ -z " $1 " ] ; then
148
156
error " Please provide an argument for paramater -${BASH_REMATCH: 2: 1} "
@@ -153,9 +161,9 @@ function apiCall {
153
161
done
154
162
debug " Call Controller: -X $METHOD -d $PAYLOAD $ENDPOINT "
155
163
if [ -n " $PAYLOAD " ] ; then
156
- controller_call -X $METHOD -d $PAYLOAD $ENDPOINT
164
+ echo -X $METHOD -d $PAYLOAD $ENDPOINT
157
165
else
158
- controller_call -X $METHOD $ENDPOINT
166
+ echo -X $METHOD $ENDPOINT
159
167
fi
160
168
}
161
169
# __call GET "/controller/rest/applications/\${a}/business-transactions" -a ECommerce
@@ -644,48 +652,12 @@ describe metric_tree << EOF
644
652
Create a metric tree for the given application (-a). Note that this will create a lot of requests towards your controller.
645
653
EOF
646
654
function dbmon_create {
647
- local DB_USER=" "
648
- local DB_HOSTNAME=" "
649
- local DB_AGENT=" "
650
- local DB_TYPE=" "
651
- local DB_COLLECTOR_NAME=" "
652
- local DB_NAME=" "
653
- local DB_PORT=" "
654
- local DB_PASSWORD=" "
655
- while getopts " u:h:a:t:n:p:s:" opt " $@ " ;
656
- do
657
- case " ${opt} " in
658
- u)
659
- DB_USER=${OPTARG}
660
- ;;
661
- h)
662
- DB_HOSTNAME=${OPTARG}
663
- ;;
664
- a)
665
- DB_AGENT=${OPTARG}
666
- ;;
667
- t)
668
- DB_TYPE=${OPTARG}
669
- ;;
670
- n)
671
- DB_NAME=${OPTARG}
672
- ;;
673
- p)
674
- DB_PORT=${OPTARG}
675
- ;;
676
- s)
677
- DB_PASSWORD=${OPTARG}
678
- ;;
679
- esac
680
- done ;
681
- shiftOptInd
682
- shift $SHIFTS
683
- DB_COLLECTOR_NAME=" $* "
684
- controller_call -X POST -d " { \
685
- \" username\" : \" $DB_USER \" ,\
686
- \" hostname\" : \" $DB_HOSTNAME \" ,\
687
- \" agentName\" : \" $DB_AGENT \" ,\
688
- \" type\" : \" $DB_TYPE \" ,\
655
+ apiCall -X POST -d " { \
656
+ \" name\" : \"\$ {i}\" ,\
657
+ \" username\" : \"\$ {u}\" ,\
658
+ \" hostname\" : \"\$ {h}\" ,\
659
+ \" agentName\" : \"\$ {a}\" ,\
660
+ \" type\" : \"\$ {t}\" ,\
689
661
\" orapkiSslEnabled\" : false,\
690
662
\" orasslTruststoreLoc\" : null,\
691
663
\" orasslTruststoreType\" : null,\
@@ -694,17 +666,24 @@ function dbmon_create {
694
666
\" orasslKeystoreLoc\" : null,\
695
667
\" orasslKeystoreType\" : null,\
696
668
\" orasslKeystorePassword\" : null,\
697
- \" name\" : \" $DB_COLLECTOR_NAME \" ,\
698
- \" databaseName\" : \" $DB_NAME \" ,\
699
- \" port\" : \" $DB_PORT \" ,\
700
- \" password\" : \" $DB_PASSWORD \" ,\
669
+ \" databaseName\" : \"\$ {n}\" ,\
670
+ \" port\" : \"\$ {p}\" ,\
671
+ \" password\" : \"\$ {s}\" ,\
701
672
\" excludedSchemas\" : [],\
702
673
\" enabled\" : true\
703
- }" /controller/restui/databases/collectors/createConfiguration
674
+ }" /controller/restui/databases/collectors/createConfiguration " $@ "
704
675
}
705
676
register dbmon_create Create a new database collector
706
677
describe dbmon_create << EOF
707
- Create a new database collector
678
+ Create a new database collector. You need to provide the following parameters:
679
+ -i name
680
+ -u user name
681
+ -h host name
682
+ -a agent name
683
+ -t type
684
+ -d database name
685
+ -p port
686
+ -s password
708
687
EOF
709
688
function dbmon_list {
710
689
controller_call /controller/restui/databases/collectors/
0 commit comments