Skip to content

Commit

Permalink
zabbix 钩子接入完成
Browse files Browse the repository at this point in the history
  • Loading branch information
ss1917 committed Jul 19, 2019
1 parent 0089262 commit d4301c1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 58 deletions.
73 changes: 31 additions & 42 deletions src/router/routers.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,36 +163,36 @@ export const routerMap = [{
]
},
// 项目发布
{
path: '/publish_project',
name: 'publish_project',
meta: {
icon: 'ios-boat-outline',
title: '项目发布'
},
component: Main,
children: [{
path: 'publish_list',
name: 'publish_list',
meta: {
icon: 'ios-stats',
title: '发布列表'
},
component: () =>
import ('@/view/publish-store/publish-list.vue')
},
{
path: 'create_project',
name: 'create_project',
meta: {
icon: 'ios-plane',
title: '创建项目'
},
component: () =>
import ('@/view/publish-store/project-create.vue')
}
]
},
// {
// path: '/publish_project',
// name: 'publish_project',
// meta: {
// icon: 'ios-boat-outline',
// title: '项目发布'
// },
// component: Main,
// children: [{
// path: 'publish_list',
// name: 'publish_list',
// meta: {
// icon: 'ios-stats',
// title: '发布列表'
// },
// component: () =>
// import ('@/view/publish-store/publish-list.vue')
// },
// {
// path: 'create_project',
// name: 'create_project',
// meta: {
// icon: 'ios-plane',
// title: '创建项目'
// },
// component: () =>
// import ('@/view/publish-store/project-create.vue')
// }
// ]
// },
{
path: '/cmdb',
name: 'cmdb',
Expand Down Expand Up @@ -495,18 +495,7 @@ export const routerMap = [{
title: '运维工具'
},
component: Main,
children: [
// {
// path: 'prometheus_alert',
// name: 'prometheus_alert',
// meta: {
// icon: 'ios-alert',
// title: '告警管理'
// },
// component: () =>
// import ('@/view/devops-tools/prometheus-alert.vue')
// },
{
children: [{
path: 'paid_reminder',
name: 'paid_reminder',
meta: {
Expand Down
6 changes: 3 additions & 3 deletions src/view/cmdb2/server_mg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
placeholder="公网IP"
></Input>
</FormItem>
<FormItem label="端口" prop="port">
<FormItem label="端口">
<!-- <InputNumber :max="65535" :min="1" v-model="formValidate.port"></InputNumber> -->
<Input v-model="formValidate.port" :maxlength="5" placeholder="端口"></Input>
</FormItem>
Expand Down Expand Up @@ -182,7 +182,7 @@ export default {
hostname: "",
ip: "",
public_ip:'',
port: '',
port: "22",
region: "",
admin_user: "",
tag_list: [],
Expand Down Expand Up @@ -601,7 +601,7 @@ export default {
this.formValidate = {
hostname: '',
ip: "",
port: "",
port: "22",
admin_user: "",
idc: "",
region: "",
Expand Down
20 changes: 7 additions & 13 deletions src/view/devops-tools/zabbix-mg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,11 @@
<Form v-if="addHookForm" ref="formZabbixHostsHook" :model="formZabbixHostsHook" :rules="ruleZabbixHostHook" :label-width="90">
<FormItem label="告警标题" prop="alert_title">
<Alert type="success">
<p>【解释】:ZABBIX WebHooks告警传来的告警标题,如:Zabbix agent on Zabbix server is unreachable for 5 minutes</p>
<p>【解释】:ZABBIX WebHooks告警传来的告警标题,如:Zabbix agent on Zabbix server is unreachable for 5 minutes。匹配标题触发钩子</p>
</Alert>
<Input v-model="formZabbixHostsHook.alert_title"></Input>
</FormItem>
<FormItem label="审批/自动">
<Alert type="success">
<p>【解释】:自动执行:不需要审批和定时,直接执行。审批执行则需要有模板权限的人来审批或者设置定时执行</p>
</Alert>
<RadioGroup v-model="formZabbixHostsHook.schedule">
<Radio label="ready">自动执行</Radio>
<Radio label="new"> 审批执行</Radio>
Expand All @@ -113,15 +110,12 @@
</Select>
</FormItem>

<FormItem label="参数字典">
<FormItem label="执行主机">
<Alert type="success">
<p>【解释】:任务命令中使用的参数,必须json格式的。例如: {"hosts_dict": {"1":"127.0.0.1","2":"192.168.1.2", "MAILTO": "[email protected]"}}
hosts_dict 指每组任务在那些主机上执行。默认 {"hosts_dict": {"1": "127.0.0.1"}}
</p>
<p>【解释】:任务在那台主机上执行,默认为第一组,主机:127.0.0.1</p>
</Alert>
<Input v-model="formZabbixHostsHook.hook_args" :maxlength=255 type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="字典格式的参数信息"></Input>
<Input v-model="formZabbixHostsHook.exec_host" :maxlength=50 type="text" placeholder="任务会在执行主机上执行"></Input>
</FormItem>

<FormItem>
<Button type="primary" @click="addZabbixHostHookSubmit('formZabbixHostsHook')">保存</Button>
</FormItem>
Expand Down Expand Up @@ -185,7 +179,7 @@
},
formZabbixHostsHook: {
alert_title: '',
hook_args: '',
exec_host: '127.0.0.1',
schedule: 'ready',
temp_id: '',
},
Expand Down Expand Up @@ -277,7 +271,7 @@
const ZabbixHooks = JSON.parse(this.hostInfo.zabbix_hooks)
this.formZabbixHostsHook = ZabbixHooks[params.row.alert_title]
this.formZabbixHostsHook['alert_title'] = params.row.alert_title
this.formZabbixHostsHook['hook_args'] = JSON.stringify(this.formZabbixHostsHook['hook_args'])
// this.formZabbixHostsHook['exec_host'] = JSON.stringify(this.formZabbixHostsHook['exec_host'])
}
}
},
Expand Down Expand Up @@ -765,7 +759,7 @@
this.addHookForm = false
this.formZabbixHostsHook = {
alert_title: '',
hook_args: '',
exec_host: '127.0.0.1',
schedule: 'ready',
temp_id: '',
}
Expand Down

0 comments on commit d4301c1

Please sign in to comment.