Skip to content

Commit d4301c1

Browse files
committed
zabbix 钩子接入完成
1 parent 0089262 commit d4301c1

3 files changed

Lines changed: 41 additions & 58 deletions

File tree

src/router/routers.js

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -163,36 +163,36 @@ export const routerMap = [{
163163
]
164164
},
165165
// 项目发布
166-
{
167-
path: '/publish_project',
168-
name: 'publish_project',
169-
meta: {
170-
icon: 'ios-boat-outline',
171-
title: '项目发布'
172-
},
173-
component: Main,
174-
children: [{
175-
path: 'publish_list',
176-
name: 'publish_list',
177-
meta: {
178-
icon: 'ios-stats',
179-
title: '发布列表'
180-
},
181-
component: () =>
182-
import ('@/view/publish-store/publish-list.vue')
183-
},
184-
{
185-
path: 'create_project',
186-
name: 'create_project',
187-
meta: {
188-
icon: 'ios-plane',
189-
title: '创建项目'
190-
},
191-
component: () =>
192-
import ('@/view/publish-store/project-create.vue')
193-
}
194-
]
195-
},
166+
// {
167+
// path: '/publish_project',
168+
// name: 'publish_project',
169+
// meta: {
170+
// icon: 'ios-boat-outline',
171+
// title: '项目发布'
172+
// },
173+
// component: Main,
174+
// children: [{
175+
// path: 'publish_list',
176+
// name: 'publish_list',
177+
// meta: {
178+
// icon: 'ios-stats',
179+
// title: '发布列表'
180+
// },
181+
// component: () =>
182+
// import ('@/view/publish-store/publish-list.vue')
183+
// },
184+
// {
185+
// path: 'create_project',
186+
// name: 'create_project',
187+
// meta: {
188+
// icon: 'ios-plane',
189+
// title: '创建项目'
190+
// },
191+
// component: () =>
192+
// import ('@/view/publish-store/project-create.vue')
193+
// }
194+
// ]
195+
// },
196196
{
197197
path: '/cmdb',
198198
name: 'cmdb',
@@ -495,18 +495,7 @@ export const routerMap = [{
495495
title: '运维工具'
496496
},
497497
component: Main,
498-
children: [
499-
// {
500-
// path: 'prometheus_alert',
501-
// name: 'prometheus_alert',
502-
// meta: {
503-
// icon: 'ios-alert',
504-
// title: '告警管理'
505-
// },
506-
// component: () =>
507-
// import ('@/view/devops-tools/prometheus-alert.vue')
508-
// },
509-
{
498+
children: [{
510499
path: 'paid_reminder',
511500
name: 'paid_reminder',
512501
meta: {

src/view/cmdb2/server_mg.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
placeholder="公网IP"
7676
></Input>
7777
</FormItem>
78-
<FormItem label="端口" prop="port">
78+
<FormItem label="端口">
7979
<!-- <InputNumber :max="65535" :min="1" v-model="formValidate.port"></InputNumber> -->
8080
<Input v-model="formValidate.port" :maxlength="5" placeholder="端口"></Input>
8181
</FormItem>
@@ -182,7 +182,7 @@ export default {
182182
hostname: "",
183183
ip: "",
184184
public_ip:'',
185-
port: '',
185+
port: "22",
186186
region: "",
187187
admin_user: "",
188188
tag_list: [],
@@ -601,7 +601,7 @@ export default {
601601
this.formValidate = {
602602
hostname: '',
603603
ip: "",
604-
port: "",
604+
port: "22",
605605
admin_user: "",
606606
idc: "",
607607
region: "",

src/view/devops-tools/zabbix-mg.vue

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,11 @@
9090
<Form v-if="addHookForm" ref="formZabbixHostsHook" :model="formZabbixHostsHook" :rules="ruleZabbixHostHook" :label-width="90">
9191
<FormItem label="告警标题" prop="alert_title">
9292
<Alert type="success">
93-
<p>【解释】:ZABBIX WebHooks告警传来的告警标题,如:Zabbix agent on Zabbix server is unreachable for 5 minutes</p>
93+
<p>【解释】:ZABBIX WebHooks告警传来的告警标题,如:Zabbix agent on Zabbix server is unreachable for 5 minutes。匹配标题触发钩子</p>
9494
</Alert>
9595
<Input v-model="formZabbixHostsHook.alert_title"></Input>
9696
</FormItem>
9797
<FormItem label="审批/自动">
98-
<Alert type="success">
99-
<p>【解释】:自动执行:不需要审批和定时,直接执行。审批执行则需要有模板权限的人来审批或者设置定时执行</p>
100-
</Alert>
10198
<RadioGroup v-model="formZabbixHostsHook.schedule">
10299
<Radio label="ready">自动执行</Radio>
103100
<Radio label="new"> 审批执行</Radio>
@@ -113,15 +110,12 @@
113110
</Select>
114111
</FormItem>
115112

116-
<FormItem label="参数字典">
113+
<FormItem label="执行主机">
117114
<Alert type="success">
118-
<p>【解释】:任务命令中使用的参数,必须json格式的。例如: {"hosts_dict": {"1":"127.0.0.1","2":"192.168.1.2", "MAILTO": "191715030@qq.com"}}
119-
hosts_dict 指每组任务在那些主机上执行。默认 {"hosts_dict": {"1": "127.0.0.1"}}
120-
</p>
115+
<p>【解释】:任务在那台主机上执行,默认为第一组,主机:127.0.0.1</p>
121116
</Alert>
122-
<Input v-model="formZabbixHostsHook.hook_args" :maxlength=255 type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="字典格式的参数信息"></Input>
117+
<Input v-model="formZabbixHostsHook.exec_host" :maxlength=50 type="text" placeholder="任务会在执行主机上执行"></Input>
123118
</FormItem>
124-
125119
<FormItem>
126120
<Button type="primary" @click="addZabbixHostHookSubmit('formZabbixHostsHook')">保存</Button>
127121
</FormItem>
@@ -185,7 +179,7 @@
185179
},
186180
formZabbixHostsHook: {
187181
alert_title: '',
188-
hook_args: '',
182+
exec_host: '127.0.0.1',
189183
schedule: 'ready',
190184
temp_id: '',
191185
},
@@ -277,7 +271,7 @@
277271
const ZabbixHooks = JSON.parse(this.hostInfo.zabbix_hooks)
278272
this.formZabbixHostsHook = ZabbixHooks[params.row.alert_title]
279273
this.formZabbixHostsHook['alert_title'] = params.row.alert_title
280-
this.formZabbixHostsHook['hook_args'] = JSON.stringify(this.formZabbixHostsHook['hook_args'])
274+
// this.formZabbixHostsHook['exec_host'] = JSON.stringify(this.formZabbixHostsHook['exec_host'])
281275
}
282276
}
283277
},
@@ -765,7 +759,7 @@
765759
this.addHookForm = false
766760
this.formZabbixHostsHook = {
767761
alert_title: '',
768-
hook_args: '',
762+
exec_host: '127.0.0.1',
769763
schedule: 'ready',
770764
temp_id: '',
771765
}

0 commit comments

Comments
 (0)