Releases 0.12.0,fix bug
parent
2d18a54ce8
commit
542be82169
|
@ -1,5 +1,6 @@
|
|||
import requests,json,consul_kv
|
||||
import requests,json,consul_kv,re
|
||||
from config import consul_token,consul_url
|
||||
from units.config_log import *
|
||||
|
||||
headers = {'X-Consul-Token': consul_token}
|
||||
init_module_list = ['http_2xx','http_4xx','tcp_connect','icmp','http200igssl','httpNoRedirect4ssl','http_5xx','http_post_2xx','ssh_banner']
|
||||
|
@ -24,6 +25,7 @@ def get_all_list(module,company,project,env):
|
|||
return {'code': 20000,'all_list':all_list,'module_list':module_list,
|
||||
'company_list':company_list,'project_list':project_list,'env_list':env_list}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
|
||||
def get_service():
|
||||
|
@ -42,10 +44,12 @@ def get_service():
|
|||
return {'code': 20000,'all_list':all_list,'module_list':module_list,
|
||||
'company_list':company_list,'project_list':project_list,'env_list':env_list}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
|
||||
def add_service(module,company,project,env,name,instance):
|
||||
sid = f"{module}/{company}/{project}/{env}@{name}"
|
||||
sid = f"{module}/{company}/{project}/{env}@{name}".strip()
|
||||
sid = re.sub('[[ \]`~!\\\#$^&*=|"{}\':;?\t\n]','_',sid)
|
||||
if '//' in sid or sid.startswith('/') or sid.endswith('/'):
|
||||
return {"code": 50000, "data": f"服务ID【{sid}】首尾不能包含'/',并且不能包含两个连续的'/'"}
|
||||
data = {
|
||||
|
@ -58,14 +62,18 @@ def add_service(module,company,project,env,name,instance):
|
|||
if reg.status_code == 200:
|
||||
return {"code": 20000, "data": f"【{sid}】增加成功!"}
|
||||
else:
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
||||
def del_service(module,company,project,env,name):
|
||||
sid = f"{module}/{company}/{project}/{env}@{name}"
|
||||
sid = f"{module}/{company}/{project}/{env}@{name}".strip()
|
||||
sid = re.sub('[[ \]`~!\\\#$^&*=|"{}\':;?\t\n]','_',sid)
|
||||
reg = requests.put(f'{consul_url}/agent/service/deregister/{sid}', headers=headers)
|
||||
if reg.status_code == 200:
|
||||
logger.debug(f"【{sid}】删除成功!")
|
||||
return {"code": 20000, "data": f"【{sid}】删除成功!"}
|
||||
else:
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
||||
def get_rules():
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import requests,json
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
import requests,json,re
|
||||
from config import consul_token,consul_url
|
||||
from units.config_log import *
|
||||
|
||||
|
@ -22,6 +20,7 @@ def get_hosts():
|
|||
'free':f'{round(info["Disk"]["free"]/1024**3)}GB','used':f'{round(info["Disk"]["used"]/1024**3)}GB','usedPercent':f'{pdisk}%'}
|
||||
return {'code': 20000,'host':host,'cpu':cpu,'memory':memory,'disk':disk, 'pmem':pmem, 'pdisk':pdisk}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
def get_services():
|
||||
url = f'{consul_url}/internal/ui/services'
|
||||
|
@ -40,6 +39,7 @@ def get_services_nameonly():
|
|||
info.pop('consul')
|
||||
return {'code': 20000,'services_name':list(info.keys())}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
def get_instances(service_name):
|
||||
url = f'{consul_url}/health/service/{service_name}'
|
||||
|
@ -68,17 +68,21 @@ def get_instances(service_name):
|
|||
instances_list.append(instance_dict)
|
||||
return {'code': 20000,'instances':instances_list}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
|
||||
def del_instance(service_id):
|
||||
reg = requests.put(f'{consul_url}/agent/service/deregister/{service_id}', headers=headers)
|
||||
def del_instance(sid):
|
||||
reg = requests.put(f'{consul_url}/agent/service/deregister/{sid}', headers=headers)
|
||||
if reg.status_code == 200:
|
||||
return {"code": 20000, "data": f"【{service_id}】删除成功!"}
|
||||
logger.debug(f"【{sid}】删除成功!")
|
||||
return {"code": 20000, "data": f"【{sid}】删除成功!"}
|
||||
else:
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{service_id}】{reg.text}"}
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
||||
def add_instance(instance_dict):
|
||||
sid = instance_dict['ID']
|
||||
sid = instance_dict['ID'].strip()
|
||||
sid = re.sub('[[ \]`~!\\\#$^&*=|"{}\':;?\t\n]','_',sid)
|
||||
if '//' in sid or sid.startswith('/') or sid.endswith('/'):
|
||||
return {"code": 50000, "data": f"服务ID【{sid}】首尾不能包含'/',并且不能包含两个连续的'/'"}
|
||||
isMeta = instance_dict['metaInfo']['isMeta']
|
||||
|
@ -119,5 +123,6 @@ def add_instance(instance_dict):
|
|||
if reg.status_code == 200:
|
||||
return {"code": 20000, "data": f"【{sid}】增加成功!"}
|
||||
else:
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import requests,json
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
import requests,json,re
|
||||
#import sys
|
||||
#sys.path.append("..")
|
||||
from config import consul_token,consul_url
|
||||
from units.config_log import *
|
||||
|
||||
|
@ -23,6 +23,7 @@ def get_all_list(vendor,account,region,group):
|
|||
return {'code': 20000,'all_list':all_list,'vendor_list':vendor_list,
|
||||
'account_list':account_list,'region_list':region_list,'group_list':group_list}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
|
||||
def get_service():
|
||||
|
@ -37,12 +38,14 @@ def get_service():
|
|||
return {'code': 20000,'all_list':all_list,'vendor_list':vendor_list,
|
||||
'account_list':account_list,'region_list':region_list,'group_list':group_list}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
|
||||
def add_service(vendor,account,region,group,name,ip,port,os):
|
||||
if port is None or name is None:
|
||||
return {"code": 50000, "data": f"名称或IP不能为空!"}
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}"
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}".strip()
|
||||
sid = re.sub('[[ \]`~!\\\#$^&*=|"{}\':;?\t\n]','_',sid)
|
||||
instance = f'{ip}:{port}'
|
||||
if '//' in sid or sid.startswith('/') or sid.endswith('/'):
|
||||
return {"code": 50000, "data": f"服务ID【{sid}】首尾不能包含'/',并且不能包含两个连续的'/'"}
|
||||
|
@ -60,14 +63,17 @@ def add_service(vendor,account,region,group,name,ip,port,os):
|
|||
if reg.status_code == 200:
|
||||
return {"code": 20000, "data": f"【{sid}】增加成功!"}
|
||||
else:
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
||||
def del_service(vendor,account,region,group,name):
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}"
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}".strip()
|
||||
sid = re.sub('[[ \]`~!\\\#$^&*=|"{}\':;?\t\n]','_',sid)
|
||||
reg = requests.put(f'{consul_url}/agent/service/deregister/{sid}', headers=headers)
|
||||
if reg.status_code == 200:
|
||||
logger.debug(f"【{sid}】删除成功!")
|
||||
return {"code": 20000, "data": f"【{sid}】删除成功!"}
|
||||
else:
|
||||
logger.info(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import requests,json
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
import requests,json,re
|
||||
from config import consul_token,consul_url
|
||||
from units.config_log import *
|
||||
headers = {'X-Consul-Token': consul_token}
|
||||
|
@ -22,6 +20,7 @@ def get_all_list(vendor,account,region,group):
|
|||
return {'code': 20000,'all_list':all_list,'vendor_list':vendor_list,
|
||||
'account_list':account_list,'region_list':region_list,'group_list':group_list}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
|
||||
def get_service():
|
||||
|
@ -36,14 +35,17 @@ def get_service():
|
|||
return {'code': 20000,'all_list':all_list,'vendor_list':vendor_list,
|
||||
'account_list':account_list,'region_list':region_list,'group_list':group_list}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
|
||||
def add_service(vendor,account,region,group,name,ip,port,os):
|
||||
if port is None or name is None:
|
||||
return {"code": 50000, "data": f"名称或IP不能为空!"}
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}"
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}".strip()
|
||||
#sid = eval(repr(sid).replace('\\t','').replace('\\n',''))
|
||||
sid = re.sub('[[ \]`~!\\\#$^&*=|"{}\':;?\t\n]','_',sid)+'@rds'
|
||||
instance = f'{ip}:{port}'
|
||||
if '//' in sid or sid.startswith('/') or sid.endswith('/'):
|
||||
if '//' in sid or sid.startswith('/'):
|
||||
return {"code": 50000, "data": f"服务ID【{sid}】首尾不能包含'/',并且不能包含两个连续的'/'"}
|
||||
data = {
|
||||
"id": sid,
|
||||
|
@ -59,14 +61,17 @@ def add_service(vendor,account,region,group,name,ip,port,os):
|
|||
if reg.status_code == 200:
|
||||
return {"code": 20000, "data": f"【{sid}】增加成功!"}
|
||||
else:
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
||||
def del_service(vendor,account,region,group,name):
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}"
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}".strip()
|
||||
sid = re.sub('[[ \]`~!\\\#$^&*=|"{}\':;?\t\n]','_',sid)+'@rds'
|
||||
reg = requests.put(f'{consul_url}/agent/service/deregister/{sid}', headers=headers)
|
||||
if reg.status_code == 200:
|
||||
logger.debug(f"【{sid}】删除成功!")
|
||||
return {"code": 20000, "data": f"【{sid}】删除成功!"}
|
||||
else:
|
||||
logger.info(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import requests,json
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
import requests,json,re
|
||||
from config import consul_token,consul_url
|
||||
from units.config_log import *
|
||||
headers = {'X-Consul-Token': consul_token}
|
||||
|
@ -22,6 +20,7 @@ def get_all_list(vendor,account,region,group):
|
|||
return {'code': 20000,'all_list':all_list,'vendor_list':vendor_list,
|
||||
'account_list':account_list,'region_list':region_list,'group_list':group_list}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
|
||||
def get_service():
|
||||
|
@ -36,14 +35,16 @@ def get_service():
|
|||
return {'code': 20000,'all_list':all_list,'vendor_list':vendor_list,
|
||||
'account_list':account_list,'region_list':region_list,'group_list':group_list}
|
||||
else:
|
||||
logger.error(f"{response.status_code}:{response.text}")
|
||||
return {'code': 50000, 'data': f'{response.status_code}:{response.text}'}
|
||||
|
||||
def add_service(vendor,account,region,group,name,ip,port,os):
|
||||
if port is None or name is None:
|
||||
return {"code": 50000, "data": f"名称或IP不能为空!"}
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}"
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}".strip()
|
||||
sid = re.sub('[[ \]`~!\\\#$^&*=|"{}\':;?\t\n]','_',sid)+'@redis'
|
||||
instance = f'{ip}:{port}'
|
||||
if '//' in sid or sid.startswith('/') or sid.endswith('/'):
|
||||
if '//' in sid or sid.startswith('/'):
|
||||
return {"code": 50000, "data": f"服务ID【{sid}】首尾不能包含'/',并且不能包含两个连续的'/'"}
|
||||
data = {
|
||||
"id": sid,
|
||||
|
@ -59,13 +60,16 @@ def add_service(vendor,account,region,group,name,ip,port,os):
|
|||
if reg.status_code == 200:
|
||||
return {"code": 20000, "data": f"【{sid}】增加成功!"}
|
||||
else:
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
||||
def del_service(vendor,account,region,group,name):
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}"
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}".strip()
|
||||
sid = re.sub('[[ \]`~!\\\#$^&*=|"{}\':;?\t\n]','_',sid)+'@redis'
|
||||
reg = requests.put(f'{consul_url}/agent/service/deregister/{sid}', headers=headers)
|
||||
if reg.status_code == 200:
|
||||
logger.debug(f"【{sid}】删除成功!")
|
||||
return {"code": 20000, "data": f"【{sid}】删除成功!"}
|
||||
else:
|
||||
logger.info(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
logger.error(f"{reg.status_code}【{sid}】{reg.text}")
|
||||
return {"code": 50000, "data": f"{reg.status_code}【{sid}】{reg.text}"}
|
||||
|
|
|
@ -35,7 +35,7 @@ def importconsul(row,imptype):
|
|||
elif imptype == 'selfrds':
|
||||
vendor,account,region,group,name,instance,os = row
|
||||
logger.info(row)
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}"
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}@rds"
|
||||
ip = instance.split(':')[0]
|
||||
port = instance.split(':')[1]
|
||||
data = {
|
||||
|
@ -51,7 +51,7 @@ def importconsul(row,imptype):
|
|||
elif imptype == 'selfredis':
|
||||
vendor,account,region,group,name,instance,os = row
|
||||
logger.info(row)
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}"
|
||||
sid = f"{vendor}/{account}/{region}/{group}@{name}@redis"
|
||||
ip = instance.split(':')[0]
|
||||
port = instance.split(':')[1]
|
||||
data = {
|
||||
|
@ -96,7 +96,7 @@ def read_execl(file_contents,imptype):
|
|||
j = i.strip()
|
||||
j = '_' if j == '' else j
|
||||
if i != row[5]:
|
||||
j = re.sub('[[ \]`~!\\\#$^/&*=|"{}\':;?]','_',j)
|
||||
j = re.sub('[[ \]`~!\\\#$^/&*=|"{}\':;?\t\n]','_',j)
|
||||
nrow.append(j)
|
||||
imp = importconsul(nrow,imptype)
|
||||
if imp['code'] == 50000:
|
||||
|
|
|
@ -46,7 +46,7 @@ Object.keys(filters).forEach(key => {
|
|||
})
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.prototype.VER = 'v0.11.2'
|
||||
Vue.prototype.VER = 'v0.12.0'
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
|
|
|
@ -7,6 +7,24 @@
|
|||
<el-link :underline="false" type="primary" href="https://github.com/starsliao/ConsulManager" target="_blank" class="dashboard-text">🚀StarsL.cn</el-link>
|
||||
</el-badge>
|
||||
<el-timeline>
|
||||
<el-timeline-item timestamp="2022/12/12" placement="top">
|
||||
<el-card>
|
||||
<h4>v0.12.0</h4>
|
||||
<p><el-button type="primary" size="mini" icon="el-icon-star-off" circle />修复:自建ECS/RDS/Redis:增加同SID(前5个字段相同)的实例导致,之前增加的同SID实例被替换掉的问题。</p>
|
||||
<p><el-button type="primary" size="mini" icon="el-icon-star-off" circle />修复:站点与接口监控、自建ECS/RDS/Redis:实例字段中有特殊字符会无法删除的问题。</p>
|
||||
<p> <strong>以上2个改动可能会引起上述菜单功能兼容性问题:如果出现更新或删除自定义实例失败,请执行以下操作:</strong></p>
|
||||
<ul>
|
||||
<li>在相应的实例管理页面,使用导出功能导出实例列表。</li>
|
||||
<li>进入<strong>Consul管理-实例管理</strong>菜单,选择相应的服务组,全选删除所有的实例。</li>
|
||||
<li>再返回相应的实例管理页面,重新执行导入操作。</li>
|
||||
</ul>
|
||||
<p><el-button type="success" size="mini" icon="el-icon-star-off" circle />优化:<el-link :underline="false" type="primary" href="https://grafana.com/grafana/dashboards/17320-1-mysqld-exporter-dashboard/" target="_blank">Mysqld Exporter Grafana Dashboard</el-link>,兼容自建MySQL与云RDS,都能正常展示CPU、内存、磁盘等部分Mysqld_Exporter不提供的指标:</p>
|
||||
<ul>
|
||||
<li>自建Mysql:从node-exporter中获取以上信息,通过instance的IP部分进行关联。</li>
|
||||
<li>云DRS:从ConsulManager-MySQL中获取,会根据实例ID进行关联。(数据来自云监控,从ConsulManager的Prometheus配置生成菜单中可生成配置。)</li>
|
||||
</ul>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
<el-timeline-item timestamp="2022/11/28" placement="top">
|
||||
<el-card>
|
||||
<h4>v0.11.1</h4>
|
||||
|
@ -237,4 +255,7 @@ export default {
|
|||
line-height: 46px;
|
||||
}
|
||||
}
|
||||
li {
|
||||
margin: 20px 0;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue