Commit df387ba8 authored by wangqinghua's avatar wangqinghua

update

parent 4da4012d
......@@ -34,7 +34,7 @@
<div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="选择设备类型" [(ngModel)]="obj.equipmentType" >
<ng-container *ngFor="let item of warnCountList;">
<nz-option nzLabel="{{item.equipmentType}}" nzValue="{{item.equipmentTypeId}}"></nz-option>
<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</ng-container>
</nz-select>
</div>
......
......@@ -72,7 +72,7 @@ export class AlarmListComponent implements OnInit {
this.overAllSer.findGroup().subscribe(
(res) => {
if (res.errCode == 10000) {
this.groupList = res.data;
this.groupList = res.data.data;
}
}
);
......
import { HttpClient } from "@angular/common/http";
import {Observable} from "rxjs/Rx";
import { Injectable } from '@angular/core';
import {SERVER_API_URL} from "../app.constants";
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs/Rx';
import {Injectable} from '@angular/core';
import {SERVER_API_URL} from '../app.constants';
@Injectable()
export class AlarmService {
......@@ -10,127 +10,127 @@ export class AlarmService {
}
//告警list
eventFind(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/event/find',data);
eventFind(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/alertLog/page', data);
}
//告警推送日志
alertFind(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/alert/find',data);
alertFind(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/alert/find', data);
}
//删除告警推送日志
alertDelete(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/alert/delete',data);
alertDelete(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/alert/delete', data);
}
//查询告警推送设置
actionFind(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/action/find',data);
actionFind(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/action/find', data);
}
//查询单个告警推送设置
getAction(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/action/find/'+params);
getAction(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/action/find/' + params);
}
//查找所有zabbix用户
zUserFind(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/zuser/find',data);
zUserFind(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/zuser/find', data);
}
//修改告警推送设置
actionUpdate(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/action/update',data);
actionUpdate(data): Observable<any> {
return this.http.put(SERVER_API_URL + '/action/update', data);
}
//创建告警推送设置
actionCreate(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/action/create',data);
actionCreate(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/action/create', data);
}
//单个启用或禁用告警推送设置
actionStatus(params1,params2): Observable<any>{
return this.http.post(SERVER_API_URL + '/action/status/' + params1 + '/' +params2,null);
actionStatus(params1, params2): Observable<any> {
return this.http.post(SERVER_API_URL + '/action/status/' + params1 + '/' + params2, null);
}
//批量启用或禁用告警设置
actionStatusBatch(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/action/status-batch',data);
actionStatusBatch(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/action/status-batch', data);
}
//批量删除告警推送设置
actionDelete(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/action/delete',data);
actionDelete(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/action/delete', data);
}
//查询所有告警组
alertGroupFind(): Observable<any>{
alertGroupFind(): Observable<any> {
return this.http.get(SERVER_API_URL + '/alertGroup/findAll');
}
//创建告警组
alertGroupCreate(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/alertGroup/create',data);
alertGroupCreate(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/alertGroup/create', data);
}
//修改告警组
alertGroupUpdate(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/alertGroup/update',data);
alertGroupUpdate(data): Observable<any> {
return this.http.put(SERVER_API_URL + '/alertGroup/update', data);
}
//删除告警组
alertGroupDelete(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/alertGroup/delete',data);
alertGroupDelete(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/alertGroup/delete', data);
}
//发送方式列表
mediaTypeFind(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/mediaType/find',data);
mediaTypeFind(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/mediaType/find', data);
}
//添加发送方式
mediaTypeCreate(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/mediaType/create',data);
mediaTypeCreate(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/mediaType/create', data);
}
//删除发送方式
mediaTypeDelete(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/mediaType/delete',data);
mediaTypeDelete(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/mediaType/delete', data);
}
//修改发送方式
mediaTypeUpdate(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/mediaType/update',data);
mediaTypeUpdate(data): Observable<any> {
return this.http.put(SERVER_API_URL + '/mediaType/update', data);
}
//单个启用或禁用发送方式
mediaTypeStatus(params1,params2): Observable<any>{
return this.http.post(SERVER_API_URL + '/mediaType/status/'+ params1 + '/' +params2,null);
mediaTypeStatus(params1, params2): Observable<any> {
return this.http.post(SERVER_API_URL + '/mediaType/status/' + params1 + '/' + params2, null);
}
//批量启用或禁用发送方式
mediaTypeStatusBatch(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/mediaType/status-batch',data);
mediaTypeStatusBatch(data): Observable<any> {
return this.http.put(SERVER_API_URL + '/mediaType/status-batch', data);
}
//查询发送方式详情
getMediaType(params): Observable<any>{
getMediaType(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/mediaType/find/' + params);
}
//查找告警目标
findAlertTarget(): Observable<any>{
findAlertTarget(): Observable<any> {
return this.http.get(SERVER_API_URL + '/action/findAlertTarget');
}
//导出当前告警列表
getExportUrlEvent(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/event/getExportUrl',data);
getExportUrlEvent(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/event/getExportUrl', data);
}
//告警推送日志导出
getExportUrlAlert(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/alert/getExportUrl',data);
getExportUrlAlert(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/alert/getExportUrl', data);
}
}
......@@ -62,7 +62,7 @@ export class NowAlarmComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.getType();
// this.getType();
this.search();
this.time_ = setInterval(() => {
this.search();
......
......@@ -58,7 +58,6 @@ export class AlarmModalComponent implements OnInit {
this.getSendFun();
this.getACtion();
this.getGroup();
this.getZabbixObj();
this.getEventType();
}
......@@ -195,17 +194,6 @@ export class AlarmModalComponent implements OnInit {
);
}
//获取发送对象 zabbix
getZabbixObj() {
this.alarmSer.zUserFind({}).subscribe(
(res) => {
if (res.errCode == 10000) {
this.objList = res.data;
}
}
);
}
//添加发送方式
addOption() {
const data = {
......
......@@ -5,7 +5,6 @@ import {
FormGroup,
Validators
} from '@angular/forms';
import {BasicKeyComponent} from '../basic-key/basic-key.component';
import {NzMessageService} from 'ng-zorro-antd';
import {NewTypeComponent} from '../new-type/new-type.component';
......@@ -29,19 +28,16 @@ import {NewTypeComponent} from '../new-type/new-type.component';
]
})
export class BasiCheckComponent implements OnInit {
@ViewChild('basicKey') basicKey: BasicKeyComponent;
@ViewChild('newType') newType: NewTypeComponent;
@Output() done = new EventEmitter<any>();
title;
isCheck = false;
isOkLoading = false;
isInterface = true; //添加模版监测点的时候不需要主机接口
nzSize = 'large';
hostId; //主机ID
hostName; //主机name
itemId; //监控项id
interfaceList: any[];
valueMapList = [];
validateForm: FormGroup;
checkList; //监测点分类
......@@ -61,7 +57,6 @@ export class BasiCheckComponent implements OnInit {
ngOnInit() {
this.initForm();
this.getValuemap();
}
initForm() {
......@@ -69,18 +64,16 @@ export class BasiCheckComponent implements OnInit {
this.validateForm = this.fb.group({
hostid: [this.hostId],
name: [null, [Validators.required]],
interfaceid: [null],
key_: [null, [Validators.required]],
value_type: [null, [Validators.required]],
key: [null, [Validators.required]],
valueType: [null, [Validators.required]],
type: [null, [Validators.required]],
units: [null],
units: [null, [Validators.required]],
history: ['3600'],
trends: [null],
snmpCommunity: ['public'],
delay: [null, [Validators.required]],
snmp_oid: ['interfaces.ifTable.ifEntry.ifInOctets.1'],
snmp_community: ['public'],
applications: [null],
interfaceid: [null],
templateid:[null],
description:[null],
});
this.triggerObj = {
condition: '',
......@@ -95,34 +88,7 @@ export class BasiCheckComponent implements OnInit {
this.isCheck = true;
this.hostId = hostId;
this.hostName = hostName;
if(this.title == '添加监测点'){
//主机接口
this.overAllSer.findInterface(this.hostId).subscribe(
(res) => {
this.interfaceList = res.data;
}
);
this.isInterface = true;
}
if(this.title == '添加模版监测点'){
this.isInterface = false;
this.validateForm.get('interfaceid').clearValidators();
}
this.getItemType();
}
//映射值
getValuemap() {
// this.overAllSer.findValuemap().subscribe(
// (res) => {
// if (res.errCode == 10000) {
// this.valueMapList = res.data;
// } else {
// this.message.error(res.errMsg);
// }
// }
// );
// this.getItemType();
}
//编辑
......@@ -133,32 +99,21 @@ export class BasiCheckComponent implements OnInit {
this.isCheck = true;
this.itemId = id;
this.hostName = hostName;
if(this.title == '编辑模版监测点'){
this.isInterface = false;
this.validateForm.get('interfaceid').clearValidators();
}
this.overAllSer.findItemDetail(id).subscribe(
(res) => {
const data = res.data[0];
data.type += '';
data.interfaceid += '';
data.value_type += '';
if(data.applications){
data.applications = data.applications.map(e=>{
return e.applicationid;
});
}
data.valueType += '';
// if(data.applications){
// data.applications = data.applications.map(e=>{
// return e.applicationid;
// });
// }
this.validateForm.patchValue(data);
}
);
//主机接口
this.overAllSer.findInterface(this.hostId).subscribe(
(res) => {
this.interfaceList = res.data;
}
);
this.getItemType();
// this.getItemType();
}
//获取监测点分类
......@@ -244,11 +199,6 @@ export class BasiCheckComponent implements OnInit {
this.initForm();
}
//键值查询
showKeymodal() {
this.basicKey.showKeyModal();
}
//新增分类
showTypeModal() {
this.newType.showModal('新建分类');
......@@ -264,7 +214,7 @@ export class BasiCheckComponent implements OnInit {
(res) => {
if (res.errCode == 10000) {
this.message.success('添加成功');
this.getItemType();
// this.getItemType();
}
}
);
......@@ -272,7 +222,7 @@ export class BasiCheckComponent implements OnInit {
getKey(keyValue): void {
const d = {
key_: keyValue
key: keyValue
};
this.validateForm.patchValue(d);
}
......
......@@ -56,6 +56,7 @@ export class BasicEditComponent implements OnInit {
isYesInVentory = 'primary';
isNOInVentory = 'default';
inventoryParentId;
equipmentTypeid;
constructor(private fb: FormBuilder, private overAllSer: OverAllService,
private emitService: EmitService,
......@@ -80,13 +81,15 @@ export class BasicEditComponent implements OnInit {
//获取分组
getGroup() {
this.groupList = [];
this.overAllSer.getEditGroups(0).subscribe(
this.overAllSer.findGroup().subscribe(
(res) => {
for (let i = 0; i < res.data.length; i++) {
const gObj = {
label: res.data[i].name, value: res.data[i].groupid, checked: false
};
this.groupList.push(gObj);
if (res.errCode == 10000) {
res.data.data.forEach(e => {
e.label = e.name;
e.value = e.id;
e.checked = false;
});
this.groupList = res.data.data;
}
}
);
......@@ -130,14 +133,6 @@ export class BasicEditComponent implements OnInit {
const data = res.data[0];
this.validateForm.name = data.name;
this.validateForm.host = data.host;
this.validateForm.ipmi_authtype = data.ipmi_authtype + '';
this.validateForm.ipmi_username = data.ipmi_username + '';
this.validateForm.ipmi_privilege = data.ipmi_privilege + '';
this.validateForm.ipmi_password = data.ipmi_password + '';
this.validateForm.tls_psk_identity = data.tls_psk_identity + '';
this.validateForm.tls_issuer = data.tls_issuer + '';
this.validateForm.tls_subject = data.tls_subject + '';
this.validateForm.tls_psk = data.tls_psk + '';
//分组对象
if (data.groups) {
......@@ -249,12 +244,9 @@ export class BasicEditComponent implements OnInit {
const interfaceArr = [];
this.interfaceslist.forEach(res => {
const a = {
main: res.main,
ip: res.ip,
dns: res.dns,
type: res.type,
port: res.port,
useip: res.useip,
bulk: ''
};
if (res.type == '2') {
......@@ -275,7 +267,14 @@ export class BasicEditComponent implements OnInit {
if (!this.isInVentory) {
this.validateForm.inventoryExtend = null;
}
console.log(this.validateForm);
let clearArr = [];
this.validateForm.templates.forEach(e=>{
const d = {
id:e
};
clearArr.push(d);
});
this.validateForm.templates = clearArr;
this.overAllSer.createHost(this.validateForm).subscribe(
(res) => {
if (res.errCode == 10000) {
......@@ -297,12 +296,9 @@ export class BasicEditComponent implements OnInit {
const interfaceArr = [];
this.interfaceslist.forEach(res => {
const a = {
main: res.main,
ip: res.ip,
dns: res.dns,
type: res.type,
port: res.port,
useip: res.useip,
bulk: '',
hostid: this.hostId,
interfaceid: res.interfaceid
......@@ -326,9 +322,13 @@ export class BasicEditComponent implements OnInit {
}
this.templatesResoure.forEach(res => {
if (this.validateForm.templates.indexOf(res) == -1) {
clearArr.push(res);
const d = {
id:res
};
clearArr.push(d);
}
});
this.validateForm.clearTemplateids = clearArr;
if (this.macroTYpe == 'macroExpand') {
......@@ -397,12 +397,9 @@ export class BasicEditComponent implements OnInit {
//接口add
addInterfaces() {
const demo = {
main: '0',
ip: '',
dns: '',
type: '1',
type: '2',
port: '10050',
useip: 1,
bulk: true,
};
this.interfaceslist.push(demo);
......@@ -519,12 +516,9 @@ export class BasicEditComponent implements OnInit {
];
this.interfaceslist = [ //接口list
{
main: '1',
ip: '',
dns: '',
type: '1',
port: '10050',
useip: 1,
bulk: true,
}
];
......@@ -534,7 +528,6 @@ export class BasicEditComponent implements OnInit {
hostExtend: {
equipmentTypeid: null,
secondLevelTypeid: null,
// serviceid: ''
},
macros: this.macroList1,
interfaces: null, //接口
......@@ -556,14 +549,6 @@ export class BasicEditComponent implements OnInit {
templates: null,
name: null,
host: null,
ipmi_authtype: null,
ipmi_username: null,
ipmi_privilege: null,
ipmi_password: null,
tls_psk_identity: null,
tls_issuer: null,
tls_subject: null,
tls_psk: null,
};
}
}
......@@ -45,7 +45,7 @@ export class WarnListComponent implements OnInit {
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount,
obj: obj
// obj: obj
};
this.alarmSer.eventFind(data).subscribe(
(res) => {
......
......@@ -129,7 +129,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
this.hostId = queryParams.hostId;
this.overAllSer.findDetailed(this.hostId).subscribe(
(res)=>{
let data = res.data[0]
let data = res.data;
this.hostName = data.name; //显示名
this.realName = data.host; //主机名
}
......@@ -138,11 +138,11 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
}
ngOnInit() {
this.isSpinning = true;
this.responseTime();
this.losed();
this.cpused();
this.used();
this.isSpinning = false;
// this.responseTime();
// this.losed();
// this.cpused();
// this.used();
// this.inOutInfo();
//监测点
......@@ -153,7 +153,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
hostid:this.hostId
};
this.warnList.getList(obj);
this.disks();
// this.disks();
}
ngAfterViewInit() {
......@@ -614,7 +614,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//进出口流量-SNMP
inOutInfo() {
this.inOutLoading = true;
this.inOutLoading = false;
const data = {
obj:{
hostid:Number(this.hostId)
......@@ -662,7 +662,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//添加or编辑监测点 之后
getList(){
this.getCheckList();
this.findItemType();
// this.findItemType();
}
handleKeyCancel() {
......@@ -676,7 +676,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//监测点列表
getCheckList() {
this.getCheckStatus();
this.loading = true;
this.loading = false;
const data = {
pageNum: this.pageIndex,
pageCount: pageSize,
......
......@@ -139,18 +139,6 @@
<span (click)="goEquip(item)">{{item?.equipmentType}}</span>
</td>
<td class="default">
<ng-container *ngIf="!item.available || 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-tooltip [nzTitle]="item.error">
<nz-tag nz-tooltip [nzColor]="'#d44f51'">AGENT</nz-tag>
</nz-tooltip>
</ng-container>
<ng-container *ngIf=" !item.snmp_available || item.snmp_available == 0">
<nz-tooltip [nzTitle]="item?.snmp_error">
<nz-tag>SNMP</nz-tag>
......@@ -176,18 +164,6 @@
<nz-tag nz-tooltip [nzColor]="'#d44f51'">JMX</nz-tag>
</nz-tooltip>
</ng-container>
<ng-container *ngIf="!item.ipmi_available || 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-tooltip [nzTitle]="item.ipmi_error">
<nz-tag nz-tooltip [nzColor]="'#d44f51'">IPMI</nz-tag>
</nz-tooltip>
</ng-container>
</td>
<td class="handle main-color">
<span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
......@@ -203,8 +179,7 @@
<ng-container *ngIf="item.status == 0">停止</ng-container>
监控
</a></li>
<li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li>
<li (click)="showAlarm()" nz-menu-item><a>添加告警</a></li>
<!-- <li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li>-->
</ul>
</nz-dropdown>
</td>
......@@ -223,4 +198,4 @@
<!--临时暂停-->
<smart-pause #smartPause (done)="handleOk($event)"></smart-pause>
<!--添加告警-->
<smart-alarm-modal #smartAlarmModal></smart-alarm-modal>
<!--<smart-alarm-modal #smartAlarmModal></smart-alarm-modal>-->
......@@ -48,7 +48,7 @@ export class BasicComponent implements OnInit {
@ViewChild('smartCheck') smartCheck: BasiCheckComponent;
@ViewChild('smartCreateGroup') smartCreateGroup: CreateGroupComponent;
@ViewChild('smartPause') smartPause: PauseComponent;
@ViewChild('smartAlarmModal') smartAlarmModal: AlarmModalComponent;
// @ViewChild('smartAlarmModal') smartAlarmModal: AlarmModalComponent;
color = color;
......@@ -171,7 +171,7 @@ export class BasicComponent implements OnInit {
this.overAllSer.findGroup().subscribe(
(res) => {
if (res.errCode == 10000) {
this.groupList = res.data;
this.groupList = res.data.data;
this.search();
}
}
......@@ -404,7 +404,7 @@ export class BasicComponent implements OnInit {
//添加告警
showAlarm() {
this.smartAlarmModal.showAddModal('添加告警', null);
// this.smartAlarmModal.showAddModal('添加告警', null);
}
handleOk(e) {
......
......@@ -111,7 +111,7 @@ export class OverAllService {
//创建监控点
create(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/item/create', data);
return this.http.post(SERVER_API_URL + '/item/save', data);
}
//删除资源--get
......@@ -131,7 +131,7 @@ export class OverAllService {
//模版信息
templates(): Observable<any> {
return this.http.get(SERVER_API_URL + '/templates');
return this.http.get(SERVER_API_URL + '/template/list');
}
//添加分组
......@@ -151,7 +151,7 @@ export class OverAllService {
//删除监控项
deleteItem(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/item/deleteItem', data);
return this.http.post(SERVER_API_URL + '/item/delete', data);
}
//监控设备数
......@@ -161,7 +161,7 @@ export class OverAllService {
//监测点列表--type
findCheckByType(data): Observable<any> {
return this.http.post(SERVER_API_URL + '/item/find/', data);
return this.http.post(SERVER_API_URL + '/item/page', data);
}
//查询监控项
......@@ -181,7 +181,7 @@ export class OverAllService {
//监测点状态统计
findItemCount(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/item/findItemStatistics/' + params);
return this.http.get(SERVER_API_URL + '/item/finditemstatus/' + params);
}
//监测点图形数据
......@@ -538,6 +538,6 @@ export class OverAllService {
//查询系统信息
getSystem(): Observable<any> {
return this.http.get( './json/system.json');
return this.http.get('./json/system.json');
}
}
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