Hello, i´am new in this python script thing, and i´am trying to show the name of my cluster owner with the following script.
I dont know how to return the information.... Does anyone can help me?
- -*- coding: UTF-8 -*- import os import json
def func_cluster():
os.system(r'C:\Users\victor.salomao\Downloads\PSTools\PsExec
mqprod01 -u username -p password cmd.exe /v /c echo ^%computername^% > ClusterOwner.log')
arquivo = open('ClusterOwner.log') cluster_owner = arquivo.read()
arquivo.close()
estrutura = {"prtg": {"result": [{"channel": "First channel", "value": ""}]}} estrutura['prtg']['result'][0]['value'] = cluster_owner
with open('data.json', 'w') as arquivo: json.dump(estrutura, arquivo)
with open('data.json', 'r') as f: data = json.load(f)
return data
func_cluster()
Add comment