Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangqinghua
smart
Commits
d81c8f47
Commit
d81c8f47
authored
Nov 22, 2018
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
网站监测
parent
6031f40d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
141 additions
and
95 deletions
+141
-95
alarm-set.component.html
src/main/webapp/app/alarm/alarm-set/alarm-set.component.html
+2
-2
alarm.service.ts
src/main/webapp/app/alarm/alarm.service.ts
+6
-0
alarm-modal.component.html
...n/webapp/app/modal/alarm-modal/alarm-modal.component.html
+68
-68
alarm-modal.component.ts
...ain/webapp/app/modal/alarm-modal/alarm-modal.component.ts
+65
-25
No files found.
src/main/webapp/app/alarm/alarm-set/alarm-set.component.html
View file @
d81c8f47
...
...
@@ -75,4 +75,4 @@
<smart-alarm-group
#
smartAlarmGroup
(
add
)="
getGroupAlarm
()"
></smart-alarm-group>
<!--新增告警推送-->
<smart-alarm-modal
#
smartAlarmModal
></smart-alarm-modal>
\ No newline at end of file
<smart-alarm-modal
#
smartAlarmModal
(
done
)="
getList
()"
></smart-alarm-modal>
\ No newline at end of file
src/main/webapp/app/alarm/alarm.service.ts
View file @
d81c8f47
...
...
@@ -113,4 +113,9 @@ export class AlarmService {
getMediaType
(
params
):
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL
+
'/mediaType/find/'
+
params
);
}
//查找告警目标
findAlertTarget
():
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL
+
'/action/findAlertTarget'
);
}
}
\ No newline at end of file
src/main/webapp/app/modal/alarm-modal/alarm-modal.component.html
View file @
d81c8f47
...
...
@@ -30,10 +30,12 @@
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzFor=
"serviceid"
>
告警分组
</nz-form-label>
<nz-form-label
[
nzSpan
]="
4
"
nz
Required
nz
For=
"serviceid"
>
告警分组
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<nz-select
name=
"serviceid"
nzPlaceHolder=
"告警分组"
[(
ngModel
)]="
validateForm
.
alertGroupId
"
>
<nz-option
nzValue=
""
nzLabel=
"无"
></nz-option>
<ng-container
*
ngFor=
"let item of groupList;let i = index;"
>
<nz-option
nzLabel=
"{{item.name}}"
nzValue=
"{{item.id}}"
></nz-option>
</ng-container>
</nz-select>
</nz-form-control>
</nz-form-item>
...
...
@@ -57,62 +59,62 @@
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzRequired
nzFor=
"host"
>
监测点状态
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<label
nz-checkbox
>
严重
</label>
<label
nz-checkbox
>
告警
</label>
<label
nz-checkbox
[(
ngModel
)]="
validateForm
.
serious
"
>
严重
</label>
<label
nz-checkbox
[(
ngModel
)]="
validateForm
.
warn
"
>
告警
</label>
</nz-form-control>
</nz-form-item>
<
nz-form-item
>
<
nz-form-label
[
nzSpan
]="
4
"
nzRequired
nzFor=
"host1"
>
时间条件
</nz-form-label
>
<
nz-form-control
[
nzSpan
]="
20
"
>
<
div
nz-row
[
nzGutter
]="
12
"
>
<
nz-form-control
nz-col
[
nzSpan
]="
3
"
>
<
nz-select
name=
"main"
>
<
nz-option
nzValue=
"1"
nzLabel=
"属于"
></nz-option
>
<
nz-option
nzValue=
"0"
nzLabel=
"不属于"
></nz-option
>
<
/nz-select
>
<
/nz-form-control
>
<
nz-form-control
nz-col
[
nzSpan
]="
4
"
>
<
nz-select
name=
"type"
nzPlaceHolder=
"日期"
>
<
nz-option
nzValue=
"1"
nzLabel=
"周一"
></nz-option
>
<
nz-option
nzValue=
"2"
nzLabel=
"周二"
></nz-option
>
<
nz-option
nzValue=
"3"
nzLabel=
"周三"
></nz-option
>
<
nz-option
nzValue=
"4"
nzLabel=
"周四"
></nz-option
>
<
nz-option
nzValue=
"5"
nzLabel=
"周五"
></nz-option
>
<
nz-option
nzValue=
"6"
nzLabel=
"周六"
></nz-option
>
<
nz-option
nzValue=
"7"
nzLabel=
"周日"
></nz-option
>
<
/nz-select
>
<
/nz-form-control
>
<
nz-form-control
nz-col
[
nzSpan
]="
1
"
>
~
<
/nz-form-control
>
<
nz-form-control
nz-col
[
nzSpan
]="
4
"
>
<
nz-select
name=
"type"
nzPlaceHolder=
"日期"
>
<
nz-option
nzValue=
"1"
nzLabel=
"周一"
></nz-option
>
<
nz-option
nzValue=
"2"
nzLabel=
"周二"
></nz-option
>
<
nz-option
nzValue=
"3"
nzLabel=
"周三"
></nz-option
>
<
nz-option
nzValue=
"4"
nzLabel=
"周四"
></nz-option
>
<
nz-option
nzValue=
"5"
nzLabel=
"周五"
></nz-option
>
<
nz-option
nzValue=
"6"
nzLabel=
"周六"
></nz-option
>
<
nz-option
nzValue=
"7"
nzLabel=
"周日"
></nz-option
>
<
/nz-select
>
<
/nz-form-control
>
<
nz-form-control
nz-col
[
nzSpan
]="
3
"
>
<
input
type=
"text"
nz-input
name=
"port"
>
<
/nz-form-control
>
<
nz-form-control
nz-col
[
nzSpan
]="
1
"
>
~
<
/nz-form-control
>
<
nz-form-control
nz-col
[
nzSpan
]="
3
"
>
<
input
type=
"text"
nz-input
name=
"port"
>
<
/nz-form-control
>
<
nz-form-control
nz-col
[
nzSpan
]="
2
"
>
<
span
class=
"cursor"
>
X
</span
>
<
/nz-form-control
>
<
/div
>
<
button
nz-button
nzType=
"default"
>
添加
</button
>
<
/nz-form-control
>
<
/nz-form-item
>
<
!--<nz-form-item>--
>
<
!--<nz-form-label [nzSpan]="4" nzRequired nzFor="host1">时间条件</nz-form-label>--
>
<
!--<nz-form-control [nzSpan]="20">--
>
<
!--<div nz-row [nzGutter]="12">--
>
<
!--<nz-form-control nz-col [nzSpan]="3">--
>
<
!--<nz-select name="main">--
>
<
!--<nz-option nzValue="1" nzLabel="属于"></nz-option>--
>
<
!--<nz-option nzValue="0" nzLabel="不属于"></nz-option>--
>
<
!--</nz-select>--
>
<
!--</nz-form-control>--
>
<
!--<nz-form-control nz-col [nzSpan]="4">--
>
<
!--<nz-select name="type" nzPlaceHolder="日期">--
>
<
!--<nz-option nzValue="1" nzLabel="周一"></nz-option>--
>
<
!--<nz-option nzValue="2" nzLabel="周二"></nz-option>--
>
<
!--<nz-option nzValue="3" nzLabel="周三"></nz-option>--
>
<
!--<nz-option nzValue="4" nzLabel="周四"></nz-option>--
>
<
!--<nz-option nzValue="5" nzLabel="周五"></nz-option>--
>
<
!--<nz-option nzValue="6" nzLabel="周六"></nz-option>--
>
<
!--<nz-option nzValue="7" nzLabel="周日"></nz-option>--
>
<
!--</nz-select>--
>
<
!--</nz-form-control>--
>
<
!--<nz-form-control nz-col [nzSpan]="1">--
>
<!--~-->
<
!--</nz-form-control>--
>
<
!--<nz-form-control nz-col [nzSpan]="4">--
>
<
!--<nz-select name="type" nzPlaceHolder="日期">--
>
<
!--<nz-option nzValue="1" nzLabel="周一"></nz-option>--
>
<
!--<nz-option nzValue="2" nzLabel="周二"></nz-option>--
>
<
!--<nz-option nzValue="3" nzLabel="周三"></nz-option>--
>
<
!--<nz-option nzValue="4" nzLabel="周四"></nz-option>--
>
<
!--<nz-option nzValue="5" nzLabel="周五"></nz-option>--
>
<
!--<nz-option nzValue="6" nzLabel="周六"></nz-option>--
>
<
!--<nz-option nzValue="7" nzLabel="周日"></nz-option>--
>
<
!--</nz-select>--
>
<
!--</nz-form-control>--
>
<
!--<nz-form-control nz-col [nzSpan]="3">--
>
<
!--<input type="text" nz-input name="port">--
>
<
!--</nz-form-control>--
>
<
!--<nz-form-control nz-col [nzSpan]="1">--
>
<!--~-->
<
!--</nz-form-control>--
>
<
!--<nz-form-control nz-col [nzSpan]="3">--
>
<
!--<input type="text" nz-input name="port">--
>
<
!--</nz-form-control>--
>
<
!--<nz-form-control nz-col [nzSpan]="2">--
>
<
!--<span class="cursor">X</span>--
>
<
!--</nz-form-control>--
>
<
!--</div>--
>
<
!--<button nz-button nzType="default">添加</button>--
>
<
!--</nz-form-control>--
>
<
!--</nz-form-item>--
>
<!--<nz-form-item>-->
...
...
@@ -184,37 +186,39 @@
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzRequired
nzFor=
"host1"
>
发送对象
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<button
(
click
)="
showUserModa
()"
nz-button
nzType=
"primary"
>
选择
</button>
<span>
{{userObj.alias}}
</span>
<nz-select
name=
"templates"
style=
"width: 100%"
[(
ngModel
)]="
validateForm
.
userIds
"
nzMode=
"tags"
nzPlaceHolder=
"选择发送对象"
>
<nz-option
*
ngFor=
"let option of objList"
[
nzLabel
]="
option
.
alias
"
[
nzValue
]="
option
.
userid
"
></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzFor=
"serviceid"
>
发送信息
</nz-form-label>
<nz-form-label
[
nzSpan
]="
4
"
nz
Required
nz
For=
"serviceid"
>
发送信息
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<textarea
nz-input
placeholder=
"发送信息"
[
nzAutosize
]="{
minRows:
2
,
maxRows:
6
}"
></textarea>
<textarea
nz-input
placeholder=
"发送信息"
[
nzAutosize
]="{
minRows:
2
,
maxRows:
6
}"
[(
ngModel
)]="
validateForm
.
def_longdata
"
></textarea>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzFor=
"serviceid"
>
恢复信息
</nz-form-label>
<nz-form-label
[
nzSpan
]="
4
"
nz
Required
nz
For=
"serviceid"
>
恢复信息
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<label
nz-checkbox
></label>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzFor=
"serviceid"
>
恢复主题
</nz-form-label>
<nz-form-label
[
nzSpan
]="
4
"
nz
Required
nz
For=
"serviceid"
>
恢复主题
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<input
id=
"host4"
type=
"text"
nz-input
name=
"host1"
>
<input
id=
"host4"
type=
"text"
nz-input
name=
"host1"
[(
ngModel
)]="
validateForm
.
r_longdata
"
>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzFor=
"serviceid"
>
恢复信息
</nz-form-label>
<nz-form-label
[
nzSpan
]="
4
"
nz
Required
nz
For=
"serviceid"
>
恢复信息
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<textarea
nz-input
placeholder=
"
发送信息"
[
nzAutosize
]="{
minRows:
4
,
maxRows:
4
}
"
></textarea>
<textarea
nz-input
placeholder=
"
恢复信息"
[
nzAutosize
]="{
minRows:
4
,
maxRows:
4
}"
[(
ngModel
)]="
validateForm
.
r_shortdata
"
></textarea>
</nz-form-control>
</nz-form-item>
</div>
...
...
@@ -226,6 +230,3 @@
</nz-tab>
</nz-tabset>
</nz-modal>
<!--选择对象-->
<smart-find-user
#
smartFindUser
(
set
)="
getUser
($
event
)"
></smart-find-user>
\ No newline at end of file
src/main/webapp/app/modal/alarm-modal/alarm-modal.component.ts
View file @
d81c8f47
import
{
Component
,
OnIni
t
,
ViewChild
}
from
'@angular/core'
;
import
{
Component
,
EventEmitter
,
OnInit
,
Outpu
t
,
ViewChild
}
from
'@angular/core'
;
import
{
AlarmService
}
from
'../../alarm/alarm.service'
;
import
{
FindUserComponent
}
from
'../../alarm/modal/find-user/find-user.component'
;
import
{
NzFormatEmitEvent
,
NzMessageService
,
NzTreeComponent
,
NzTreeNode
}
from
'ng-zorro-antd'
;
...
...
@@ -20,6 +20,7 @@ import {OverAllService} from '../../overAll/overAll.service';
export
class
AlarmModalComponent
implements
OnInit
{
@
ViewChild
(
'smartFindUser'
)
smartFindUser
:
FindUserComponent
;
@
ViewChild
(
'nzTree'
)
nzTree
:
NzTreeComponent
;
@
Output
()
done
=
new
EventEmitter
<
any
>
();
modalTitle
=
'添加告警'
;
tabNum
=
0
;
...
...
@@ -27,11 +28,9 @@ export class AlarmModalComponent implements OnInit {
nodes
;
nodeList
;
groupList
;
sendOption
=
[];
userObj
=
{
alias
:
''
,
userid
:
''
};
objList
;
selectTreeList
=
[];
validateForm
;
...
...
@@ -43,7 +42,9 @@ export class AlarmModalComponent implements OnInit {
ngOnInit
()
{
this
.
initForm
();
this
.
getSendFun
();
this
.
getACtion
();
this
.
getGroup
();
this
.
getZabbixObj
();
}
//初始化
...
...
@@ -52,11 +53,18 @@ export class AlarmModalComponent implements OnInit {
this
.
validateForm
=
{
name
:
null
,
alertGroupId
:
null
,
warn
:
0
,
serious
:
0
,
mediaTypeIds
:[],
def_longdata
:
null
,
r_longdata
:
null
,
r_shortdata
:
null
,
userIds
:
null
,
};
}
//获取告警目标
get
Group
()
{
get
ACtion
()
{
this
.
overAllSer
.
findGroup
().
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
...
...
@@ -74,6 +82,17 @@ export class AlarmModalComponent implements OnInit {
);
}
//获取告警分组
getGroup
(){
this
.
alarmSer
.
alertGroupFind
().
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
groupList
=
res
.
data
;
}
}
);
}
toNode
(
data
)
{
this
.
nodes
=
data
.
map
(
res
=>
{
return
new
NzTreeNode
(
res
);
...
...
@@ -141,15 +160,15 @@ export class AlarmModalComponent implements OnInit {
);
}
//
选择对象
showUserModa
()
{
this
.
smartFindUser
.
showModal
();
}
//获取对象
getUser
(
data
)
{
this
.
userObj
=
data
;
console
.
log
(
data
);
//
获取发送对象 zabbix
getZabbixObj
()
{
this
.
alarmSer
.
zUserFind
({}).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
objList
=
res
.
data
;
}
}
);
}
showModal
(
data
)
{
...
...
@@ -165,24 +184,45 @@ export class AlarmModalComponent implements OnInit {
}
handEditleOk
()
{
const
optionArr
=
[];
this
.
sendOption
.
forEach
(
res
=>
{
if
(
res
.
checked
){
optionArr
.
push
(
res
.
value
);
}
});
if
(
this
.
validateForm
.
warn
){
this
.
validateForm
.
warn
=
1
;
}
else
{
this
.
validateForm
.
warn
=
0
}
if
(
this
.
validateForm
.
serious
){
this
.
validateForm
.
serious
=
1
;
}
else
{
this
.
validateForm
.
serious
=
0
}
const
data
=
{
name
:
this
.
validateForm
.
name
,
operations
:
[
{
opmessage_usr
:
[
{
userid
:
this
.
userObj
.
userid
}
]
}
]
alertGroupId
:
this
.
validateForm
.
alertGroupId
,
warn
:
this
.
validateForm
.
warn
,
serious
:
this
.
validateForm
.
serious
,
mediaTypeIds
:
optionArr
,
userIds
:
this
.
validateForm
.
userIds
,
def_longdata
:
this
.
validateForm
.
def_longdata
,
r_longdata
:
this
.
validateForm
.
r_longdata
,
r_shortdata
:
this
.
validateForm
.
r_shortdata
,
};
this
.
alarmSer
.
actionCreate
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
isShow
=
false
;
this
.
initForm
();
this
.
done
.
emit
();
}
this
.
message
.
info
(
res
.
errMsg
);
}
);
// this.isShow = false;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment