未验证 提交 443892e9 编写于 作者: J jiajingbin 提交者: GitHub

Update monitor.py

上级 0ad0f399
......@@ -67,7 +67,7 @@ class Monitor:
scrape_configs.append({'job_name': f'{self.dnodes[index].dnode_ip}', 'static_configs': [{'targets': [f'{self.dnodes[index].dnode_ip}:9256'], 'labels': {'instance': f'{self.dnodes[index].dnode_ip}'}}]})
djson = {'global': {'scrape_interval': config["prometheus"]["scrape_interval"], 'evaluation_interval': config["prometheus"]["evaluation_interval"], 'scrape_timeout': config["prometheus"]["scrape_timeout"]}, 'alerting': {'alertmanagers': [{'static_configs': [{'targets': None}]}]}, 'rule_files': None, 'scrape_configs': scrape_configs}
dstr=json.dumps(djson)
dyml=yaml.load(dstr)
dyml=yaml.load(dstr, Loader=yaml.FullLoader)
stream = open('prometheus.yml', 'w')
yaml.safe_dump(dyml, stream, default_flow_style=False)
self.monitor_conn.upload_file(self.home_dir, 'prometheus.yml')
......@@ -116,4 +116,4 @@ if __name__ == '__main__':
monitor.deployAllNodeExporters()
monitor.deployAllProcessExporters()
monitor.deployPrometheus()
monitor.deployGrafana()
\ No newline at end of file
monitor.deployGrafana()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册