From 20af5598319cf508bd05c438abed2f7418450ae7 Mon Sep 17 00:00:00 2001 From: insanity Date: Tue, 7 Nov 2017 19:50:24 +0900 Subject: [PATCH] SensorDisplayItem ing --- .../meta/model/MetaSensorDisplayItem.java | 11 ++ src/main/resources/local/init.sql | 127 +++++++++++++----- .../MetaSensorDisplayItemServiceTest.java | 2 +- 3 files changed, 107 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorDisplayItem.java b/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorDisplayItem.java index dc2baed..2d6b18a 100644 --- a/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorDisplayItem.java +++ b/src/main/java/com/loafle/overflow/module/meta/model/MetaSensorDisplayItem.java @@ -18,6 +18,7 @@ public class MetaSensorDisplayItem { private MetaCrawler crawler; private MetaSensorItemUnit unit; private Date createDate; + private boolean isDefault; public MetaSensorDisplayItem() { @@ -93,4 +94,14 @@ public class MetaSensorDisplayItem { this.createDate = createDate; } + + @Basic + @Column(name="IS_DEFAULT", nullable = false, columnDefinition = "boolean default false") + public boolean getDefault() { + return isDefault; + } + + public void setDefault(boolean aDefault) { + isDefault = aDefault; + } } diff --git a/src/main/resources/local/init.sql b/src/main/resources/local/init.sql index b99d7d6..e510d23 100644 --- a/src/main/resources/local/init.sql +++ b/src/main/resources/local/init.sql @@ -925,38 +925,57 @@ INSERT INTO meta_sensor_item_key (id,create_date,froms,"key",option_json,crawler INSERT INTO meta_sensor_item_key (id,create_date,froms,"key",option_json,crawler_id,item_id,unit_id) VALUES ( '146','2017-06-26 19:49:04','Win32_OperatingSystem ','FreeSpaceInPagingFiles','','23','146','3'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'1','2017-11-07 16:08:59','','CPU Total usage (%)','ssh.cpu.usage.total','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'2','2017-11-07 16:08:59','','CPU User (%)','ssh.cpu.usage.user','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'3','2017-11-07 16:08:59','','CPU Nice (%)','ssh.cpu.usage.nice','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'4','2017-11-07 16:08:59','','CPU System (%)','ssh.cpu.usage.system','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'5','2017-11-07 16:08:59','','CPU Idle (%)','ssh.cpu.usage.idle','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'6','2017-11-07 16:08:59','','CPU IO wait (%)','ssh.cpu.usage.iowait','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'7','2017-11-07 16:08:59','','CPU IRQ (%)','ssh.cpu.usage.irq','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'8','2017-11-07 16:08:59','','CPU Soft IRQ (%)','ssh.cpu.usage.softirq','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'9','2017-11-07 16:08:59','','CPU Steal (%)','ssh.cpu.usage.steal','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'10','2017-11-07 16:08:59','','CPU Guest (%)','ssh.cpu.usage.guest','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'11','2017-11-07 16:08:59','','CPU Guest Nice (%)','ssh.cpu.usage.gnice','21','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'12','2017-11-07 16:08:59','','CPU Total usage (%)','wmi.cpu.usage.total','23','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'13','2017-11-07 16:08:59','','CPU Idle (%)','wmi.cpu.usage.idle','23','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'14','2017-11-07 16:08:59','','CPU Processor (%)','wmi.cpu.usage.processor','23','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'15','2017-11-07 16:08:59','','CPU User (%)','wmi.cpu.usage.user','23','1'); -INSERT INTO meta_sensor_display_item (id,create_date,description,display_name,"key",crawler_id,unit_id) VALUES ( -'16','2017-11-07 16:08:59','','CPU Privilege (%)','wmi.cpu.usage.privilege','23','1'); + +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'1','2017-11-07 16:08:59','true','','CPU Total usage (%)','ssh.cpu.usage.total','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'2','2017-11-07 16:08:59','false','','CPU User (%)','ssh.cpu.usage.user','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'3','2017-11-07 16:08:59','false','','CPU Nice (%)','ssh.cpu.usage.nice','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'4','2017-11-07 16:08:59','false','','CPU System (%)','ssh.cpu.usage.system','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'5','2017-11-07 16:08:59','false','','CPU Idle (%)','ssh.cpu.usage.idle','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'6','2017-11-07 16:08:59','false','','CPU IO wait (%)','ssh.cpu.usage.iowait','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'7','2017-11-07 16:08:59','false','','CPU IRQ (%)','ssh.cpu.usage.irq','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'8','2017-11-07 16:08:59','false','','CPU Soft IRQ (%)','ssh.cpu.usage.softirq','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'9','2017-11-07 16:08:59','false','','CPU Steal (%)','ssh.cpu.usage.steal','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'10','2017-11-07 16:08:59','false','','CPU Guest (%)','ssh.cpu.usage.guest','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'11','2017-11-07 16:08:59','false','','CPU Guest Nice (%)','ssh.cpu.usage.gnice','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'12','2017-11-07 16:08:59','true','','CPU Total usage (%)','wmi.cpu.usage.total','23','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'13','2017-11-07 16:08:59','false','','CPU Idle (%)','wmi.cpu.usage.idle','23','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'14','2017-11-07 16:08:59','false','','CPU Processor (%)','wmi.cpu.usage.processor','23','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'15','2017-11-07 16:08:59','false','','CPU User (%)','wmi.cpu.usage.user','23','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'16','2017-11-07 16:08:59','false','','CPU Privilege (%)','wmi.cpu.usage.privilege','23','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'17','2017-11-07 16:08:59','true','','Memory Total Usage (%)','ssh.mem.usage.total','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'18','2017-11-07 16:08:59','false','','Memory Free space (mb)','ssh.mem.usage.free','21','4'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'19','2017-11-07 16:08:59','false','','Buffered Memory (mb)','ssh.mem.usage.buffers','21','4'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'20','2017-11-07 16:08:59','false','','Cached Memory (mb)','ssh.mem.usage.cached','21','4'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'21','2017-11-07 16:08:59','true','','Swap Total Usage (%)','ssh.mem.swap.usage.total','21','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'22','2017-11-07 16:08:59','false','','Cached Swap (mb)','ssh.mem.swap.usage.cached','21','4'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'23','2017-11-07 16:08:59','true','','Memory Total usage (%)','wmi.mem.usage.total','23','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'24','2017-11-07 16:08:59','false','','Virtual Memory Usage (%)','wmi.mem.virtual.usage.total','23','1'); +INSERT INTO meta_sensor_display_item (id,create_date,is_default,description,display_name,"key",crawler_id,unit_id) VALUES ( +'25','2017-11-07 16:08:59','false','','Paging Usage (%)','wmi.mem.paging.usage.total','23','1'); INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( '1','1','119'); @@ -1014,6 +1033,50 @@ INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES '27','15','131'); INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( '28','16','132'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'29','17','133'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'30','17','134'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'31','17','135'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'32','17','136'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'33','17','137'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'34','18','134'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'35','19','136'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'36','20','137'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'37','21','138'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'38','21','139'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'39','21','140'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'40','22','140'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'41','23','141'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'42','23','142'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'43','23','143'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'44','23','144'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'45','23','145'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'46','23','146'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'47','24','143'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'48','24','144'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'49','25','145'); +INSERT INTO meta_sensor_display_mapping (id,display_item_id,item_key_id) VALUES ( +'50','25','146'); INSERT INTO public.meta_vendor_crawler (id,create_date,crawler_id,vendor_id) VALUES ( 1,'2017-07-27 15:29:48.634',23,26); diff --git a/src/test/java/com/loafle/overflow/module/meta/service/MetaSensorDisplayItemServiceTest.java b/src/test/java/com/loafle/overflow/module/meta/service/MetaSensorDisplayItemServiceTest.java index 9fb7849..87ed0a0 100644 --- a/src/test/java/com/loafle/overflow/module/meta/service/MetaSensorDisplayItemServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/meta/service/MetaSensorDisplayItemServiceTest.java @@ -27,7 +27,7 @@ public class MetaSensorDisplayItemServiceTest { @Ignore public void regist() throws Exception { MetaSensorDisplayItem cpuTotal = new MetaSensorDisplayItem(); - cpuTotal.setId(1); + cpuTotal.setId(120); cpuTotal.setCrawler(new MetaCrawler((short)21)); cpuTotal.setCreateDate(new Date()); cpuTotal.setKey("CPU_TOTAL");