Skip to content

Commit

Permalink
bump grafana ini config to version 11.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Vonng committed Jun 30, 2024
1 parent 8f140c2 commit 816af86
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 61 deletions.
12 changes: 8 additions & 4 deletions files/grafana/grafana.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
PASSWORD = os.environ.get("GRAFANA_PASSWORD", 'pigsty')
PORTALS = os.environ.get("INFRA_PORTAL", "")
USE_HTTPS = os.environ.get("USE_HTTPS", "false")
CREATE_FOLDERS = True

METADB_PASSWORD = 'DBUser.Viewer'
DEFAULT_DATASOURCES = {
Expand Down Expand Up @@ -92,10 +93,11 @@ def add_dashboard(d, folder=None):
"""put raw dashboard"""
d["id"] = None
payload = {"dashboard": d, "overwrite": True}
if folder is not None and folder != "":
payload["folderUid"] = folder
else:
payload["folderId"] = 0
if CREATE_FOLDERS:
if folder is not None and folder != "":
payload["folderUid"] = folder
else:
payload["folderId"] = 0
return post('dashboards/db', payload)


Expand Down Expand Up @@ -129,6 +131,8 @@ def list_folders():


def add_folder(uid, title=""):
if not CREATE_FOLDERS:
return
if title == "":
title = uid.upper()
post('folders', {"uid": uid, "title": title})
Expand Down
Loading

0 comments on commit 816af86

Please sign in to comment.