OPMAAS-3988 adding support for empty department and separation between wall and desktop version
parent
f4990850e8
commit
0d8b03a746
|
|
@ -7,7 +7,7 @@ from datetime import datetime
|
||||||
from git import Repo
|
from git import Repo
|
||||||
import os
|
import os
|
||||||
#set STAGING global dashboard name
|
#set STAGING global dashboard name
|
||||||
DASHBOARD_NAME = "[STAGING]Global Offboard Reliability 2.0 - "
|
DASHBOARD_NAME = "[STAGING]Global Offboard Reliability 2.0"
|
||||||
AUTHSTRING = config("BITBUCKET_USERNAME")+":"+config("BITBUCKET_TOKEN")
|
AUTHSTRING = config("BITBUCKET_USERNAME")+":"+config("BITBUCKET_TOKEN")
|
||||||
CONFIG_REPO_URL = "https://"+AUTHSTRING+"@atc.bmwgroup.net/bitbucket/scm/opapm/shared_configuration.git"
|
CONFIG_REPO_URL = "https://"+AUTHSTRING+"@atc.bmwgroup.net/bitbucket/scm/opapm/shared_configuration.git"
|
||||||
CONFIG_REPO_NAME = "shared_configuration"
|
CONFIG_REPO_NAME = "shared_configuration"
|
||||||
|
|
@ -19,8 +19,8 @@ parser = argparse.ArgumentParser(description="Generate and deploy the Dynatrace
|
||||||
|
|
||||||
parser.add_argument("-R", "--rows", type=int, help="Number of rows per dashboard. If not specified, all rows will be added to single dashboard")
|
parser.add_argument("-R", "--rows", type=int, help="Number of rows per dashboard. If not specified, all rows will be added to single dashboard")
|
||||||
parser.add_argument('--auto-upload', default=False, action='store_true', help="Auto upload to STAGING dashboard")
|
parser.add_argument('--auto-upload', default=False, action='store_true', help="Auto upload to STAGING dashboard")
|
||||||
parser.add_argument('-D', '--department', type=str, required=True, help="Define department for which the dashboard should be updated: 'DE-3', 'DE-7', 'DE-4' or 'EC-DE'")
|
parser.add_argument('-D', '--department', type=str,default="ALL", required=False, help="Define department for which the dashboard should be updated: 'DE-3', 'DE-7', 'DE-4' or 'EC-DE'. Leave empty or use 'ALL' if you want to generate 1 cumulated dashboard")
|
||||||
|
parser.add_argument('--wall', default=False, action='store_true', help="By default script is generating desktop version. Use parameter to set dashboard generation to type 'Wall'.")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
def clone_repo_if_notexist(repourl, reponame):
|
def clone_repo_if_notexist(repourl, reponame):
|
||||||
if(not os.path.isdir(reponame)):
|
if(not os.path.isdir(reponame)):
|
||||||
|
|
@ -122,9 +122,13 @@ def create_or_update_dashboard(DTAPIToken, DTENV, dashboards, files, businesslin
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Dashboard for file: "+filename + " not found.")
|
print("Dashboard for file: "+filename + " not found.")
|
||||||
|
if(args.department == "ALL"):
|
||||||
|
dashfullname = DASHBOARD_NAME
|
||||||
|
else:
|
||||||
|
dashfullname = DASHBOARD_NAME + " - " + businessline + " #" + str(index)
|
||||||
newdashboard = {
|
newdashboard = {
|
||||||
"dashboardMetadata":{
|
"dashboardMetadata":{
|
||||||
"name": DASHBOARD_NAME+ businessline + " #" + str(index),
|
"name": dashfullname,
|
||||||
"owner": "PATRYK.GUDALEWICZ@partner.bmw.de"
|
"owner": "PATRYK.GUDALEWICZ@partner.bmw.de"
|
||||||
},
|
},
|
||||||
"tiles":[]
|
"tiles":[]
|
||||||
|
|
@ -132,7 +136,8 @@ def create_or_update_dashboard(DTAPIToken, DTENV, dashboards, files, businesslin
|
||||||
DTAPIURL = DTENV + "api/config/v1/dashboards"
|
DTAPIURL = DTENV + "api/config/v1/dashboards"
|
||||||
newdashboard["tiles"] = tilesjson
|
newdashboard["tiles"] = tilesjson
|
||||||
print("Creating dashboard: "+newdashboard["dashboardMetadata"]["name"])
|
print("Creating dashboard: "+newdashboard["dashboardMetadata"]["name"])
|
||||||
print(make_request(DTAPIURL,DTAPIToken,True,"post",json.dumps(newdashboard)))
|
creationresult = make_request(DTAPIURL,DTAPIToken,True,"post",json.dumps(newdashboard))
|
||||||
|
print(creationresult)
|
||||||
remove_dashboards(DTAPIToken, DTENV, dashboards)
|
remove_dashboards(DTAPIToken, DTENV, dashboards)
|
||||||
|
|
||||||
def get_bounds (grid_row, grid_column, tile_columnwidth, tile_rowheight):
|
def get_bounds (grid_row, grid_column, tile_columnwidth, tile_rowheight):
|
||||||
|
|
@ -157,7 +162,7 @@ def get_dataExplorerTileSloThreshold(sloThresholdValuesAndColor):
|
||||||
dataExplorerTileThreshold = [ { "value": value1, "color": color1 }, { "value": value2, "color": color2 }, { "value": value3, "color": color3 } ]
|
dataExplorerTileThreshold = [ { "value": value1, "color": color1 }, { "value": value2, "color": color2 }, { "value": value3, "color": color3 } ]
|
||||||
return dataExplorerTileThreshold
|
return dataExplorerTileThreshold
|
||||||
|
|
||||||
def get_DataExplorerTile_Markdown(name_short, department, bounds, detailDashboardUrl_EMEA,detailDashboardUrl_NA, detailDashboardUrl_CN, docURL, slourl_EMEA, slourl_NA, slourl_CN ):
|
def get_DataExplorerTile_Markdown(name_short, department, bounds, detailDashboardUrl_EMEA,detailDashboardUrl_NA, detailDashboardUrl_CN, docURL, slourl_EMEA, slourl_NA, slourl_CN,slorelevant, wall ):
|
||||||
# dataExplorerTile_Markdown = {
|
# dataExplorerTile_Markdown = {
|
||||||
# "name": "Markdown",
|
# "name": "Markdown",
|
||||||
# "tileType": "MARKDOWN",
|
# "tileType": "MARKDOWN",
|
||||||
|
|
@ -167,12 +172,19 @@ def get_DataExplorerTile_Markdown(name_short, department, bounds, detailDashboar
|
||||||
# "markdown": "___________\n## " + name_short + "\n\n" + department + " | --> [EMEA](" + detailDashboardUrl_EMEA + ") [NA](" + detailDashboardUrl_NA + ") [CN](" + detailDashboardUrl_CN + ")\n [Documentation](" + docURL + ")"
|
# "markdown": "___________\n## " + name_short + "\n\n" + department + " | --> [EMEA](" + detailDashboardUrl_EMEA + ") [NA](" + detailDashboardUrl_NA + ") [CN](" + detailDashboardUrl_CN + ")\n [Documentation](" + docURL + ")"
|
||||||
# }
|
# }
|
||||||
#without team links
|
#without team links
|
||||||
markdown = "___________\n## " + name_short + "\n\n" + department + " [Documentation](" + docURL + ") \n"
|
if(not wall):
|
||||||
if(slourl_EMEA):
|
markdown = "___________\n## " + name_short + "\n\n" + department + " [Documentation](" + docURL + ")"
|
||||||
|
else:
|
||||||
|
markdown = "___________\n## " + name_short + "\n\n" + department
|
||||||
|
if(slorelevant):
|
||||||
|
markdown = markdown + " [QM-Report] \n"
|
||||||
|
else:
|
||||||
|
markdown = markdown + " \n"
|
||||||
|
if(slourl_EMEA and not wall):
|
||||||
markdown = markdown + "[EMEA]("+slourl_EMEA+") "
|
markdown = markdown + "[EMEA]("+slourl_EMEA+") "
|
||||||
if(slourl_NA):
|
if(slourl_NA and not wall):
|
||||||
markdown = markdown + "[NA]("+slourl_NA+") "
|
markdown = markdown + "[NA]("+slourl_NA+") "
|
||||||
if(slourl_CN):
|
if(slourl_CN and not wall):
|
||||||
markdown = markdown + "[CN]("+slourl_CN+") "
|
markdown = markdown + "[CN]("+slourl_CN+") "
|
||||||
dataExplorerTile_Markdown = {
|
dataExplorerTile_Markdown = {
|
||||||
"name": "Markdown",
|
"name": "Markdown",
|
||||||
|
|
@ -265,6 +277,7 @@ def create_default_tiles():
|
||||||
"image": "data:image/webp;base64,UklGRlYHAABXRUJQVlA4WAoAAAAQAAAAOQAAcAAAQUxQSAQBAAABgGNt2zHn2cDYUzM2O6tyNWVsLCJZAav5+2QWEHZONmBbpTHW95zvpExEoG3bNlS7FdmaIxCVylExPCKo4UqHCvFqXzp8Cgjr6XCpLZbe9x0Q3LdPH339AUL+qKMEKClhje8cb7XATIDUFHQrLIsa9xHLicd5wHLo+js59nnKb3kGAjzDUuogyjplDpJRwSVPv4SD9h1DNC+1PIERokGmYaLmVx7nPo/rkKdXyidDMhoi6uO5LSP+bmcPcaPknsu4OZ0H/5VxH7EcewxrLGt6zLHMAc2fHB9NABQOBWH2PYYtawRKF8Sbz0d0usmNs3dx3s/WJ3SIkyXdOzYqqHFvugWRAFZQOCAsBgAAkBoAnQEqOgBxAD5tMJNHJCKhoSYVXdCADYlpDbwAiVj9T4g+Rr19KlpQ3/9rj/S8IrYT0C+8HEJxz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Qh/6Auz+OqKcSZ4GaCPzmOYHsgIieWAsZJ93o6gdU/cl9NTD/m3ZqtX1n/kCwYHEXOAX9KyvqjXqg55cTK4GnWZzFtojcfG0Fd30O9AlVl0yzSwxwxFA128xJmPoCrDV339n/l1jnaYx3ivNfCCZU7qhzUpecgzq4p/VsMQX3Pb8elQ40J68H/2n/2/Nl4O/sRgFXm9Y3Qmj0Bs0wbYY7/3//aU7iSogAAAAA="
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
if(args.wall):
|
||||||
# EMEA HUB
|
# EMEA HUB
|
||||||
newDashboardTiles.append({ "name": "Header" ,"tileType": "MARKDOWN" , "configured": "true" , "bounds": get_bounds(0 , 7 , 20 , 2), "tileFilter": {}, "markdown": "# EMEA" })
|
newDashboardTiles.append({ "name": "Header" ,"tileType": "MARKDOWN" , "configured": "true" , "bounds": get_bounds(0 , 7 , 20 , 2), "tileFilter": {}, "markdown": "# EMEA" })
|
||||||
newDashboardTiles.append({ "name": "Last 1 h" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 7 , 4 , 1), "tileFilter": {} })
|
newDashboardTiles.append({ "name": "Last 1 h" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 7 , 4 , 1), "tileFilter": {} })
|
||||||
|
|
@ -280,7 +293,22 @@ def create_default_tiles():
|
||||||
newDashboardTiles.append({ "name": "Last 1 h" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 49 , 4 , 1), "tileFilter": {} })
|
newDashboardTiles.append({ "name": "Last 1 h" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 49 , 4 , 1), "tileFilter": {} })
|
||||||
newDashboardTiles.append({ "name": "Reliability Graph (3 days)" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 53 , 12 , 1), "tileFilter": {} })
|
newDashboardTiles.append({ "name": "Reliability Graph (3 days)" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 53 , 12 , 1), "tileFilter": {} })
|
||||||
newDashboardTiles.append({ "name": "Last 3 days" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 65 , 4 , 1), "tileFilter": {} })
|
newDashboardTiles.append({ "name": "Last 3 days" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 65 , 4 , 1), "tileFilter": {} })
|
||||||
|
else:
|
||||||
|
# EMEA HUB
|
||||||
|
newDashboardTiles.append({ "name": "Header" ,"tileType": "MARKDOWN" , "configured": "true" , "bounds": get_bounds(0 , 7 , 14 , 2), "tileFilter": {}, "markdown": "# EMEA" })
|
||||||
|
newDashboardTiles.append({ "name": "Last 1 h" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 7 , 4 , 1), "tileFilter": {} })
|
||||||
|
newDashboardTiles.append({ "name": "Reliability Graph (3 days)" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 11 , 6 , 1), "tileFilter": {} })
|
||||||
|
newDashboardTiles.append({ "name": "Last 3 days" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 17 , 4 , 1), "tileFilter": {} })
|
||||||
|
# NORTH AMERICA HUB
|
||||||
|
newDashboardTiles.append({ "name": "Header" ,"tileType": "MARKDOWN" , "configured": "true" , "bounds": get_bounds(0 , 22 , 14 , 2), "tileFilter": {}, "markdown": "# NORTH AMERICA" })
|
||||||
|
newDashboardTiles.append({ "name": "Last 1 h" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 22 , 4 , 1), "tileFilter": {} })
|
||||||
|
newDashboardTiles.append({ "name": "Reliability Graph (3 days)" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 26 , 6 , 1), "tileFilter": {} })
|
||||||
|
newDashboardTiles.append({ "name": "Last 3 days" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 32 , 4 , 1), "tileFilter": {} })
|
||||||
|
# CHINA HUB
|
||||||
|
newDashboardTiles.append({ "name": "Header" ,"tileType": "MARKDOWN" , "configured": "true" , "bounds": get_bounds(0 , 37 , 14 , 2), "tileFilter": {}, "markdown": "# CHINA" })
|
||||||
|
newDashboardTiles.append({ "name": "Last 1 h" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 37 , 4 , 1), "tileFilter": {} })
|
||||||
|
newDashboardTiles.append({ "name": "Reliability Graph (3 days)" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 41 , 6 , 1), "tileFilter": {} })
|
||||||
|
newDashboardTiles.append({ "name": "Last 3 days" ,"tileType": "HEADER" , "configured": "true" , "bounds": get_bounds(2 , 47 , 4 , 1), "tileFilter": {} })
|
||||||
return newDashboardTiles
|
return newDashboardTiles
|
||||||
|
|
||||||
def main(slo_path):
|
def main(slo_path):
|
||||||
|
|
@ -291,21 +319,24 @@ def main(slo_path):
|
||||||
print("Generating dashboard tiles...")
|
print("Generating dashboard tiles...")
|
||||||
slo_doc = load_slo_parameter(slo_path)
|
slo_doc = load_slo_parameter(slo_path)
|
||||||
dashboard_json = create_default_tiles()
|
dashboard_json = create_default_tiles()
|
||||||
|
if(args.wall):
|
||||||
|
offsets = [0,21,42]
|
||||||
|
else:
|
||||||
|
offsets = [0,15,30]
|
||||||
hub_config = {
|
hub_config = {
|
||||||
"euprod":
|
"euprod":
|
||||||
{
|
{
|
||||||
"offset": 0,
|
"offset": offsets[0],
|
||||||
"remote_url": 'https://xxu26128.live.dynatrace.com'
|
"remote_url": 'https://xxu26128.live.dynatrace.com'
|
||||||
},
|
},
|
||||||
"naprod":
|
"naprod":
|
||||||
{
|
{
|
||||||
"offset": 21,
|
"offset": offsets[1],
|
||||||
"remote_url": 'https://wgv50241.live.dynatrace.com'
|
"remote_url": 'https://wgv50241.live.dynatrace.com'
|
||||||
},
|
},
|
||||||
"cnprod":
|
"cnprod":
|
||||||
{
|
{
|
||||||
"offset": 42,
|
"offset": offsets[2],
|
||||||
"remote_url": 'https://dynatrace-cn-int.bmwgroup.com:443/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b'
|
"remote_url": 'https://dynatrace-cn-int.bmwgroup.com:443/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -320,11 +351,17 @@ def main(slo_path):
|
||||||
generatedfiles = []
|
generatedfiles = []
|
||||||
if(args.rows is not None):
|
if(args.rows is not None):
|
||||||
rowcount = args.rows
|
rowcount = args.rows
|
||||||
|
if(args.department == "ALL"):
|
||||||
|
blname = "ALL"
|
||||||
|
else:
|
||||||
blname = BUSINESS_LINES[args.department]
|
blname = BUSINESS_LINES[args.department]
|
||||||
blvalue = args.department
|
blvalue = args.department
|
||||||
|
slorelevant = False
|
||||||
if(blname and blvalue):
|
if(blname and blvalue):
|
||||||
for slo_name, configuration in slo_doc.items():
|
for slo_name, configuration in slo_doc.items():
|
||||||
if configuration['department'].startswith(blvalue):
|
if configuration['department'].startswith(blvalue) or blvalue == "ALL":
|
||||||
|
if(configuration['selector_var'] == "CoCo-QM-Report_Mobile"):
|
||||||
|
slorelevant = True
|
||||||
print("Dashboard #"+str(dahboardcount)+" : Configurint SLO "+str(boundindex) +" of "+str(rowcount))
|
print("Dashboard #"+str(dahboardcount)+" : Configurint SLO "+str(boundindex) +" of "+str(rowcount))
|
||||||
if rowcount > 0 and boundindex > rowcount:
|
if rowcount > 0 and boundindex > rowcount:
|
||||||
dashboard_json = create_default_tiles()
|
dashboard_json = create_default_tiles()
|
||||||
|
|
@ -346,14 +383,20 @@ def main(slo_path):
|
||||||
naslourl = hub_config["naprod"]["remote_url"] + "/ui/slo?id="+configuration["ids"]["na"]+"&sloexp="+configuration["ids"]["na"]+"&slovis=Table"
|
naslourl = hub_config["naprod"]["remote_url"] + "/ui/slo?id="+configuration["ids"]["na"]+"&sloexp="+configuration["ids"]["na"]+"&slovis=Table"
|
||||||
if(configuration["ids"]["cn"]):
|
if(configuration["ids"]["cn"]):
|
||||||
cnslourl = hub_config["cnprod"]["remote_url"] + "/ui/slo?id="+configuration["ids"]["cn"]+"&sloexp="+configuration["ids"]["cn"]+"&slovis=Table"
|
cnslourl = hub_config["cnprod"]["remote_url"] + "/ui/slo?id="+configuration["ids"]["cn"]+"&sloexp="+configuration["ids"]["cn"]+"&slovis=Table"
|
||||||
dashboard_json.append(get_DataExplorerTile_Markdown(slo_display, slo_department, get_bounds(((boundindex)*(3)) , 0 , 7 , 3), configuration["ops_dashboard"]["emea"], configuration["ops_dashboard"]["na"], configuration["ops_dashboard"]["cn"],configuration["doc_url"],emeaslourl,naslourl,cnslourl))
|
dashboard_json.append(get_DataExplorerTile_Markdown(slo_display, slo_department, get_bounds(((boundindex)*(3)) , 0 , 7 , 3), configuration["ops_dashboard"]["emea"], configuration["ops_dashboard"]["na"], configuration["ops_dashboard"]["cn"],configuration["doc_url"],emeaslourl,naslourl,cnslourl,slorelevant,args.wall))
|
||||||
for hub,tiles in configuration["hubs"].items():
|
for hub,tiles in configuration["hubs"].items():
|
||||||
if 'actual' in tiles["tiles"]:
|
if 'actual' in tiles["tiles"]:
|
||||||
dashboard_json.append(get_DataExplorerTile_SingleValue(slo_name, configuration["metric"], hub_config[hub]["remote_url"], get_bounds(((boundindex)*(3)) , 7 + hub_config[hub]["offset"] , 4 , 3), timeframe_actual, slo_graphThreshold_SingleValue))
|
dashboard_json.append(get_DataExplorerTile_SingleValue(slo_name, configuration["metric"], hub_config[hub]["remote_url"], get_bounds(((boundindex)*(3)) , 7 + hub_config[hub]["offset"] , 4 , 3), timeframe_actual, slo_graphThreshold_SingleValue))
|
||||||
if "graph" in tiles["tiles"]:
|
if "graph" in tiles["tiles"]:
|
||||||
|
if(args.wall):
|
||||||
dashboard_json.append(get_DataExplorerTile_Graph(slo_name, configuration["metric"], configuration["selector_var"].replace("~",""), hub_config[hub]["remote_url"], get_bounds(((boundindex)*(3)) , 11 + hub_config[hub]["offset"] , 12 , 3), timeframe_graph, "97", "102", slo_graphThreshold_Graph))
|
dashboard_json.append(get_DataExplorerTile_Graph(slo_name, configuration["metric"], configuration["selector_var"].replace("~",""), hub_config[hub]["remote_url"], get_bounds(((boundindex)*(3)) , 11 + hub_config[hub]["offset"] , 12 , 3), timeframe_graph, "97", "102", slo_graphThreshold_Graph))
|
||||||
|
else:
|
||||||
|
dashboard_json.append(get_DataExplorerTile_Graph(slo_name, configuration["metric"], configuration["selector_var"].replace("~",""), hub_config[hub]["remote_url"], get_bounds(((boundindex)*(3)) , 11 + hub_config[hub]["offset"] , 6 , 3), timeframe_graph, "97", "102", slo_graphThreshold_Graph))
|
||||||
if "ytd" in tiles["tiles"]:
|
if "ytd" in tiles["tiles"]:
|
||||||
|
if(args.wall):
|
||||||
dashboard_json.append(get_DataExplorerTile_SingleValue(slo_name, configuration["metric"], hub_config[hub]["remote_url"], get_bounds(((boundindex)*(3)) , 23 + hub_config[hub]["offset"] , 4 , 3), timeframe_ytd, slo_graphThreshold_SingleValue))
|
dashboard_json.append(get_DataExplorerTile_SingleValue(slo_name, configuration["metric"], hub_config[hub]["remote_url"], get_bounds(((boundindex)*(3)) , 23 + hub_config[hub]["offset"] , 4 , 3), timeframe_ytd, slo_graphThreshold_SingleValue))
|
||||||
|
else:
|
||||||
|
dashboard_json.append(get_DataExplorerTile_SingleValue(slo_name, configuration["metric"], hub_config[hub]["remote_url"], get_bounds(((boundindex)*(3)) , 17 + hub_config[hub]["offset"] , 4 , 3), timeframe_ytd, slo_graphThreshold_SingleValue))
|
||||||
boundindex = boundindex+1
|
boundindex = boundindex+1
|
||||||
if rowcount > 0 and boundindex > rowcount:
|
if rowcount > 0 and boundindex > rowcount:
|
||||||
with open("dashboard_tiles_"+str(dahboardcount)+".json", "w") as file:
|
with open("dashboard_tiles_"+str(dahboardcount)+".json", "w") as file:
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ To provide authentication for API calls, create ".env" file in the script direct
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
usage: createDash.py [-h] [-R ROWS] [--auto-upload] -D DEPARTMENT
|
usage: createDash.py [-h] [-R ROWS] [--auto-upload] [-D DEPARTMENT] [--wall]
|
||||||
|
|
||||||
Generate and deploy the Dynatrace Global Dashboard as Code. Auto deployment works only for STAGING dashboard
|
Generate and deploy the Dynatrace Global Dashboard as Code. Auto deployment works only for STAGING dashboard
|
||||||
|
|
||||||
|
|
@ -52,7 +52,9 @@ To provide authentication for API calls, create ".env" file in the script direct
|
||||||
-R ROWS, --rows ROWS Number of rows per dashboard. If not specified, all rows will be added to single dashboard (default: None)
|
-R ROWS, --rows ROWS Number of rows per dashboard. If not specified, all rows will be added to single dashboard (default: None)
|
||||||
--auto-upload Auto upload to STAGING dashboard (default: False)
|
--auto-upload Auto upload to STAGING dashboard (default: False)
|
||||||
-D DEPARTMENT, --department DEPARTMENT
|
-D DEPARTMENT, --department DEPARTMENT
|
||||||
Define department for which the dashboard should be updated: 'DE-3', 'DE-7', 'DE-4' or 'EC-DE' (default: None)
|
Define department for which the dashboard should be updated: 'DE-3', 'DE-7', 'DE-4' or 'EC-DE'. Leave empty or use 'ALL' if you want to generate 1
|
||||||
|
cumulated dashboard (default: ALL)
|
||||||
|
--wall By default script is generating desktop version. Use parameter to set dashboard generation to type 'Wall'. (default: False)
|
||||||
# Files
|
# Files
|
||||||
|
|
||||||
## createDash.py
|
## createDash.py
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue