close #16 v0.6.2已发布,增加同步阿里云ECS标签功能。

pull/24/head
StarsL.cn 2022-06-16 02:05:06 +08:00
parent c8db45e85a
commit 609feb2770
7 changed files with 24 additions and 5 deletions

View File

@ -39,6 +39,8 @@ def get_avd():
f"- 类型:{avd_dict['avd_type']}\n" \
f"- 披露:{avd_dict['avd_time']}\n" \
f"- 状态:<font color=\"#ff0000\">{avd_dict['avd_stat']}</font>({avd_dict['avd_collect']})\n"
if avd_dict['avd_id'] == last_avd.get('avd_id'):
content = content + '(已披露漏洞,今日推送为状态或类型有更新。)\n'
if avd_switch['switch'] and avd_switch['wecom'] and wecomwh.startswith('https://qyapi.weixin.qq.com'):
wecom(wecomwh,content)
if avd_switch['switch'] and avd_switch['dingding'] and dingdingwh.startswith('https://oapi.dingtalk.com'):
@ -49,6 +51,8 @@ def get_avd():
f"类型:{avd_dict['avd_type']}\n" \
f"披露:{avd_dict['avd_time']}\n" \
f"状态:**{avd_dict['avd_stat']}**({avd_dict['avd_collect']})"
if avd_dict['avd_id'] == last_avd.get('avd_id'):
md = md + '\n(已披露漏洞,今日推送为状态或类型有更新。)'
feishu(feishuwh,title,md)
def wecom(webhook,content):

View File

@ -63,7 +63,7 @@ def ecs(account,region):
'name':i['InstanceName'],'group':group_dict.get(i['ResourceGroupId'],''),'ostype':i['OSType'].lower(),
'status':i['Status'],'region':region,
'ip':i["InnerIpAddress"]["IpAddress"] if len(i["InnerIpAddress"]["IpAddress"]) != 0 else i['NetworkInterfaces']['NetworkInterface'][0]['PrimaryIpAddress'],
'cpu':f"{i['Cpu']}",'mem':f"{str(round(i['Memory']/1024,1)).rstrip('.0')}GB",'exp':i['ExpiredTime'].split('T')[0]
'cpu':f"{i['Cpu']}",'mem':f"{str(round(i['Memory']/1024,1)).rstrip('.0')}GB",'exp':i['ExpiredTime'].split('T')[0],'ecstag': i.get('Tags',{}).get('Tag',[])
}for i in ecs_list}
ecs_dict.update(ecs_dict_temp)
next_token = ecs.body.next_token

View File

@ -61,6 +61,12 @@ def w2consul(vendor,account,region,ecs_dict):
"interval": "60s"
}
}
if vendor == 'alicloud' and v['ecstag'] != []:
ecstag_dict = {}
for ecstag in v['ecstag']:
if ecstag['TagKey'].encode().isalnum():
ecstag_dict[ecstag['TagKey']] = ecstag['TagValue']
data['Meta'].update(ecstag_dict)
reg = requests.put(puturl, headers=headers, data=json.dumps(data))
if reg.status_code == 200:
pass

View File

@ -115,7 +115,7 @@
<el-autocomplete v-model="temp.env" :fetch-suggestions="Sugg_env" placeholder="优先选择" clearable class="filter-item" />
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="temp.name" placeholder="请输入" clearable class="filter-item" /><font size="2" color="#ff0000">5</font>
<el-input v-model="temp.name" placeholder="请输入" clearable class="filter-item" /><font size="3px" color="#ff0000">5!</font>
</el-form-item>
<el-form-item prop="instance">
<span slot="label">

View File

@ -4,6 +4,14 @@
<el-link :underline="false" type="primary" icon="el-icon-star-on" href="https://github.com/starsliao/ConsulManager" target="_blank" class="dashboard-text">StarsL.cn</el-link>
</el-badge>
<el-timeline>
<el-timeline-item timestamp="2022/6/16" placement="top">
<el-card>
<h4>v0.6.2</h4>
<p>已披露的漏洞有状态或类型更新再次推送时候增加了提示</p>
<p>同步阿里云ECS支持同步ECS的标签到Consul的meta中注意标签的key有中文或符号会忽略因为meta的key不支持</p>
<p>自建主机的新增页面优化了描述和提交处理逻辑</p>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="2022/6/13" placement="top">
<el-card>
<h4>v0.6.1</h4>

View File

@ -3,8 +3,8 @@
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
<div class="title-container" style="text-align:center">
<img src="../../assets/login_images/SLH.png" width="90" height="90">
<h3 style="font-size:35px" class="title">Consul Manager</h3>
<img src="../../assets/login_images/SLH.png" width="90" height="90"><br><br>
<h3 style="font-size:35px" class="title">Consul Manager</h3><br>
</div>
<el-form-item prop="username">
@ -46,7 +46,7 @@
</el-form>
<div align="center" class="title-container">
<span style="font-size:12px" class="title">v0.6.1</span>
<span style="font-size:12px" class="title">v0.6.2</span>
</div>
</div>
</template>

View File

@ -96,6 +96,7 @@
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="37%">
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="right" label-width="auto" style="width: 90%; margin-left: 20px;">
<font size="3px" color="#ff0000">注意前5个字段组合后需唯一重复会覆盖已有监控项!</font>
<el-form-item label="机房/公司" prop="vendor">
<el-autocomplete v-model="temp.vendor" :fetch-suggestions="Sugg_vendor" placeholder="优先选择" clearable class="filter-item" />
</el-form-item>