-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathreport.sh
More file actions
executable file
·36 lines (21 loc) · 898 Bytes
/
report.sh
File metadata and controls
executable file
·36 lines (21 loc) · 898 Bytes
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
#!/bin/bash
#To view reports on the terminal.
echo "Get into the openshift metering project"
oc project openshift-metering
echo "Get the list of all pods"
oc -n openshift-metering get pods
echo "See all the generated reports"
oc get reportdatasources -n openshift-metering | grep -v raw
echo " Setting meteringRoute"
meteringRoute="$(oc get routes metering -o jsonpath='{.spec.host}')"
echo "$meteringRoute"
token="$(oc whoami -t)"
echo "Name of the report we are acessing"
read -p "Enter report name : " nameOfReport
reportName=$nameOfReport
echo "$reportName"
echo "Data type can be either csv or json"
read -p "Enter report name : " formatOfReport
reportFormat=$formatOfReport
echo "Curl command to access data"
curl --insecure -H "Authorization: Bearer ${token}" "https://${meteringRoute}/api/v1/reports/get?name=${reportName}&namespace=openshift-metering&format=$reportFormat"