Commit 4738f890 authored by wangqinghua's avatar wangqinghua

log

parent 52b84d40
......@@ -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>
......
......@@ -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 = {
params:this.batchDelList
hostids: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')
});
}
}
......@@ -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
......@@ -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{
......
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