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
4738f890
Commit
4738f890
authored
Nov 18, 2018
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log
parent
52b84d40
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
179 additions
and
68 deletions
+179
-68
basi-check.component.html
...ain/webapp/app/modal/basi-check/basi-check.component.html
+5
-5
basic.component.html
src/main/webapp/app/overAll/basic/basic.component.html
+86
-26
basic.component.ts
src/main/webapp/app/overAll/basic/basic.component.ts
+75
-36
overAll.service.ts
src/main/webapp/app/overAll/overAll.service.ts
+11
-0
global.css
src/main/webapp/content/css/global.css
+2
-1
No files found.
src/main/webapp/app/modal/basi-check/basi-check.component.html
View file @
4738f890
...
...
@@ -14,15 +14,15 @@
<nz-form-label
[
nzSpan
]="
6
"
nzRequired
nzFor=
"type"
>
类型
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<nz-select
name=
"type"
name=
"type"
nzPlaceHolder=
"选择类型"
[(
ngModel
)]="
validateForm
.
type
"
>
<nz-option
nzValue=
"0"
nzLabel=
"
Zabbix
客户端"
></nz-option>
<nz-option
nzValue=
"7"
nzLabel=
"
Zabbix
客户端(主动式)"
></nz-option>
<nz-option
nzValue=
"0"
nzLabel=
"
Agent
客户端"
></nz-option>
<nz-option
nzValue=
"7"
nzLabel=
"
Agent
客户端(主动式)"
></nz-option>
<nz-option
nzValue=
"3"
nzLabel=
"简单检查"
></nz-option>
<nz-option
nzValue=
"1"
nzLabel=
"SNMPv1 客户端"
></nz-option>
<nz-option
nzValue=
"4"
nzLabel=
"SNMPv2 客户端"
></nz-option>
<nz-option
nzValue=
"6"
nzLabel=
"SNMPv3 客户端"
></nz-option>
<nz-option
nzValue=
"5"
nzLabel=
"
Zabbix
内部"
></nz-option>
<nz-option
nzValue=
"2"
nzLabel=
"
Zabbix
采集器"
></nz-option>
<nz-option
nzValue=
"8"
nzLabel=
"
Zabbix
整合"
></nz-option>
<nz-option
nzValue=
"5"
nzLabel=
"
Agent
内部"
></nz-option>
<nz-option
nzValue=
"2"
nzLabel=
"
Agent
采集器"
></nz-option>
<nz-option
nzValue=
"8"
nzLabel=
"
Agent
整合"
></nz-option>
<nz-option
nzValue=
"10"
nzLabel=
"外部检查"
></nz-option>
<nz-option
nzValue=
"11"
nzLabel=
"数据库监控"
></nz-option>
<nz-option
nzValue=
"12"
nzLabel=
"IPMI客户端"
></nz-option>
...
...
src/main/webapp/app/overAll/basic/basic.component.html
View file @
4738f890
...
...
@@ -13,20 +13,20 @@
</nz-breadcrumb>
</div>
<div
nz-col
nzSpan=
"8"
class=
"text-right"
>
<
!--<button nz-button nzType="primary"><i class="anticon anticon-search"></i></button>--
>
<
!--<button nz-button nzType="primary"><i class="anticon anticon-sync"></i></button>--
>
<
!--<button nz-button nzType="primary"><i class="anticon anticon-arrows-alt"></i></button>--
>
<
button
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-search"
></i></button
>
<
button
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-sync"
></i></button
>
<
button
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-arrows-alt"
></i></button
>
</div>
</div>
<div
nz-row
class=
"search-form"
>
<div
nz-row
class=
"search-form
tag-form
"
>
<div
nz-col
nzSpan=
"12"
>
<span>
监控设备数:{{deviceNo}}
</span>
<span>
设备状态:
<span
>
<nz-tag
[
nzColor
]="'#
64ad58
'"
></nz-tag>
110
</span>
<span
>
<nz-tag
[
nzColor
]="'#
ed9e2e
'"
></nz-tag>
120
</span>
<span
>
<nz-tag
[
nzColor
]="'#
dd4127
'"
></nz-tag>
119
</span>
<span>
<nz-tag
[
nzColor
]="'#
aaaaaa
'"
></nz-tag>
112
</span>
<span
style=
"margin-right: 8px"
>
<nz-tag
[
nzColor
]="'#
64ad58
'"
></nz-tag>
{{green}}
</span>
<span
style=
"margin-right: 8px"
>
<nz-tag
[
nzColor
]="'#
ed9e2e
'"
></nz-tag>
{{yellow}}
</span>
<span
style=
"margin-right: 8px"
>
<nz-tag
[
nzColor
]="'#
dd4127
'"
></nz-tag>
{{red}}
</span>
<span>
<nz-tag
[
nzColor
]="'#
aaaaaa
'"
></nz-tag>
{{gray}}
</span>
</span>
<nz-select
style=
"width: 200px;"
nzShowSearch
nzAllowClear
nzPlaceHolder=
"按组分开"
[(
ngModel
)]="
selectedValue
"
(
ngModelChange
)="
select
()"
>
...
...
@@ -38,18 +38,23 @@
<button
nz-button
nzType=
"default"
(
click
)="
showGroupModal
()"
*
ngIf=
"selectedValue == 'group'"
><i
class=
"anticon anticon-plus"
></i>
添加分组
</button>
<button
nz-button
nzType=
"default"
><i
class=
"anticon anticon-pause-circle-o"
></i>
关闭监控
</button>
<button
nz-button
nzType=
"default"
><i
class=
"anticon anticon-play-circle-o"
></i>
开启监控
</button>
<button
(
click
)="
batchDeleteConfirm
()"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-close-circle"
></i>
删除资源
</button>
<button
(
click
)="
openBatchHost
(
1
,'关闭')"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-pause-circle-o"
></i>
关闭监控
</button>
<button
(
click
)="
openBatchHost
(
0
,'开启')"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-play-circle-o"
></i>
开启监控
</button>
<button
(
click
)="
batchDeleteConfirm
()"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-close-circle"
></i>
删除资源
</button>
</div>
</div>
<nz-table
#
nzTable
[
nzData
]="
dataSet
"
nzSingleSort
[
nzLoading
]="
loading
"
>
<thead>
<tr>
<th
nzShowCheckbox
[
nzChecked
]="
allChecked
"
(
nzCheckedChange
)="
checkAll
($
event
)"
></th>
<th
nzShowSort
>
名称
</th>
<th
nzShowSort
>
告警状态
</th>
<th
nzShowSort
nzWidth=
"20%"
>
状态
</th>
<th
[
nzChecked
]="
allChecked
"
(
nzCheckedChange
)="
checkAll
($
event
)"
></th>
<th>
名称
</th>
<th>
告警状态
</th>
<th
nzWidth=
"20%"
>
状态
</th>
<th>
可用性
</th>
<th>
操作
</th>
</tr>
</thead>
...
...
@@ -61,7 +66,7 @@
<ng-template
ngFor
let-data
[
ngForOf
]="
nzTable
.
data
"
>
<ng-template
ngFor
let-item
[
ngForOf
]="
expandDataCache
[
data
.
host
]"
>
<tr
*
ngIf=
"(item.parent&&item.parent.expand)||!(item.parent)"
>
<td
nzShowCheckbox
[(
nzChecked
)]="
item
.
checked
"
></td>
<td
nzShowCheckbox
[(
nzChecked
)]="
item
.
checked
"
></td>
<td
class=
"cursor"
[
nzIndentSize
]="
item
.
level
*
20
"
[
nzShowExpand
]="!!
item
.
list
"
[(
nzExpand
)]="
item
.
expand
"
(
nzExpandChange
)="
collapse
(
expandDataCache
[
data
.
host
],
item
,$
event
)"
>
<span
*
ngIf=
"!item.level"
(
click
)="
getChildrenType
(
item
)"
>
{{item.equipmentType}}
</span>
...
...
@@ -105,14 +110,25 @@
<ng-template
ngFor
let-data
[
ngForOf
]="
nzTable
.
data
"
>
<ng-template
ngFor
let-item
[
ngForOf
]="
expandDataCache
[
data
.
host
]"
>
<tr
*
ngIf=
"(item.parent&&item.parent.expand)||!(item.parent)"
>
<td
nzShowCheckbox
[
nzIndeterminate
]="
indeterminate
"
(
nzCheckedChange
)="
selectChecked
($
event
,
item
)"
[(
nzChecked
)]="
item
.
checked
"
></td>
<td
*
ngIf=
"!item.level"
class=
"cursor"
[
nzIndentSize
]="
item
.
level
*
20
"
nzShowExpand
(
nzExpandChange
)="
getChildren
(
item
)"
>
<span>
{{item.name}}
</span>
</td>
<td
*
ngIf=
"item.level"
class=
"cursor"
[
nzIndentSize
]="
item
.
level
*
20
"
>
<span
(
click
)="
goDetail
(
item
)"
>
{{item.name}}
</span>
</td>
<td
class=
"round-tag"
>
<!--父级-->
<ng-container
*
ngIf=
"!item.level"
>
<td
[
nzIndeterminate
]="
indeterminate
"
(
nzCheckedChange
)="
selectChecked
($
event
,
item
)"
[(
nzChecked
)]="
item
.
checked
"
></td>
<td
class=
"cursor"
[
nzIndentSize
]="
item
.
level
*
20
"
nzShowExpand
(
nzExpandChange
)="
getChildren
(
item
)"
>
<span>
{{item.name}}
</span>
</td>
</ng-container>
<!--子集-->
<ng-container
*
ngIf=
"item.level"
>
<td
nzShowCheckbox
[
nzIndeterminate
]="
indeterminate
"
(
nzCheckedChange
)="
selectChecked
($
event
,
item
)"
[(
nzChecked
)]="
item
.
checked
"
></td>
<td
class=
"cursor"
[
nzIndentSize
]="
item
.
level
*
20
"
>
<span
(
click
)="
goDetail
(
item
)"
>
{{item.name}}
</span>
</td>
</ng-container>
<td
class=
"round-tag tag-form"
>
<nz-tag
*
ngIf=
"item.maxLevel == 4 || item.maxLevel == 5"
[
nzColor
]="'#
fc0d1b
'"
></nz-tag>
<nz-tag
*
ngIf=
"item.maxLevel == 2 || item.maxLevel == 3"
[
nzColor
]="'#
fd9827
'"
></nz-tag>
<span
*
ngIf=
"item.maxLevel < 2"
>
正常
</span>
...
...
@@ -121,6 +137,49 @@
<span
*
ngIf=
"item.status == 0"
>
已监控
</span>
<span
*
ngIf=
"item.status == 1"
>
未监控
</span>
</td>
<td>
<ng-container
*
ngIf=
"item.level"
>
<ng-container
*
ngIf=
"item.available == 0"
>
<nz-tag>
AGENT
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.available == 1"
>
<nz-tag
[
nzColor
]="'#
3bae6a
'"
>
AGENT
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.available == 2"
>
<nz-tag
[
nzColor
]="'#
d44f51
'"
>
AGENT
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.snmp_available == 0"
>
<nz-tag>
SNMP
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.snmp_available == 1"
>
<nz-tag
[
nzColor
]="'#
3bae6a
'"
>
SNMP
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.snmp_available == 2"
>
<nz-tag
[
nzColor
]="'#
d44f51
'"
>
SNMP
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.jmx_available == 0"
>
<nz-tag>
JMX
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.jmx_available == 1"
>
<nz-tag
[
nzColor
]="'#
3bae6a
'"
>
JMX
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.jmx_available == 2"
>
<nz-tag
[
nzColor
]="'#
d44f51
'"
>
JMX
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.ipmi_available == 0"
>
<nz-tag>
IPMI
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.ipmi_available == 1"
>
<nz-tag
[
nzColor
]="'#
3bae6a
'"
>
IPMI
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.ipmi_available == 2"
>
<nz-tag
[
nzColor
]="'#
d44f51
'"
>
IPMI
</nz-tag>
</ng-container>
</ng-container>
</td>
<td
class=
"handle"
>
<ng-container
*
ngIf=
"!item.level"
>
<span
(
click
)="
showBasicEditModal
(
item
)"
>
添加资源
</span>
...
...
@@ -134,11 +193,12 @@
<nz-dropdown
[
nzTrigger
]="'
click
'"
class=
"table-dropdown"
>
<a
nz-dropdown
>
更多
<i
class=
"anticon anticon-down"
></i>
</a>
<ul
nz-menu
nzSelectable
>
<ul
nz-menu
nzSelectable
>
<li
(
click
)="
showTempStop
(
item
)"
nz-menu-item
><a>
临时暂停
</a></li>
<li
(
click
)="
openHost
(
item
)"
nz-menu-item
><a>
<ng-container
*
ngIf=
"item.status == 1"
>
开启
</ng-container>
<ng-container
*
ngIf=
"item.status == 0"
>
停止
</ng-container>
监控
<ng-container
*
ngIf=
"item.status == 0"
>
停止
</ng-container>
监控
</a></li>
<li
nz-menu-item
><a>
查看监测点
</a></li>
<li
(
click
)="
showAlarm
(
item
)"
nz-menu-item
><a>
添加告警
</a></li>
...
...
src/main/webapp/app/overAll/basic/basic.component.ts
View file @
4738f890
...
...
@@ -59,6 +59,12 @@ export class BasicComponent implements OnInit {
//批量删除list
batchDelList
=
[];
//设备状态
red
;
yellow
;
green
;
gray
;
constructor
(
private
fb
:
FormBuilder
,
private
overAllSer
:
OverAllService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
message
:
NzMessageService
,
)
{
...
...
@@ -111,8 +117,44 @@ export class BasicComponent implements OnInit {
ngOnInit
():
void
{
this
.
selectedValue
=
'group'
;
this
.
select
();
// this.findList();
this
.
findSize
();
this
.
findOpStatus
();
}
//查询设备状态
findOpStatus
(){
this
.
overAllSer
.
findHostCountByStatus
(
0
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
green
=
res
.
data
.
size
;
}
else
{
this
.
message
.
info
(
res
.
Msg
);
}
}
)
this
.
overAllSer
.
findHostCountByStatus
(
1
).
subscribe
(
(
res
)
=>
{
this
.
gray
=
res
.
data
.
size
;
}
)
this
.
overAllSer
.
findWarningByAll
(
1
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
yellow
=
res
.
data
.
size
;
}
else
{
this
.
message
.
info
(
res
.
Msg
);
}
}
)
this
.
overAllSer
.
findWarningByAll
(
0
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
red
=
res
.
data
.
size
;
}
else
{
this
.
message
.
info
(
res
.
Msg
);
}
}
)
}
//添加资源 ,name-分组名称,id-分组id
...
...
@@ -193,12 +235,6 @@ export class BasicComponent implements OnInit {
});
}
//全选
checkAll
(
e
)
{
}
//删除单个资源
showDeleteConfirm
(
data
)
{
this
.
modalService
.
confirm
({
...
...
@@ -236,12 +272,13 @@ export class BasicComponent implements OnInit {
nzOkType
:
'danger'
,
nzOnOk
:
()
=>
{
const
data
=
{
param
s
:
this
.
batchDelList
hostid
s
:
this
.
batchDelList
}
this
.
overAllSer
.
deleteHostPost
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
info
(
'删除成功'
);
this
.
batchDelList
=
[];
this
.
select
();
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
...
...
@@ -363,6 +400,7 @@ export class BasicComponent implements OnInit {
this
.
smartPause
.
showModal
(
item
.
hostid
);
}
//选择
selectChecked
(
event
,
item
){
if
(
event
){
if
(
item
.
hostid
){
...
...
@@ -405,33 +443,34 @@ export class BasicComponent implements OnInit {
}
//批量开启or停止监控
openBatchHost
(
item
){
// this.modalService.confirm({
// nzTitle: '监控',
// nzContent: '确定开启监控设备'+item.name + '?',
// nzOkText: '确定',
// nzCancelText: '取消',
// nzOnOk: () => {
// const data = {
//
// }
// let params1 = 0;
// if(item.status == 1){
// params1 = 0;
// }
// const params2 = item.hostid;
// this.overAllSer.batchStopOrOpen(params1,params2).subscribe(
// (res) => {
// if (res.errCode == 10000) {
// this.message.info('修改成功');
// this.select();
// } else {
// this.message.info(res.errMsg);
// }
// }
// );
// },
// nzOnCancel: () => console.log('Cancel')
// });
openBatchHost
(
status
,
operation
){
if
(
this
.
batchDelList
.
length
==
0
){
this
.
message
.
info
(
'请选择需要'
+
operation
+
'的设备'
);
return
false
;
}
this
.
modalService
.
confirm
({
nzTitle
:
'监控'
,
nzContent
:
'确定批量'
+
operation
+
'监控设备?'
,
nzOkText
:
'确定'
,
nzCancelText
:
'取消'
,
nzOnOk
:
()
=>
{
const
data
=
{
status
:
status
,
hostids
:
this
.
batchDelList
}
this
.
overAllSer
.
batchStopOrOpen
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
info
(
'修改成功'
);
this
.
batchDelList
=
[];
this
.
select
();
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
}
}
);
},
nzOnCancel
:
()
=>
console
.
log
(
'Cancel'
)
});
}
}
src/main/webapp/app/overAll/overAll.service.ts
View file @
4738f890
...
...
@@ -198,4 +198,14 @@ export class OverAllService {
updateHost
(
data
):
Observable
<
any
>
{
return
this
.
http
.
put
(
SERVER_API_URL
+
'/host/updataHost'
,
data
);
}
//根据host的启用状态查询count 记录数
findHostCountByStatus
(
params
):
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL
+
'/host/findHostCountByStatus/'
+
params
);
}
//查询所有主机的警告数和高危报警数
findWarningByAll
(
params
):
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL
+
'/statistics/findWarningByAll/'
+
params
);
}
}
\ No newline at end of file
src/main/webapp/content/css/global.css
View file @
4738f890
...
...
@@ -259,9 +259,10 @@ ui bootstrap tweaks
.margin-0-16
{
margin
:
0
16px
;
}
.ant-tag
{
.
tag-form
.
ant-tag
{
height
:
16px
;
vertical-align
:
sub
;
margin-right
:
4px
;
}
.background
{
...
...
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