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
7ba2c671
Commit
7ba2c671
authored
Nov 08, 2019
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7ec5a6ec
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
229 deletions
+71
-229
app.constants.ts
src/main/webapp/app/app.constants.ts
+2
-2
basi-check.component.ts
src/main/webapp/app/modal/basi-check/basi-check.component.ts
+9
-1
threshold.component.html
src/main/webapp/app/modal/threshold/threshold.component.html
+4
-92
threshold.component.ts
src/main/webapp/app/modal/threshold/threshold.component.ts
+54
-132
basic-detail.component.ts
.../app/overAll/basic/basic-detail/basic-detail.component.ts
+1
-1
overAll.service.ts
src/main/webapp/app/overAll/overAll.service.ts
+1
-1
No files found.
src/main/webapp/app/app.constants.ts
View file @
7ba2c671
export
const
VERSION
=
process
.
env
.
VERSION
;
export
const
DEBUG_INFO_ENABLED
:
boolean
=
!!
process
.
env
.
DEBUG_INFO_ENABLED
;
export
const
SERVER_API_URL_COMS
=
'/coms'
;
//
export const SERVER_API_URL = '/anke';
export
const
SERVER_API_URL
=
'/zhouxi'
;
export
const
SERVER_API_URL
=
'/anke'
;
//
export const SERVER_API_URL = '/zhouxi';
// export const SERVER_API_URL = '/zabbixBox';
export
const
SERVER_API_URL_MONITOR
=
'/api'
;
export
const
BUILD_TIMESTAMP
=
process
.
env
.
BUILD_TIMESTAMP
;
...
...
src/main/webapp/app/modal/basi-check/basi-check.component.ts
View file @
7ba2c671
...
...
@@ -72,8 +72,16 @@ export class BasiCheckComponent implements OnInit {
history
:
[
'3600'
],
snmpCommunity
:
[
'public'
],
delay
:
[
null
,
[
Validators
.
required
]],
interfaceid
:
[
null
],
interfaceid
:
[
null
,[
Validators
.
required
]
],
templateid
:
[
null
],
status
:
[
null
],
applicationid
:
[
null
],
lastclock
:
[
null
],
lastvalue
:
[
null
],
maxLevel
:
[
null
],
createTime
:
[
null
],
error
:
[
null
],
triggers
:
[
null
],
description
:
[
null
,
[
Validators
.
required
]],
});
this
.
triggerObj
=
{
...
...
src/main/webapp/app/modal/threshold/threshold.component.html
View file @
7ba2c671
...
...
@@ -6,100 +6,12 @@
</div>
<nz-form-item
nzFlex
>
<nz-form-control
[
nzOffset
]="
4
"
[
nzSpan
]="
14
"
>
<
nz-radio-group
[(
ngModel
)]="
conditionType
"
>
<!-- <label nz-radio-button nzValue="commonly"><span>常规</span></label>--
>
<label
nz-radio-button
nzValue=
"high"
><span>
高级
</span></label
>
<
/nz-radio-group
>
<
p>
告警阈值
</p
>
<textarea
rows=
"4"
nz-input
[(
ngModel
)]="
conditionExpression
"
></textarea
>
<p>
严重阈值
</p
>
<
textarea
rows=
"4"
nz-input
[(
ngModel
)]="
faultConditionExpression
"
></textarea
>
</nz-form-control>
</nz-form-item>
<ng-container
*
ngIf=
"conditionType == 'commonly'"
>
<nz-form-item
class=
"form-select"
>
<nz-form-control
class=
"form-select"
>
<div
nz-row
[
nzGutter
]="
12
"
>
<nz-form-control
nz-col
[
nzPush
]="
3
"
[
nzSpan
]="
6
"
>
<button
nz-button
nzType=
"primary"
nzSize=
"small"
(
click
)="
addcondition
()"
>
添加条件
</button>
<span>
危险阈值
</span>
</nz-form-control>
</div>
<div
nz-row
[
nzGutter
]="
12
"
*
ngFor=
"let fault of conditionList;let i = index;"
>
<nz-form-control
nz-col
[
nzSpan
]="
3
"
></nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
5
"
>
<nz-select
name=
"interfaces_main"
nzPlaceHolder=
"选择接口类型"
[(
ngModel
)]="
fault
.
and
"
*
ngIf=
"i>0"
>
<nz-option
nzValue=
" and "
nzLabel=
"并且"
></nz-option>
<nz-option
nzValue=
" or "
nzLabel=
"或"
></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
4
"
>
<button
class=
"tag-button"
nz-button
nzType=
"default"
>
返回值
</button>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
5
"
>
<nz-select
name=
"interfaces_main"
nzPlaceHolder=
"选择接口类型"
[(
ngModel
)]="
fault
.
equal
"
>
<nz-option
nzValue=
"="
nzLabel=
"="
></nz-option>
<nz-option
nzValue=
">"
nzLabel=
">"
></nz-option>
<nz-option
nzValue=
"<"
nzLabel=
"<"
></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
5
"
>
<input
type=
"text"
placeholder=
"值"
nz-input
name=
"value"
[(
ngModel
)]="
fault
.
value
"
>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
2
"
>
<button
nz-button
nzType=
"primary"
(
click
)="
deleteCondition
(
i
)"
><i
style=
"color: #fff"
class=
"anticon anticon-close-circle-o"
></i>
</button>
</nz-form-control>
</div>
</nz-form-control>
</nz-form-item>
<nz-form-item
class=
"form-select"
>
<nz-form-control
class=
"form-select"
>
<div
nz-row
[
nzGutter
]="
12
"
>
<nz-form-control
nz-col
[
nzPush
]="
3
"
[
nzSpan
]="
6
"
>
<button
nz-button
nzType=
"primary"
nzSize=
"small"
(
click
)="
addFault
()"
>
添加条件
</button>
<span>
故障阈值
</span>
</nz-form-control>
</div>
<div
nz-row
[
nzGutter
]="
12
"
*
ngFor=
"let fault of faultConditionList;let i = index;"
>
<nz-form-control
nz-col
[
nzSpan
]="
3
"
></nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
5
"
>
<nz-select
name=
"interfaces_main"
[(
ngModel
)]="
fault
.
and
"
*
ngIf=
"i>0"
>
<nz-option
nzValue=
" and "
nzLabel=
"并且"
></nz-option>
<nz-option
nzValue=
" or "
nzLabel=
"或"
></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
4
"
>
<button
class=
"tag-button"
nz-button
nzType=
"default"
>
返回值
</button>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
5
"
>
<nz-select
name=
"interfaces_main"
nzPlaceHolder=
"选择接口类型"
[(
ngModel
)]="
fault
.
equal
"
>
<nz-option
nzValue=
"="
nzLabel=
"="
></nz-option>
<nz-option
nzValue=
">"
nzLabel=
">"
></nz-option>
<nz-option
nzValue=
"<"
nzLabel=
"<"
></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
5
"
>
<input
type=
"text"
placeholder=
"值"
nz-input
name=
"value"
[(
ngModel
)]="
fault
.
value
"
>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
2
"
>
<button
nz-button
nzType=
"primary"
(
click
)="
deleteFault
(
i
)"
><i
style=
"color: #fff"
class=
"anticon anticon-close-circle-o"
></i>
</button>
</nz-form-control>
</div>
</nz-form-control>
</nz-form-item>
</ng-container>
<ng-container
*
ngIf=
"conditionType == 'high'"
>
<nz-form-item
nzFlex
>
<nz-form-control
[
nzOffset
]="
4
"
[
nzSpan
]="
14
"
>
<p>
危险阈值
</p>
<textarea
rows=
"4"
nz-input
[(
ngModel
)]="
triggerObj
.
condition
"
></textarea>
<p>
故障阈值
</p>
<textarea
rows=
"4"
nz-input
[(
ngModel
)]="
triggerObj
.
faultCondition
"
></textarea>
</nz-form-control>
</nz-form-item>
</ng-container>
</nz-modal>
src/main/webapp/app/modal/threshold/threshold.component.ts
View file @
7ba2c671
...
...
@@ -17,18 +17,19 @@ export class ThresholdComponent implements OnInit {
itemId
;
//监控项ID
hostName
;
//主机name
itemObj
;
//监控项对象
conditionType
=
'high'
;
faultConditionList
=
[];
//故障阈值
conditionList
=
[];
//危险阈值
triggerConditionId
;
triggerFaultConditionId
;
triggerObj
=
{
condition
:
''
,
faultCondition
:
''
,
condition
:
null
,
faultCondition
:
null
,
itemName
:
''
};
conditionExpression
;
//严重
faultConditionExpression
;
//告警
demo
=
`示例1.{监测点id}>10 or {监测点id}=1 示例2. {监测点id}<10 and {监测点id}>3`
;
constructor
(
private
overAllSer
:
OverAllService
,
private
fb
:
FormBuilder
,
...
...
@@ -39,45 +40,16 @@ export class ThresholdComponent implements OnInit {
}
initForm
()
{
this
.
faultConditionList
=
[];
//危险阀值list
this
.
conditionList
=
[];
//故障list
this
.
isOkLoading
=
false
;
this
.
conditionExpression
=
''
;
this
.
faultConditionExpression
=
''
;
this
.
triggerObj
=
{
condition
:
''
,
faultCondition
:
''
,
condition
:
null
,
faultCondition
:
null
,
itemName
:
''
};
}
//危险add
addFault
()
{
const
demo
=
{
and
:
' and '
,
equal
:
'='
,
value
:
''
,
};
this
.
faultConditionList
.
push
(
demo
);
}
//危险add
addcondition
()
{
const
demo
=
{
and
:
' and '
,
equal
:
'='
,
value
:
''
,
};
this
.
conditionList
.
push
(
demo
);
}
//故障delete
deleteFault
(
index
)
{
this
.
faultConditionList
.
splice
(
index
,
1
);
}
//危险delete
deleteCondition
(
index
)
{
this
.
conditionList
.
splice
(
index
,
1
);
}
//新增
showAddModal
(
item
,
title
,
itemId
,
hostName
)
{
this
.
title
=
title
;
...
...
@@ -93,103 +65,42 @@ export class ThresholdComponent implements OnInit {
}
//编辑
showEditModal
(
title
,
itemId
,
hostId
,
hostName
)
{
showEditModal
(
title
,
item
,
item
Id
,
hostId
,
hostName
)
{
this
.
title
=
title
;
this
.
itemId
=
itemId
;
this
.
isVisiable
=
true
;
this
.
hostName
=
hostName
;
this
.
overAllSer
.
findItemDetail
(
this
.
itemId
).
subscribe
(
(
res
)
=>
{
this
.
itemObj
=
res
.
data
;
this
.
itemObj
.
triggers
.
forEach
((
value
)
=>
{
if
(
value
.
priority
==
2
||
value
.
priority
==
3
)
{
//危险
this
.
triggerObj
.
condition
=
value
.
expression
;
item
.
triggers
.
forEach
((
value
)
=>
{
if
(
value
.
priority
==
1
)
{
//告警
this
.
triggerObj
.
condition
=
value
;
this
.
conditionExpression
=
value
.
expression
;
this
.
triggerConditionId
=
value
.
id
;
}
if
(
value
.
priority
==
4
||
value
.
priority
==
5
)
{
//故障
this
.
triggerObj
.
faultCondition
=
value
.
expression
;
if
(
value
.
priority
==
2
)
{
//严重
this
.
triggerObj
.
faultCondition
=
value
;
this
.
faultConditionExpression
=
value
.
expression
;
this
.
triggerFaultConditionId
=
value
.
id
;
}
});
}
);
})
}
//
阈值--start
//
2.修改阈值
saveTrigger
()
{
const
data
=
{
condition
:
''
,
faultCondition
:
''
};
if
(
this
.
conditionType
==
'commonly'
)
{
//常规
this
.
conditionList
.
forEach
(
res
=>
{
if
(
!
res
.
and
)
{
res
.
and
=
''
;
}
data
.
condition
+=
res
.
and
+
'{'
+
this
.
hostName
+
':'
+
this
.
itemObj
.
key
+
'.last()}'
+
res
.
equal
+
''
+
res
.
value
;
});
this
.
faultConditionList
.
forEach
(
res
=>
{
if
(
!
res
.
and
)
{
res
.
and
=
''
;
}
data
.
faultCondition
+=
res
.
and
+
'{'
+
this
.
hostName
+
':'
+
this
.
itemObj
.
key
+
'.last()}'
+
res
.
equal
+
''
+
res
.
value
;
});
}
else
{
//高级
data
.
condition
=
this
.
triggerObj
.
condition
;
data
.
faultCondition
=
this
.
triggerObj
.
faultCondition
;
}
if
(
!
this
.
checkFun
()
&&
!
this
.
triggerObj
.
condition
&&
!
this
.
triggerObj
.
faultCondition
)
{
if
(
!
this
.
conditionExpression
&&
!
this
.
faultConditionExpression
)
{
this
.
message
.
error
(
'请输入阈值'
);
return
false
;
}
this
.
isOkLoading
=
true
;
if
(
this
.
title
==
'添加阈值'
)
{
// if (this.conditionList.length == 0 && this.faultConditionList.length == 0) {
// this.isVisiable = false;
// this.initForm();
// return false;
// }else{
this
.
createTrigger
(
data
);
// }
}
if
(
this
.
title
==
'编辑阈值'
)
{
this
.
updateTrigger
(
data
);
}
}
//校验是否填值
checkFun
()
{
let
error
=
true
;
this
.
conditionList
.
map
(
e
=>
{
if
(
e
.
value
.
length
>
0
)
{
}
else
{
error
=
false
;
}
});
this
.
faultConditionList
.
map
(
e
=>
{
if
(
e
.
value
.
length
>
0
)
{
}
else
{
error
=
false
;
}
});
return
error
;
}
//1.创建阈值
createTrigger
(
data
)
{
if
(
!
this
.
triggerObj
.
condition
&&
this
.
conditionExpression
)
{
//告警触发器创建
const
res
=
{
itemName
:
this
.
itemObj
.
name
,
faultCondition
:
data
.
faultCondition
,
condition
:
data
.
condition
,
condition
:
this
.
conditionExpression
,
itemid
:
this
.
itemId
};
this
.
overAllSer
.
createTrigger
(
res
).
subscribe
(
(
response
)
=>
{
if
(
response
.
errCode
==
10000
)
{
this
.
message
.
success
(
'创建
阈值成功'
);
this
.
message
.
success
(
'创建告警
阈值成功'
);
this
.
initForm
();
this
.
done
.
emit
();
this
.
isVisiable
=
false
;
...
...
@@ -200,32 +111,43 @@ export class ThresholdComponent implements OnInit {
}
);
}
//2.修改阈值
updateTrigger
(
data
)
{
const
condition
=
{
id
:
this
.
triggerConditionId
,
itemid
:
this
.
itemId
,
expression
:
data
.
condition
,
};
const
faultCondition
=
{
id
:
this
.
triggerFaultConditionId
,
itemid
:
this
.
itemId
,
expression
:
data
.
faultCondition
,
};
if
(
this
.
triggerConditionId
)
{
this
.
overAllSer
.
updateTrigger
(
condition
).
subscribe
(
res
=>
{
if
(
this
.
triggerObj
.
condition
)
{
//告警触发器更新
this
.
triggerObj
.
condition
.
expression
=
this
.
conditionExpression
;
this
.
overAllSer
.
updateTrigger
(
this
.
triggerObj
.
condition
).
subscribe
(
res
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
success
(
'更新告警阈值成功'
);
this
.
initForm
();
this
.
done
.
emit
();
this
.
isOkLoading
=
false
;
this
.
isVisiable
=
false
;
}
this
.
isOkLoading
=
false
;
});
}
if
(
this
.
triggerFaultConditionId
)
{
this
.
overAllSer
.
updateTrigger
(
faultCondition
).
subscribe
(
res
=>
{
if
(
!
this
.
triggerObj
.
faultCondition
&&
this
.
faultConditionExpression
)
{
//严重触发器创建
const
res
=
{
itemName
:
this
.
itemObj
.
name
,
faultCondition
:
this
.
faultConditionExpression
,
itemid
:
this
.
itemId
};
this
.
overAllSer
.
createTrigger
(
res
).
subscribe
(
(
response
)
=>
{
if
(
response
.
errCode
==
10000
)
{
this
.
message
.
success
(
'创建严重阈值成功'
);
this
.
initForm
();
this
.
done
.
emit
();
this
.
isVisiable
=
false
;
}
else
{
this
.
message
.
error
(
response
.
errMsg
);
}
this
.
isOkLoading
=
false
;
}
);
}
if
(
this
.
triggerObj
.
faultCondition
)
{
//严重触发器更新
this
.
triggerObj
.
faultCondition
.
expression
=
this
.
faultConditionExpression
;
this
.
overAllSer
.
updateTrigger
(
this
.
triggerObj
.
faultCondition
).
subscribe
(
res
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
success
(
'更新严重阈值成功'
);
this
.
initForm
();
this
.
done
.
emit
();
this
.
isVisiable
=
false
;
...
...
src/main/webapp/app/overAll/basic/basic-detail/basic-detail.component.ts
View file @
7ba2c671
...
...
@@ -662,7 +662,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//编辑阈值
showEditThresholdModal
(
item
)
{
this
.
smartThreshold
.
showEditModal
(
'编辑阈值'
,
item
.
id
,
this
.
hostId
,
item
.
name
);
this
.
smartThreshold
.
showEditModal
(
'编辑阈值'
,
item
,
item
.
id
,
this
.
hostId
,
item
.
name
);
}
//添加or编辑监测点 之后
...
...
src/main/webapp/app/overAll/overAll.service.ts
View file @
7ba2c671
...
...
@@ -196,7 +196,7 @@ export class OverAllService {
}
itemUpdata
(
data
):
Observable
<
any
>
{
return
this
.
http
.
p
u
t
(
SERVER_API_URL
+
'/item/update'
,
data
);
return
this
.
http
.
p
os
t
(
SERVER_API_URL
+
'/item/update'
,
data
);
}
//临时暂停
...
...
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