Commit 6ecd7267 authored by wangqinghua's avatar wangqinghua

网站监测

parent d81c8f47
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div nz-row class="search-form"> <div nz-row class="search-form">
<div nz-col nzSpan="16"> <div nz-col nzSpan="16">
<span>当前告警数:120</span> <span>当前告警数:{{alarmTotal}}</span>
</div> </div>
</div> </div>
<div class="tag-warn tag-form"> <div class="tag-warn tag-form">
...@@ -32,6 +32,6 @@ ...@@ -32,6 +32,6 @@
</span> </span>
</div> </div>
<smart-warn-list #warnList></smart-warn-list> <smart-warn-list #warnList (total)="getTotal($event)"></smart-warn-list>
<smart-send-log #sendLog></smart-send-log> <smart-send-log #sendLog></smart-send-log>
\ No newline at end of file
...@@ -33,6 +33,7 @@ export class NowAlarmComponent implements OnInit { ...@@ -33,6 +33,7 @@ export class NowAlarmComponent implements OnInit {
@ViewChild('warnList') warnList:WarnListComponent; @ViewChild('warnList') warnList:WarnListComponent;
color = color; color = color;
alarmTotal;
warnCountList = []; warnCountList = [];
loading = false; loading = false;
pageCount = pageSize; pageCount = pageSize;
...@@ -51,7 +52,7 @@ export class NowAlarmComponent implements OnInit { ...@@ -51,7 +52,7 @@ export class NowAlarmComponent implements OnInit {
search(){ search(){
const obj = { const obj = {
isWaring:'yes' isWaring:'yes'
} };
this.warnList.getList(obj); this.warnList.getList(obj);
} }
...@@ -75,4 +76,8 @@ export class NowAlarmComponent implements OnInit { ...@@ -75,4 +76,8 @@ export class NowAlarmComponent implements OnInit {
showModal(data){ showModal(data){
this.sendLog.showModal(data); this.sendLog.showModal(data);
} }
getTotal(num){
this.alarmTotal = num;
}
} }
<section> <section>
<nz-modal [nzWidth]="880" [(nzVisible)]="isCheck" nzTitle="添加检测点" (nzOnCancel)="handleCheckCancel()" <nz-modal [nzWidth]="880" [(nzVisible)]="isCheck" [nzTitle]="title" (nzOnCancel)="handleCheckCancel()"
(nzOnOk)="handleCheckOk()"> (nzOnOk)="handleCheckOk()">
<form nz-form> <form nz-form>
<div style="padding: 16px;font-size: 18px;">基本属性</div> <div style="padding: 16px;font-size: 18px;">基本属性</div>
......
...@@ -26,6 +26,8 @@ import {NewTypeComponent} from '../new-type/new-type.component'; ...@@ -26,6 +26,8 @@ import {NewTypeComponent} from '../new-type/new-type.component';
export class BasiCheckComponent implements OnInit { export class BasiCheckComponent implements OnInit {
@ViewChild('basicKey') basicKey: BasicKeyComponent; @ViewChild('basicKey') basicKey: BasicKeyComponent;
@ViewChild('newType') newType: NewTypeComponent; @ViewChild('newType') newType: NewTypeComponent;
title;
isCheck = false; isCheck = false;
hostId; //主机ID hostId; //主机ID
interfaceList: any[]; interfaceList: any[];
...@@ -52,32 +54,10 @@ export class BasiCheckComponent implements OnInit { ...@@ -52,32 +54,10 @@ export class BasiCheckComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.validateForm = { this.initForm();
hostid: this.hostId,
name: null,
interfaceid: null,
key_: null,
value_type: null,
type: null,
data_type: null,
units: null,
history: null,
trends: null,
valuemapid: null,
delay: null,
condition_commonly: null, //故障
condition_high: null, //故障
faultCondition_commonly: null, //危险
faultCondition_high: null, //危险
delta: null,
formula: null
};
} }
//初始化信息 initForm(){
showCheckModal(hostId) {
this.isCheck = true;
this.hostId = hostId;
this.validateForm = { this.validateForm = {
hostid: this.hostId, hostid: this.hostId,
name: null, name: null,
...@@ -99,6 +79,38 @@ export class BasiCheckComponent implements OnInit { ...@@ -99,6 +79,38 @@ export class BasiCheckComponent implements OnInit {
formula: null, formula: null,
applicationids: null applicationids: null
}; };
}
//新增
showAddModal(hostId){
this.title = '添加监测点';
this.isCheck = true;
this.hostId = hostId;
//主机接口
this.overAllSer.findDetailed(this.hostId).subscribe(
(res) => {
this.interfaceList = res.data[0].interfaces;
}
);
this.getItemType();
}
//编辑
showEditModal(hostId,id){
this.title = "编辑监测点";
this.hostId = hostId;
this.isCheck = true;
this.overAllSer.findItemDetail(id).subscribe(
(res) => {
this.validateForm = res.data[0];
this.validateForm.type = this.validateForm.type +'';
this.validateForm.interfaceid = this.validateForm.interfaceid +"";
this.validateForm.value_type = this.validateForm.value_type +"";
this.validateForm.data_type = this.validateForm.data_type +"";
this.validateForm.applicationids = this.validateForm.applications[0].applicationid +"";
}
);
//主机接口 //主机接口
this.overAllSer.findDetailed(this.hostId).subscribe( this.overAllSer.findDetailed(this.hostId).subscribe(
......
...@@ -33,6 +33,8 @@ export class BasicEditComponent implements OnInit { ...@@ -33,6 +33,8 @@ export class BasicEditComponent implements OnInit {
panel1 = {name: '配置IPMI', active: true}; panel1 = {name: '配置IPMI', active: true};
panel2 = {name: '配置宏', active: true}; panel2 = {name: '配置宏', active: true};
templatesResoure = [];
//加密 //加密
otherHost; otherHost;
...@@ -107,6 +109,7 @@ export class BasicEditComponent implements OnInit { ...@@ -107,6 +109,7 @@ export class BasicEditComponent implements OnInit {
return res.templateid; return res.templateid;
}); });
this.validateForm.templates = tempArr; this.validateForm.templates = tempArr;
this.templatesResoure = tempArr;
} }
this.interfaceslist = data.interfaces; this.interfaceslist = data.interfaces;
this.interfaceslist.forEach(res => { this.interfaceslist.forEach(res => {
...@@ -196,6 +199,16 @@ export class BasicEditComponent implements OnInit { ...@@ -196,6 +199,16 @@ export class BasicEditComponent implements OnInit {
//更新 //更新
update() { update() {
//比较监控模版是否发生变化
const clearArr = [];
this.templatesResoure.forEach(res=>{
if( this.validateForm.templates.indexOf(res) == -1 ){
clearArr.push(res);
}
});
this.validateForm.templatesClear = clearArr;
if (this.macroTYpe == 'macroExpand') { if (this.macroTYpe == 'macroExpand') {
this.validateForm.macros = this.macroList2; this.validateForm.macros = this.macroList2;
} }
...@@ -320,6 +333,7 @@ export class BasicEditComponent implements OnInit { ...@@ -320,6 +333,7 @@ export class BasicEditComponent implements OnInit {
//初始化Form信息 //初始化Form信息
initForm() { initForm() {
this.templatesResoure = [];
this.macroList1 = [ //配置宏数组 this.macroList1 = [ //配置宏数组
{ {
macro: '{$SNMP_COMMUNITY}', macro: '{$SNMP_COMMUNITY}',
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<nz-tag *ngIf="data.priority == 4 || data.priority == 5" [nzColor]="'#fc0d1b'"></nz-tag> <nz-tag *ngIf="data.priority == 4 || data.priority == 5" [nzColor]="'#fc0d1b'"></nz-tag>
<nz-tag *ngIf="data.priority == 2 || data.priority == 3" [nzColor]="'#fd9827'"></nz-tag> <nz-tag *ngIf="data.priority == 2 || data.priority == 3" [nzColor]="'#fd9827'"></nz-tag>
</td> </td>
<td>名称</td> <td>{{data.hostname}}</td>
<td>{{data.description}}</td> <td>{{data.description}}</td>
<td>{{data.equipmentType}}</td> <td>{{data.equipmentType}}</td>
<td>{{data.groupname}}</td> <td>{{data.groupname}}</td>
......
import {Component, OnInit, ViewChild} from '@angular/core'; import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core';
import {AlarmService} from '../../alarm/alarm.service'; import {AlarmService} from '../../alarm/alarm.service';
import {pageSize} from '../../app.constants'; import {pageSize} from '../../app.constants';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
...@@ -18,6 +18,7 @@ import {SendLogComponent} from '../../alarm/modal/send-log/send-log.component'; ...@@ -18,6 +18,7 @@ import {SendLogComponent} from '../../alarm/modal/send-log/send-log.component';
}) })
export class WarnListComponent implements OnInit { export class WarnListComponent implements OnInit {
@ViewChild('sendLog') sendLog:SendLogComponent; @ViewChild('sendLog') sendLog:SendLogComponent;
@Output() total = new EventEmitter<any>();
warnList = []; warnList = [];
obj; obj;
...@@ -45,6 +46,7 @@ export class WarnListComponent implements OnInit { ...@@ -45,6 +46,7 @@ export class WarnListComponent implements OnInit {
if(res.errCode == 10000){ if(res.errCode == 10000){
this.warnList = res.data.data; this.warnList = res.data.data;
this.totalNum = res.data.totalNum; this.totalNum = res.data.totalNum;
this.total.emit(this.totalNum);
}else{ }else{
this.message.info(res.errMsg); this.message.info(res.errMsg);
} }
......
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" nzTitle="{{title}}" (nzOnCancel)="handleCancel()" <nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" nzTitle="{{title}}" [nzFooter]="null" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()"> (nzOnOk)="handleOk()">
<nz-tabset [nzSelectedIndex]="tabNum" style="padding-bottom: 25px;min-height: 500px"> <nz-tabset [nzSelectedIndex]="tabNum" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="1.场景"> <nz-tab nzTitle="1.场景">
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12"> <div nz-col [nzSpan]="12">
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="name">网站名称</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired nzFor="name">网站名称</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input id="name" name="name" nz-input placeholder="默认" [(ngModel)]="validateForm.name"> <input id="name" name="name" nz-input placeholder="默认" [(ngModel)]="validateForm.name">
</nz-form-control> </nz-form-control>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="24"> <div nz-col [nzSpan]="24">
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="http_proxy">Http代理</nz-form-label> <nz-form-label [nzSpan]="3" nzFor="http_proxy">Http代理</nz-form-label>
<nz-form-control [nzSpan]="18"> <nz-form-control [nzSpan]="18">
<input id="http_proxy" name="http_proxy" nz-input placeholder="默认" <input id="http_proxy" name="http_proxy" nz-input placeholder="默认"
[(ngModel)]="validateForm.http_proxy"> [(ngModel)]="validateForm.http_proxy">
...@@ -128,8 +128,8 @@ ...@@ -128,8 +128,8 @@
</nz-tab> </nz-tab>
<nz-tab nzTitle="2.步骤"> <nz-tab nzTitle="2.步骤">
<button nz-button nzType="default">添加步骤</button> <button (click)="addStep()" nz-button nzType="default">添加步骤</button>
<div > <div>
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="1"> <div nz-col [nzSpan]="1">
No No
...@@ -156,32 +156,33 @@ ...@@ -156,32 +156,33 @@
</div> </div>
</div> </div>
<div nz-row [nzGutter]="12"> <div nz-row [nzGutter]="12" *ngFor="let item of steps;let i = index;">
<div nz-col [nzSpan]="1"> <div nz-col [nzSpan]="1">
1 {{i +1}}
</div> </div>
<nz-form-control nz-col [nzSpan]="3"> <nz-form-control nz-col [nzSpan]="3">
<input nz-input placeholder="名称"> <input nz-input placeholder="名称" [(ngModel)]="item.name">
</nz-form-control> </nz-form-control>
<nz-form-control nz-col [nzSpan]="3"> <nz-form-control nz-col [nzSpan]="3">
<input nz-input placeholder="默认30s"> <input nz-input placeholder="15" [(ngModel)]="item.timeout">
</nz-form-control> </nz-form-control>
<nz-form-control nz-col [nzSpan]="3"> <nz-form-control nz-col [nzSpan]="3">
<input nz-input placeholder="" > <input nz-input placeholder="" [(ngModel)]="item.url">
</nz-form-control> </nz-form-control>
<nz-form-control nz-col [nzSpan]="3"> <nz-form-control nz-col [nzSpan]="3">
<input nz-input placeholder="" > <input nz-input placeholder="" [(ngModel)]="item.posts">
</nz-form-control> </nz-form-control>
<nz-form-control nz-col [nzSpan]="3"> <nz-form-control nz-col [nzSpan]="3">
<input nz-input placeholder="200" > <input nz-input placeholder="200" [(ngModel)]="item.status_codes">
</nz-form-control> </nz-form-control>
<nz-form-control nz-col [nzSpan]="3"> <nz-form-control nz-col [nzSpan]="3">
<nz-select name="equipmentType" nzPlaceHolder="选择设备类型"> <nz-select name="equipmentType" nzPlaceHolder="是否跟随跳转" [(ngModel)]="item.follow_redirects">
<nz-option nzValue="是" nzLabel="是"></nz-option> <nz-option nzValue="1" nzLabel="是"></nz-option>
<nz-option nzValue="0" nzLabel="否"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
<div nz-col [nzSpan]="1"> <div nz-col [nzSpan]="1">
<span class="cursor">X</span> <span (click)="deleteStep(index)" class="cursor">X</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -189,6 +190,7 @@ ...@@ -189,6 +190,7 @@
<div class="modal-footer-btn"> <div class="modal-footer-btn">
<button nz-button (click)="handleCancel()" nzType="primary">取消</button> <button nz-button (click)="handleCancel()" nzType="primary">取消</button>
<button nz-button (click)="tabsChange(0)" nzType="primary">上一步</button> <button nz-button (click)="tabsChange(0)" nzType="primary">上一步</button>
<button nz-button (click)="tabsChange(2)" nzType="primary">下一步</button>
</div> </div>
</nz-tab> </nz-tab>
......
import {Component, OnInit} from '@angular/core'; import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {OverAllService} from '../../overAll/overAll.service'; import {OverAllService} from '../../overAll/overAll.service';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
...@@ -9,9 +9,11 @@ import {NzMessageService} from 'ng-zorro-antd'; ...@@ -9,9 +9,11 @@ import {NzMessageService} from 'ng-zorro-antd';
}) })
export class WebsiteComponent implements OnInit { export class WebsiteComponent implements OnInit {
@Output() done = new EventEmitter<any>();
isVisible = false; isVisible = false;
title; title;
tabNum = 0; tabNum = 0;
indexNo = 1;
validateForm; validateForm;
steps = []; steps = [];
...@@ -24,18 +26,27 @@ export class WebsiteComponent implements OnInit { ...@@ -24,18 +26,27 @@ export class WebsiteComponent implements OnInit {
} }
initForm() { initForm() {
this.steps = []; this.steps = [
{
name:'',
url:'',
status_codes:200,
posts:'',
no:this.indexNo,
timeout:'15',
follow_redirects:'1',
condition:'',
faultCondition:'',
}
];
this.validateForm = { this.validateForm = {
name: '', name: '',
hostid: null, delay:'',
applicationid: null, retries:'',
delay: '', http_proxy:'',
retries: null, ssl_cert_file:'',
variables: '', ssl_key_file:'',
http_proxy: '', ssl_key_password:'',
ssl_cert_file: '',
ssl_key_file: '',
ssl_key_password: '',
steps: this.steps, steps: this.steps,
}; };
} }
...@@ -45,8 +56,17 @@ export class WebsiteComponent implements OnInit { ...@@ -45,8 +56,17 @@ export class WebsiteComponent implements OnInit {
this.isVisible = true; this.isVisible = true;
} }
showEditModal() { showEditModal(id) {
this.title = '编辑网站监测';
this.isVisible = true; this.isVisible = true;
this.overAllSer.findWeb(id).subscribe(
(res)=>{
if(res.errCode == 10000){
this.validateForm = res.data;
this.steps = res.data.steps;
}
}
)
} }
handleOk() { handleOk() {
...@@ -65,9 +85,11 @@ export class WebsiteComponent implements OnInit { ...@@ -65,9 +85,11 @@ export class WebsiteComponent implements OnInit {
(res)=>{ (res)=>{
if(res.errCode == 10000){ if(res.errCode == 10000){
this.message.info('添加成功'); this.message.info('添加成功');
this.isVisible = false;
this.done.emit();
this.initForm(); this.initForm();
}else{ }else{
this.message.info(res.errMsg); this.message.info(res.apiResponse.errMsg);
} }
} }
) )
...@@ -75,7 +97,18 @@ export class WebsiteComponent implements OnInit { ...@@ -75,7 +97,18 @@ export class WebsiteComponent implements OnInit {
//更新 //更新
update(){ update(){
this.overAllSer.updateWebscenario(this.validateForm).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.info('添加成功');
this.isVisible = false;
this.done.emit();
this.initForm();
}else{
this.message.info(res.apiResponse.errMsg);
}
}
)
} }
handleCancel() { handleCancel() {
...@@ -86,4 +119,25 @@ export class WebsiteComponent implements OnInit { ...@@ -86,4 +119,25 @@ export class WebsiteComponent implements OnInit {
this.tabNum = index; this.tabNum = index;
} }
//添加步骤
addStep(){
this.indexNo += 1;
const data =
{
name:'',
url:'',
status_codes:200,
posts:'',
no:this.indexNo,
timeout:'15',
follow_redirects:'1',
condition:'',
faultCondition:'',
};
this.steps.push(data);
}
deleteStep(index){
this.steps.splice(index,1);
}
} }
...@@ -159,7 +159,7 @@ ...@@ -159,7 +159,7 @@
<span (click)="showImageModal(data)">图表</span> <span (click)="showImageModal(data)">图表</span>
</td> </td>
<td class="handle cursor"> <td class="handle cursor">
<span (click)="deleteCheckItem(data)">编辑</span> <span (click)="showEditModal(data)">编辑</span>
<span (click)="deleteCheckItem(data)">删除</span> <span (click)="deleteCheckItem(data)">删除</span>
<span *ngIf="data.itemState == 0" (click)="updateItem(data.itemid,1)">停止</span> <span *ngIf="data.itemState == 0" (click)="updateItem(data.itemid,1)">停止</span>
<span *ngIf="data.itemState == 1" (click)="updateItem(data.itemid,0)">启用</span> <span *ngIf="data.itemState == 1" (click)="updateItem(data.itemid,0)">启用</span>
......
...@@ -137,9 +137,9 @@ export class BasicDetailComponent implements OnInit, AfterViewInit { ...@@ -137,9 +137,9 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
this.overAllSer.responseTime(this.hostId).subscribe( this.overAllSer.responseTime(this.hostId).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.responseTimeStr = res.data.responseTime; this.responseTimeStr = res.data.responseTime.toFixed(2);
const responseTime = res.data.responseTime; const responseTime = this.responseTimeStr;
const other = 100 - res.data.responseTime; const other = 100 - this.responseTimeStr;
const data = [ const data = [
{value: responseTime}, {value: responseTime},
{value: other}, {value: other},
...@@ -591,7 +591,12 @@ export class BasicDetailComponent implements OnInit, AfterViewInit { ...@@ -591,7 +591,12 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//添加监测点 //添加监测点
showCheckModal() { showCheckModal() {
this.smartCheck.showCheckModal(this.hostId); this.smartCheck.showAddModal(this.hostId);
}
//编辑监测点
showEditModal(item){
this.smartCheck.showEditModal(this.hostId,item.itemid);
} }
handleCheckCancel() { handleCheckCancel() {
......
...@@ -207,7 +207,7 @@ export class BasicComponent implements OnInit { ...@@ -207,7 +207,7 @@ export class BasicComponent implements OnInit {
//添加监测点 //添加监测点
showBasicCheckModal(hostid) { showBasicCheckModal(hostid) {
this.smartCheck.showCheckModal(hostid); this.smartCheck.showAddModal(hostid);
} }
//列表 //列表
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
</nz-table> </nz-table>
<!--添加网站--> <!--添加网站-->
<smart-website #smartWebsite></smart-website> <smart-website #smartWebsite (done)="getwebList()"></smart-website>
<!--临时暂停--> <!--临时暂停-->
<smart-pause #smartPause (done)="getwebList()"></smart-pause> <smart-pause #smartPause (done)="getwebList()"></smart-pause>
\ No newline at end of file
...@@ -104,6 +104,11 @@ export class NetworkCheckComponent implements OnInit { ...@@ -104,6 +104,11 @@ export class NetworkCheckComponent implements OnInit {
this.smartWebsite.showAddModal(); this.smartWebsite.showAddModal();
} }
//编辑网站
editBasicModal(item){
this.smartWebsite.showEditModal(item.httptestid)
}
//批量开启or关闭 //批量开启or关闭
openBatchHost(status,operation){ openBatchHost(status,operation){
if(this.batchSelectList.length == 0){ if(this.batchSelectList.length == 0){
......
...@@ -154,6 +154,11 @@ export class OverAllService { ...@@ -154,6 +154,11 @@ export class OverAllService {
return this.http.post(SERVER_API_URL + '/item/find/' ,data); return this.http.post(SERVER_API_URL + '/item/find/' ,data);
} }
//查询监控项
findItemDetail(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/item/details/' +params);
}
//监控项分类 //监控项分类
findItemType(data): Observable<any>{ findItemType(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/application/find' ,data); return this.http.post(SERVER_API_URL + '/application/find' ,data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment