Skip to content

Commit 74045c7

Browse files
authored
Merge pull request #12 from unfor19/fix/11
Fix/11
2 parents 7f9e860 + 49bcbbb commit 74045c7

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
steps:
3030
- uses: actions/checkout@v2
3131
- name: Install minikube
32-
uses: opsgang/ga-setup-minikube@v0.1.1
32+
uses: unfor19/ga-setup-minikube@ca5bb1bd1ae316f95a86f882b9eb9ae866b8ab9e
3333
with:
3434
minikube-version: 1.7.2
3535
k8s-version: 1.17.2

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ $ pip install frigga
117117
### Getting Started
118118

119119
1. git clone this repository
120+
1. Run Docker daemon (Docker for Desktop)
121+
1. Make sure port 8080 is not in use
120122
1. Deploy locally the services: Prometheus, Grafana, node-exporter and cadvisor
121123

122124
```bash
@@ -138,6 +140,7 @@ $ pip install frigga
138140
1. Get all the metrics that are used in your Grafana dasboards
139141

140142
```bash
143+
$ export GRAFANA_API_KEY=the-key-that-was-generated-in-the-deploy-locally-step
141144
$ frigga gl -gurl http://localhost:3000 -gkey $GRAFANA_API_KEY
142145
143146
>> [LOG] Getting the list of words to ignore when scraping from Grafana

docker-compose/deploy_stack.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ generate_apikey(){
88
--data '{"name":"local","role":"Viewer","secondsToLive":86400}' \
99
http://localhost:3000/api/auth/keys | jq -r .key)
1010
echo $apikey
11-
[[ ! -z $FRIGGA_TESTING ]] && echo $apikey > .apikey
11+
echo $apikey > .apikey && echo ">> API Key was saved in .apikey file"
12+
echo ">> Export the key as environment variable for later use"
13+
echo "export GRAFANA_API_KEY=${apikey}"
1214
}
1315

1416
grafana_update_admin_password(){

scripts/grafana.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def get_metrics_list(base_url, api_key):
7878
base_url
7979
).json()
8080
data = {
81-
"dashboards": {}
81+
"dashboards": dict()
8282
}
8383
for dashboard in dashboards:
8484
dashboard_body = grafana_http_request(
@@ -91,8 +91,9 @@ def get_metrics_list(base_url, api_key):
9191
dashboard_name = dashboard_body['meta']['slug'] if 'slug' in dashboard_body[
9292
'meta'] and dashboard_body['meta']['slug'] else "null"
9393
print_msg(msg_content=f"Getting metrics from {dashboard_name}")
94-
expressions = scrape_value_by_key(dashboard_body, "expr", str)
95-
expressions += scrape_value_by_key(dashboard_body, "query", str)
94+
expressions = \
95+
scrape_value_by_key(dashboard_body, "expr", str, []) \
96+
+ scrape_value_by_key(dashboard_body, "query", str, [])
9697
dashboard_metrics = []
9798
for expression in expressions:
9899
try:

0 commit comments

Comments
 (0)