parent
109cbe5891
commit
0841218191
|
@ -1,18 +1,20 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from units import consul_kv
|
from units import consul_kv,consul_manager
|
||||||
import uuid
|
import uuid,sys
|
||||||
from units.config_log import *
|
from units.config_log import *
|
||||||
|
|
||||||
|
if consul_manager.get_consul_ver() == False:
|
||||||
|
sys.exit("请求consul异常, 程序退出.")
|
||||||
|
|
||||||
|
skey_path = 'ConsulManager/assets/secret/'
|
||||||
skey_path = 'ConsulManager/assets/secret/skey'
|
if consul_kv.get_kv_dict(skey_path + 'skey') == {}:
|
||||||
if consul_kv.get_kv_dict(skey_path) == {}:
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
now = datetime.strftime(datetime.now(), '%Y-%m-%d_%H-%M-%S')
|
now = datetime.strftime(datetime.now(), '%Y-%m-%d_%H-%M-%S')
|
||||||
skeyuid = ''.join(str(uuid.uuid4()).split('-'))
|
skeyuid = ''.join(str(uuid.uuid4()).split('-'))
|
||||||
consul_kv.put_kv(skey_path,{'sk':skeyuid})
|
consul_kv.put_kv(skey_path + 'skey',{'sk':skeyuid})
|
||||||
consul_kv.put_kv(skey_path + now,{'sk':skeyuid})
|
consul_kv.put_kv(f'{skey_path}bak-skey{now}',{'sk':skeyuid})
|
||||||
|
logger.warning(f"【初始化SKey完成】")
|
||||||
|
|
||||||
from views import login, blackbox, consul, jobs, nodes, selfnode, selfrds, selfredis, avd, exp, jms, edit_cloud, ldap, rds, redis
|
from views import login, blackbox, consul, jobs, nodes, selfnode, selfrds, selfredis, avd, exp, jms, edit_cloud, ldap, rds, redis
|
||||||
from views.prom import cloud_metrics
|
from views.prom import cloud_metrics
|
||||||
|
|
|
@ -4,6 +4,20 @@ from units.config_log import *
|
||||||
|
|
||||||
headers = {'X-Consul-Token': consul_token}
|
headers = {'X-Consul-Token': consul_token}
|
||||||
|
|
||||||
|
def get_consul_ver():
|
||||||
|
url = f'{consul_url}/operator/autopilot/state'
|
||||||
|
response = requests.get(url, headers=headers, timeout=2)
|
||||||
|
response.encoding='utf-8'
|
||||||
|
if response.status_code == 200:
|
||||||
|
logger.info(f'【consul】请求成功, 认证成功: {consul_url} ')
|
||||||
|
return True
|
||||||
|
elif response.status_code == 403:
|
||||||
|
logger.error(f'【consul】连接正常: {consul_url}【认证失败】请检查consul token!')
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
logger.error(f'【consul】连接失败 {response.status_code}: {consul_url}, 请检查consul状态以及网络是否正常!')
|
||||||
|
return False
|
||||||
|
|
||||||
def get_hosts():
|
def get_hosts():
|
||||||
url = f'{consul_url}/agent/host'
|
url = f'{consul_url}/agent/host'
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers)
|
||||||
|
|
|
@ -46,7 +46,7 @@ Object.keys(filters).forEach(key => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
Vue.prototype.VER = 'v1.0.1'
|
Vue.prototype.VER = 'v1.0.2'
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
|
|
|
@ -7,6 +7,15 @@
|
||||||
<el-link :underline="false" type="primary" href="https://github.com/starsliao/TenSunS" target="_blank" class="dashboard-text">🚀StarsL.cn</el-link>
|
<el-link :underline="false" type="primary" href="https://github.com/starsliao/TenSunS" target="_blank" class="dashboard-text">🚀StarsL.cn</el-link>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
<el-timeline>
|
<el-timeline>
|
||||||
|
<el-timeline-item timestamp="2023/10/10" placement="top">
|
||||||
|
<el-card>
|
||||||
|
<h4>v1.0.2</h4>
|
||||||
|
<p>修复K8S部署consul无法持久化KV信息的bug<el-link :underline="false" type="primary" href="https://github.com/starsliao/TenSunS/tree/main/install/k8s" target="_blank">【查看明细】</el-link></p>
|
||||||
|
<p>修复同步阿里云Redis实例报错"失败:'EndTime'"的bug</p>
|
||||||
|
<p>修复采集RDS会采集到非MySql数据库的bug</p>
|
||||||
|
<p>优化启动后端检查consul状态和初始化skey的逻辑</p>
|
||||||
|
</el-card>
|
||||||
|
</el-timeline-item>
|
||||||
<el-timeline-item timestamp="2023/08/01" placement="top">
|
<el-timeline-item timestamp="2023/08/01" placement="top">
|
||||||
<el-card>
|
<el-card>
|
||||||
<h4>v1.0.1</h4>
|
<h4>v1.0.1</h4>
|
||||||
|
|
Loading…
Reference in New Issue