-
Notifications
You must be signed in to change notification settings - Fork 2
/
cme_monitoring.bash
59 lines (43 loc) · 1.31 KB
/
cme_monitoring.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
: '
------- No supported in production -------
Enable monitoring blade
Needs to be run in Autoprovision template with "MONITORING" as a custom parameter
------- No supported in production -------
'
. /opt/CPshared/5.0/tmp/.CPprofile.sh
AUTOPROV_ACTION=$1
GW_NAME=$2
CUSTOM_PARAMETERS=$3
if [[ $AUTOPROV_ACTION == delete ]]
then
exit 0
fi
if [[ $CUSTOM_PARAMETERS != MONITORING ]];
then
exit 0
fi
if [[ $CUSTOM_PARAMETERS == MONITORING ]]
then
INSTALL_STATUS=1
POLICY_PACKAGE_NAME="azureinbound-RB"
## only static parameter put the policy name still trying to find the way to grab it##
echo "Connection to API server"
SID=$(mgmt_cli -r true login -f json | jq -r '.sid')
GW_JSON=$(mgmt_cli --session-id $SID show simple-gateway name $GW_NAME -f json)
GW_UID=$(echo $GW_JSON | jq '.uid')
echo "adding monitoring blade to $GW_NAME"
mgmt_cli --session-id $SID set generic-object uid $GW_UID monitorBlade true
echo "Publishing changes"
mgmt_cli publish --session-id $SID
echo "Install policy"
until [[ $INSTALL_STATUS != 1 ]]; do
mgmt_cli --session-id $SID -f json install-policy policy-package $POLICY_PACKAGE_NAME targets $GW_UID
INSTALL_STATUS=$?
done
echo "Policy Installed"
echo "Logging out of session"
mgmt_cli logout --session-id $SID
exit 0
fi
exit 0