Commit 6ecd7267 authored by wangqinghua's avatar wangqinghua

网站监测

parent d81c8f47
......@@ -21,7 +21,7 @@
<div nz-row class="search-form">
<div nz-col nzSpan="16">
<span>当前告警数:120</span>
<span>当前告警数:{{alarmTotal}}</span>
</div>
</div>
<div class="tag-warn tag-form">
......@@ -32,6 +32,6 @@
</span>
</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>
\ No newline at end of file
......@@ -33,6 +33,7 @@ export class NowAlarmComponent implements OnInit {
@ViewChild('warnList') warnList:WarnListComponent;
color = color;
alarmTotal;
warnCountList = [];
loading = false;
pageCount = pageSize;
......@@ -51,7 +52,7 @@ export class NowAlarmComponent implements OnInit {
search(){
const obj = {
isWaring:'yes'
}
};
this.warnList.getList(obj);
}
......@@ -75,4 +76,8 @@ export class NowAlarmComponent implements OnInit {
showModal(data){
this.sendLog.showModal(data);
}
getTotal(num){
this.alarmTotal = num;
}
}
<section>
<nz-modal [nzWidth]="880" [(nzVisible)]="isCheck" nzTitle="添加检测点" (nzOnCancel)="handleCheckCancel()"
<nz-modal [nzWidth]="880" [(nzVisible)]="isCheck" [nzTitle]="title" (nzOnCancel)="handleCheckCancel()"
(nzOnOk)="handleCheckOk()">
<form nz-form>
<div style="padding: 16px;font-size: 18px;">基本属性</div>
......
......@@ -26,6 +26,8 @@ import {NewTypeComponent} from '../new-type/new-type.component';
export class BasiCheckComponent implements OnInit {
@ViewChild('basicKey') basicKey: BasicKeyComponent;
@ViewChild('newType') newType: NewTypeComponent;
title;
isCheck = false;
hostId; //主机ID
interfaceList: any[];
......@@ -52,32 +54,10 @@ export class BasiCheckComponent implements OnInit {
}
ngOnInit() {
this.validateForm = {
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
};
this.initForm();
}
//初始化信息
showCheckModal(hostId) {
this.isCheck = true;
this.hostId = hostId;
initForm(){
this.validateForm = {
hostid: this.hostId,
name: null,
......@@ -99,6 +79,38 @@ export class BasiCheckComponent implements OnInit {
formula: 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(
......
......@@ -33,6 +33,8 @@ export class BasicEditComponent implements OnInit {
panel1 = {name: '配置IPMI', active: true};
panel2 = {name: '配置宏', active: true};
templatesResoure = [];
//加密
otherHost;
......@@ -107,6 +109,7 @@ export class BasicEditComponent implements OnInit {
return res.templateid;
});
this.validateForm.templates = tempArr;
this.templatesResoure = tempArr;
}
this.interfaceslist = data.interfaces;
this.interfaceslist.forEach(res => {
......@@ -196,6 +199,16 @@ export class BasicEditComponent implements OnInit {
//更新
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') {
this.validateForm.macros = this.macroList2;
}
......@@ -320,6 +333,7 @@ export class BasicEditComponent implements OnInit {
//初始化Form信息
initForm() {
this.templatesResoure = [];
this.macroList1 = [ //配置宏数组
{
macro: '{$SNMP_COMMUNITY}',
......
......@@ -22,7 +22,7 @@
<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>
</td>
<td>名称</td>
<td>{{data.hostname}}</td>
<td>{{data.description}}</td>
<td>{{data.equipmentType}}</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 {pageSize} from '../../app.constants';
import {NzMessageService} from 'ng-zorro-antd';
......@@ -18,6 +18,7 @@ import {SendLogComponent} from '../../alarm/modal/send-log/send-log.component';
})
export class WarnListComponent implements OnInit {
@ViewChild('sendLog') sendLog:SendLogComponent;
@Output() total = new EventEmitter<any>();
warnList = [];
obj;
......@@ -45,6 +46,7 @@ export class WarnListComponent implements OnInit {
if(res.errCode == 10000){
this.warnList = res.data.data;
this.totalNum = res.data.totalNum;
this.total.emit(this.totalNum);
}else{
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()">
<nz-tabset [nzSelectedIndex]="tabNum" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="1.场景">
......@@ -9,7 +9,7 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<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">
<input id="name" name="name" nz-input placeholder="默认" [(ngModel)]="validateForm.name">
</nz-form-control>
......@@ -52,7 +52,7 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="24">
<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">
<input id="http_proxy" name="http_proxy" nz-input placeholder="默认"
[(ngModel)]="validateForm.http_proxy">
......@@ -128,8 +128,8 @@
</nz-tab>
<nz-tab nzTitle="2.步骤">
<button nz-button nzType="default">添加步骤</button>
<div >
<button (click)="addStep()" nz-button nzType="default">添加步骤</button>
<div>
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="1">
No
......@@ -156,32 +156,33 @@
</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">
1
{{i +1}}
</div>
<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-col [nzSpan]="3">
<input nz-input placeholder="默认30s">
<input nz-input placeholder="15" [(ngModel)]="item.timeout">
</nz-form-control>
<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-col [nzSpan]="3">
<input nz-input placeholder="" >
<input nz-input placeholder="" [(ngModel)]="item.posts">
</nz-form-control>
<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-col [nzSpan]="3">
<nz-select name="equipmentType" nzPlaceHolder="选择设备类型">
<nz-option nzValue="是" nzLabel="是"></nz-option>
<nz-select name="equipmentType" nzPlaceHolder="是否跟随跳转" [(ngModel)]="item.follow_redirects">
<nz-option nzValue="1" nzLabel="是"></nz-option>
<nz-option nzValue="0" nzLabel="否"></nz-option>
</nz-select>
</nz-form-control>
<div nz-col [nzSpan]="1">
<span class="cursor">X</span>
<span (click)="deleteStep(index)" class="cursor">X</span>
</div>
</div>
</div>
......@@ -189,6 +190,7 @@
<div class="modal-footer-btn">
<button nz-button (click)="handleCancel()" nzType="primary">取消</button>
<button nz-button (click)="tabsChange(0)" nzType="primary">上一步</button>
<button nz-button (click)="tabsChange(2)" nzType="primary">下一步</button>
</div>
</nz-tab>
......
import {Component, OnInit} from '@angular/core';
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {OverAllService} from '../../overAll/overAll.service';
import {NzMessageService} from 'ng-zorro-antd';
......@@ -9,9 +9,11 @@ import {NzMessageService} from 'ng-zorro-antd';
})
export class WebsiteComponent implements OnInit {
@Output() done = new EventEmitter<any>();
isVisible = false;
title;
tabNum = 0;
indexNo = 1;
validateForm;
steps = [];
......@@ -24,18 +26,27 @@ export class WebsiteComponent implements OnInit {
}
initForm() {
this.steps = [];
this.steps = [
{
name:'',
url:'',
status_codes:200,
posts:'',
no:this.indexNo,
timeout:'15',
follow_redirects:'1',
condition:'',
faultCondition:'',
}
];
this.validateForm = {
name: '',
hostid: null,
applicationid: null,
delay: '',
retries: null,
variables: '',
http_proxy: '',
ssl_cert_file: '',
ssl_key_file: '',
ssl_key_password: '',
delay:'',
retries:'',
http_proxy:'',
ssl_cert_file:'',
ssl_key_file:'',
ssl_key_password:'',
steps: this.steps,
};
}
......@@ -45,8 +56,17 @@ export class WebsiteComponent implements OnInit {
this.isVisible = true;
}
showEditModal() {
showEditModal(id) {
this.title = '编辑网站监测';
this.isVisible = true;
this.overAllSer.findWeb(id).subscribe(
(res)=>{
if(res.errCode == 10000){
this.validateForm = res.data;
this.steps = res.data.steps;
}
}
)
}
handleOk() {
......@@ -65,9 +85,11 @@ export class WebsiteComponent implements OnInit {
(res)=>{
if(res.errCode == 10000){
this.message.info('添加成功');
this.isVisible = false;
this.done.emit();
this.initForm();
}else{
this.message.info(res.errMsg);
this.message.info(res.apiResponse.errMsg);
}
}
)
......@@ -75,7 +97,18 @@ export class WebsiteComponent implements OnInit {
//更新
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() {
......@@ -86,4 +119,25 @@ export class WebsiteComponent implements OnInit {
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 @@
<span (click)="showImageModal(data)">图表</span>
</td>
<td class="handle cursor">
<span (click)="deleteCheckItem(data)">编辑</span>
<span (click)="showEditModal(data)">编辑</span>
<span (click)="deleteCheckItem(data)">删除</span>
<span *ngIf="data.itemState == 0" (click)="updateItem(data.itemid,1)">停止</span>
<span *ngIf="data.itemState == 1" (click)="updateItem(data.itemid,0)">启用</span>
......
......@@ -137,9 +137,9 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
this.overAllSer.responseTime(this.hostId).subscribe(
(res) => {
if (res.errCode == 10000) {
this.responseTimeStr = res.data.responseTime;
const responseTime = res.data.responseTime;
const other = 100 - res.data.responseTime;
this.responseTimeStr = res.data.responseTime.toFixed(2);
const responseTime = this.responseTimeStr;
const other = 100 - this.responseTimeStr;
const data = [
{value: responseTime},
{value: other},
......@@ -591,7 +591,12 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//添加监测点
showCheckModal() {
this.smartCheck.showCheckModal(this.hostId);
this.smartCheck.showAddModal(this.hostId);
}
//编辑监测点
showEditModal(item){
this.smartCheck.showEditModal(this.hostId,item.itemid);
}
handleCheckCancel() {
......
......@@ -207,7 +207,7 @@ export class BasicComponent implements OnInit {
//添加监测点
showBasicCheckModal(hostid) {
this.smartCheck.showCheckModal(hostid);
this.smartCheck.showAddModal(hostid);
}
//列表
......
......@@ -103,7 +103,7 @@
</nz-table>
<!--添加网站-->
<smart-website #smartWebsite></smart-website>
<smart-website #smartWebsite (done)="getwebList()"></smart-website>
<!--临时暂停-->
<smart-pause #smartPause (done)="getwebList()"></smart-pause>
\ No newline at end of file
......@@ -104,6 +104,11 @@ export class NetworkCheckComponent implements OnInit {
this.smartWebsite.showAddModal();
}
//编辑网站
editBasicModal(item){
this.smartWebsite.showEditModal(item.httptestid)
}
//批量开启or关闭
openBatchHost(status,operation){
if(this.batchSelectList.length == 0){
......
......@@ -154,6 +154,11 @@ export class OverAllService {
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>{
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