-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathzencli.bash
executable file
·38 lines (34 loc) · 1.05 KB
/
zencli.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
#!/bin/bash
#------------------------------------------------
# Detect how we were called [l|p]
#------------------------------------------------
calledCmd="$(basename $0)"
[[ $calledCmd == "esl" ]] && env="lab1"
[[ $calledCmd == "esp" ]] && env="rdu1"
[[ $calledCmd == "esc" ]] && env="aws1"
#------------------------------------------------
# source zencli.conf variables
#------------------------------------------------
# g* tools via brew install coreutils
[ $(uname) == "Darwin" ] && readlink=greadlink || readlink=readlink
# source default escli.conf
. $(dirname $($readlink -f $0))/zencli.conf
uid="/zport/dmd/Devices/Server/Linux/devices/${1}/os/filesystems/mnt_data/FileSystem"
DATA=$(cat <<-EOM
{
"action" : "TemplateRouter",
"method" : "getThresholds",
"data" : [ {
"uid" : "${uid}"
}
],
"tid" : 1
}
EOM
)
curl -skK \
<(cat <<<"user = \"$( ${usernameCmd} ):$( ${passwordCmd} )\"") \
-X POST ${zenBaseUrl} \
-H "${contType}" \
-H "Host: ${hostname}" \
-d "${DATA}"