Commit e33dd557 by liuyz

更新监控服务

parent 4bca35ac
...@@ -127,9 +127,9 @@ ...@@ -127,9 +127,9 @@
<!-- 增加数据源dataSource-zabbix --> <!-- 增加数据源dataSource-zabbix -->
<bean id="dataSource-zabbix" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close"> <bean id="dataSource-zabbix" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password --> <!-- 基本属性 url、user、password -->
<property name="url" value="jdbc:mysql://192.168.1.142:3306/zabbix?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" /> <property name="url" value="jdbc:mysql://192.168.1.204:3306/zabbix?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;useSSL=false" />
<property name="username" value="root" /> <property name="username" value="zabbix" />
<property name="password" value="mysql_root_password" /> <property name="password" value="zabbix" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="driverClassName" value="com.mysql.jdbc.Driver" />
<!-- 配置初始化大小、最小、最大 --> <!-- 配置初始化大小、最小、最大 -->
......
...@@ -61,37 +61,48 @@ var ls_title="服务器列表"; ...@@ -61,37 +61,48 @@ var ls_title="服务器列表";
var is_column = [ [ var is_column = [ [
{field : 'NAME',title : '主机名',width : 100,align : 'center' {field : 'NAME',title : '主机名',width : 100,align : 'center'
}, },
{field : 'DESCRIPTION',title : '主机描述',width : 200,align : 'center' {field : 'DESCRIPTION',title : '主机描述',width : 150,align : 'center'
}, },
{field : 'IP',title : 'MAC/IP',width : 280,align : 'center',formatter:function(value,row,index){ {field : 'IP',title : 'MAC/IP',width : 280,align : 'center',formatter:function(value,row,index){
var json=eval('('+row.VALUE+')'); var json=eval('('+row.VALUE+')');
var ips=json.ip; var ips=json.ip;
var ipText=''; var ipText='';
for(var i=0;i<ips.length;i++){ for(var i=0;i<ips.length;i++){
var ip=ips[i]; if(ips[i].ip != ''){
ipText+=ips[i].ifname+":"+ips[i].ip;
ipText+='\n';
}
// ipText = ipText.substring(0, ipText.lastIndexOf('\n'));
/*var ip=ips[i];
for(k in ip){ for(k in ip){
if(ipText!=''){ if(ipText!=''){
ipText+='\n'; ipText+='\n';
} }
ipText+=k+":"+ip[k]; ipText+=k+":"+ip[k];
}*/
} }
} ipText = ipText.substring(0, ipText.lastIndexOf('\n'));
return ipText; return ipText;
} }
}, },
{field : 'DISK',title : '硬盘',width : 80,align : 'center',formatter:function(value,row,index){ {field : 'DISK',title : '硬盘',width : 120,align : 'center',formatter:function(value,row,index){
var json=eval('('+row.VALUE+')'); var json=eval('('+row.VALUE+')');
var disks=json.disk; var disks=json.disk;
var text=''; var text='';
for(var i=0;i<disks.length;i++){ for(var i=0;i<disks.length;i++){
var disk=disks[i]; if(disks[i].size != ''){
text+=disks[i].devicename+":"+disks[i].size;
text+='\n';
}
/*var disk=disks[i];
for(k in disk){ for(k in disk){
if(text!=''){ if(text!=''){
text+='\n'; text+='\n';
} }
text+=k+":"+disk[k]; text+=k+":"+disk[k];
}*/
} }
} text = text.substring(0, text.lastIndexOf('\n'));
return text; return text;
} }
}, },
...@@ -103,7 +114,7 @@ var is_column = [ [ ...@@ -103,7 +114,7 @@ var is_column = [ [
return text; return text;
} }
}, },
{field : 'MEMORY',title : '内存',width : 80,align : 'center',formatter:function(value,row,index){ {field : 'MEMORY',title : '内存',width : 60,align : 'center',formatter:function(value,row,index){
var json=eval('('+row.VALUE+')'); var json=eval('('+row.VALUE+')');
var memory=json.memory; var memory=json.memory;
var text=''; var text='';
...@@ -242,27 +253,37 @@ function updateUrlOnloadCallback(is_row){ ...@@ -242,27 +253,37 @@ function updateUrlOnloadCallback(is_row){
var disks=json.disk; var disks=json.disk;
var diskText=''; var diskText='';
for(var i=0;i<disks.length;i++){ for(var i=0;i<disks.length;i++){
var disk=disks[i]; if(disks[i].size != ''){
diskText+=disks[i].devicename+":"+disks[i].size;
diskText+=',';
}
/* var disk=disks[i];
for(k in disk){ for(k in disk){
if(diskText!=''){ if(diskText!=''){
diskText+=','; diskText+=',';
} }
diskText+=k+":"+disk[k]; diskText+=k+":"+disk[k];
}*/
} }
} diskText = diskText.substring(0, diskText.lastIndexOf(','));
is_row.DISK_INFO=diskText; is_row.DISK_INFO=diskText;
var ips=json.ip; var ips=json.ip;
var ipText=''; var ipText='';
for(var i=0;i<ips.length;i++){ for(var i=0;i<ips.length;i++){
var ip=ips[i]; if(ips[i].ip != ''){
ipText+=ips[i].ifname+":"+ips[i].ip;
ipText+=',';
}
/*var ip=ips[i];
for(k in ip){ for(k in ip){
if(ipText!=''){ if(ipText!=''){
ipText+=','; ipText+=',';
} }
ipText+=k+":"+ip[k]; ipText+=k+":"+ip[k];
}*/
} }
} ipText = ipText.substring(0, ipText.lastIndexOf(','));
is_row.IP_INFO=ipText; is_row.IP_INFO=ipText;
$("#inputForm").form('load',is_row); $("#inputForm").form('load',is_row);
} }
......
...@@ -39,6 +39,21 @@ function resetQueryData(){ ...@@ -39,6 +39,21 @@ function resetQueryData(){
var v_value_data = [{CODE_ID:'0',CODE_NAME:'正常'},{CODE_ID:'1',CODE_NAME:'问题'}]; var v_value_data = [{CODE_ID:'0',CODE_NAME:'正常'},{CODE_ID:'1',CODE_NAME:'问题'}];
//加载主机列表 //加载主机列表
var v_host_data = hostModule.data.listAll().rowSet; var v_host_data = hostModule.data.listAll().rowSet;
$('#FIELD_VALUE').combobox({
data : v_value_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
$('#FIELD_HOSTID').combobox({
data : v_host_data,
valueField : 'HOSTID',
textField : 'NAME',
editable:false,
panelHeight:'auto'
});
//加载是否提醒数据 //加载是否提醒数据
var v_status_data = [{CODE_ID:'0',CODE_NAME:'未发送'},{CODE_ID:'1',CODE_NAME:'已发送'}]; var v_status_data = [{CODE_ID:'0',CODE_NAME:'未发送'},{CODE_ID:'1',CODE_NAME:'已发送'}];
...@@ -87,7 +102,7 @@ var is_column = [ [ ...@@ -87,7 +102,7 @@ var is_column = [ [
] ]; ] ];
//列表加载完成回调 //列表加载完成回调
function dataOnLoadSuccess(){ function dataOnLoadSuccess(){
$('#FIELD_VALUE').combobox({ /*$('#FIELD_VALUE').combobox({
data : v_value_data, data : v_value_data,
valueField : 'CODE_ID', valueField : 'CODE_ID',
textField : 'CODE_NAME', textField : 'CODE_NAME',
...@@ -101,7 +116,7 @@ function dataOnLoadSuccess(){ ...@@ -101,7 +116,7 @@ function dataOnLoadSuccess(){
textField : 'NAME', textField : 'NAME',
editable:false, editable:false,
panelHeight:'auto' panelHeight:'auto'
}); });*/
} }
//设置颜色和每行高度 //设置颜色和每行高度
function rowstyler(index,row){ function rowstyler(index,row){
......
...@@ -6,8 +6,8 @@ userDefaultPass = 0000 ...@@ -6,8 +6,8 @@ userDefaultPass = 0000
uploadPath=c:/temp/ uploadPath=c:/temp/
uploadMaxSize=10485760 uploadMaxSize=10485760
#------------license---------------------------- #------------license----------------------------
licensenumber=A010000002 licensenumber=A010000003
licensedsoftware=A040000002 licensedsoftware=A040000007
licensemaccharset=gbk licensemaccharset=gbk
licensemacshowcmd=false licensemacshowcmd=false
licensemacadress=00-21-CC-C9-D2-29 licensemacadress=00-21-CC-C9-D2-29
...@@ -21,4 +21,4 @@ downloadFilenameEncode1 = gbk ...@@ -21,4 +21,4 @@ downloadFilenameEncode1 = gbk
downloadFilenameEncode2 = iso8859-1 downloadFilenameEncode2 = iso8859-1
#------------test_env---------------------- #------------test_env----------------------
test_env=true test_env=true
zabbixIp=http://192.168.1.204:8081/api_jsonrpc.php
\ No newline at end of file
...@@ -46,7 +46,7 @@ public class HostBusinessImpl implements HostBusiness { ...@@ -46,7 +46,7 @@ public class HostBusinessImpl implements HostBusiness {
page.setCount(count); page.setCount(count);
page.setItems(items); page.setItems(items);
String test_env = PropUtil.getValue("test_env", "quartz_service", "false"); /*String test_env = PropUtil.getValue("test_env", "quartz_service", "false");
if ("true".equals(test_env)) { if ("true".equals(test_env)) {
List<Map<String, Object>> listFake = new ArrayList<Map<String, Object>>() { List<Map<String, Object>> listFake = new ArrayList<Map<String, Object>>() {
public boolean add(String hostName, String description, String info) { public boolean add(String hostName, String description, String info) {
...@@ -79,10 +79,10 @@ public class HostBusinessImpl implements HostBusiness { ...@@ -79,10 +79,10 @@ public class HostBusinessImpl implements HostBusiness {
add("kqnhl server","管理kqnhl服务",makeInfo(getRandomIp(), new Random().nextInt(10) + 1 + "")); add("kqnhl server","管理kqnhl服务",makeInfo(getRandomIp(), new Random().nextInt(10) + 1 + ""));
add("yqhtk server","管理yqhtk服务",makeInfo(getRandomIp(), new Random().nextInt(10) + 1 + "")); add("yqhtk server","管理yqhtk服务",makeInfo(getRandomIp(), new Random().nextInt(10) + 1 + ""));
add("vnrvt server","管理vnrvt服务",makeInfo(getRandomIp(), new Random().nextInt(10) + 1 + "")); add("vnrvt server","管理vnrvt服务",makeInfo(getRandomIp(), new Random().nextInt(10) + 1 + ""));
/*for (int i = 0; i <= 20; i++) { for (int i = 0; i <= 20; i++) {
add(i + 100000, makeName() + " server", add(i + 100000, makeName() + " server",
makeInfo(getRandomIp(), new Random().nextInt(10) + 1 + "")); makeInfo(getRandomIp(), new Random().nextInt(10) + 1 + ""));
}*/ }
} }
}; };
if (pageNo == 1 && items.size() < 20) { if (pageNo == 1 && items.size() < 20) {
...@@ -96,7 +96,7 @@ public class HostBusinessImpl implements HostBusiness { ...@@ -96,7 +96,7 @@ public class HostBusinessImpl implements HostBusiness {
} }
page.setCount(23); page.setCount(23);
} }
} }*/
return page; return page;
} }
......
...@@ -45,7 +45,7 @@ public class TriggerBusinessImpl implements TriggerBusiness { ...@@ -45,7 +45,7 @@ public class TriggerBusinessImpl implements TriggerBusiness {
page.setCount(count); page.setCount(count);
page.setItems(items); page.setItems(items);
String test_env = PropUtil.getValue("test_env", "quartz_service", "false"); /*String test_env = PropUtil.getValue("test_env", "quartz_service", "false");
if("true".equals(test_env)){ if("true".equals(test_env)){
List<Map<String, Object>> listFake = new ArrayList<Map<String, Object>>() { List<Map<String, Object>> listFake = new ArrayList<Map<String, Object>>() {
public boolean add(int priority, String comments, String expression) { public boolean add(int priority, String comments, String expression) {
...@@ -58,26 +58,26 @@ public class TriggerBusinessImpl implements TriggerBusiness { ...@@ -58,26 +58,26 @@ public class TriggerBusinessImpl implements TriggerBusiness {
} }
{ {
add(4,"使用空间监控","{jfgitlab:vfs.fs.size[/,used].last()}>1G"); add(4,"使用空间监控","{192.168.1.201:vfs.fs.size[/,used].last()}>1G");
add(4,"剩余使用空间监控","{jfgitlab:vfs.fs.size[/,free].last()}<800M"); add(4,"剩余使用空间监控","{192.168.1.202:vfs.fs.size[/,free].last()}<800M");
add(1,"sda挂载盘io读取监控","{jfgitlab:disk.status[sda,rKBps].last()}>100"); add(1,"sda挂载盘io读取监控","{192.168.1.203:disk.status[sda,rKBps].last()}>100");
add(1,"sda挂载盘io写入监控","{jfgitlab:disk.status[sda,wKBps].last()}>400"); add(1,"sda挂载盘io写入监控","{192.168.1.203:disk.status[sda,wKBps].last()}>400");
add(2,"磁盘空间小于870M","{jfgitlab:vfs.fs.size[/boot,free].last()}<870M"); add(2,"磁盘空间小于870M","{192.168.1.204:vfs.fs.size[/boot,free].last()}<870M");
add(3,"剩余磁盘空间百分比监控","{jfgitlab:vfs.fs.size[/boot,pfree].last()}<20%"); add(3,"剩余磁盘空间百分比监控","{192.168.1.204:vfs.fs.size[/boot,pfree].last()}<20%");
add(4,"可用内存监控","{jfgitlab:vm.memory.size[available].last()}>70"); add(4,"可用内存监控","{192.168.1.211:vm.memory.size[available].last()}>70");
add(1,"veth30b22dd输出流量监控","{jfgitlab:net.if.out[veth30b22dd].last()}>400000"); add(1,"vnet2输出流量监控","{192.168.1.211:net.if.out[vnet2].last()}>400000");
add(1,"veth30b22dd输入流量监控","{jfgitlab:net.if.in[veth30b22dd].last()}>700000"); add(1,"vnet2输入流量监控","{192.168.1.211:net.if.in[vnet2].last()}>700000");
add(1,"ens33输出流量监控","{jfgitlab:net.if.out[ens33].last()}>500000"); add(1,"em3输出流量监控","{192.168.1.212:net.if.out[em3].last()}>500000");
add(1,"sda挂载盘io读取监控","{jfgitlab:disk.status[sda,rKBps].last()}>200"); add(1,"sda挂载盘io读取监控","{192.168.1.212:disk.status[sda,rKBps].last()}>200");
add(1,"sda挂载盘io写入监控","{jfgitlab:disk.status[sda,wKBps].last()}>500"); add(1,"sda挂载盘io写入监控","{192.168.1.212:disk.status[sda,wKBps].last()}>500");
add(2,"磁盘空间小于950M","{jfgitlab:vfs.fs.size[/boot,free].last()}<950M"); add(2,"磁盘空间小于950M","{192.168.1.213:vfs.fs.size[/boot,free].last()}<950M");
add(1,"veth399f0a6输出流量监控","{jfgitlab:net.if.out[veth399f0a6].last()}>400000"); add(1,"eth0输出流量监控","{192.168.1.213:net.if.out[eth0].last()}>400000");
add(1,"veth399f0a6输入流量监控","{jfgitlab:net.if.in[veth399f0a6].last()}>700000"); add(1,"eth0输入流量监控","{192.168.1.213:net.if.in[eth0].last()}>700000");
add(3,"磁盘使用空间大于200M","{jfgitlab:vfs.fs.size[/boot,total].last()}>200M"); add(3,"磁盘使用空间大于200M","{192.168.1.213:vfs.fs.size[/boot,total].last()}>200M");
add(1,"br-035628d874f9输出流量监控","{jfgitlab:net.if.out[br-035628d874f9].last()}>700000"); add(1,"eth0输出流量监控","{192.168.1.232:net.if.out[br-035628d874f9].last()}>700000");
add(1,"br-035628d874f9输入流量监控","{jfgitlab:net.if.in[br-035628d874f9].last()}>700000"); add(1,"eth0输入流量监控","{192.168.1.232:net.if.in[br-035628d874f9].last()}>700000");
add(1,"docker0输入流量监控","{jfgitlab:net.if.in[docker0].last()}>500000"); add(1,"eth0输入流量监控","{192.168.1.250:net.if.in[eth0].last()}>500000");
add(1,"docker0输出流量监控","{jfgitlab:net.if.out[docker0].last()}>500000"); add(1,"eth0输出流量监控","{192.168.1.250:net.if.out[eth0].last()}>500000");
} }
}; };
...@@ -94,7 +94,7 @@ public class TriggerBusinessImpl implements TriggerBusiness { ...@@ -94,7 +94,7 @@ public class TriggerBusinessImpl implements TriggerBusiness {
page.setCount(25); page.setCount(25);
} }
} }
} }*/
return page; return page;
} }
......
...@@ -43,7 +43,7 @@ public class WarningBusinessImpl implements WarningBusiness{ ...@@ -43,7 +43,7 @@ public class WarningBusinessImpl implements WarningBusiness{
page.setCount(count); page.setCount(count);
page.setItems(items); page.setItems(items);
String test_env = PropUtil.getValue("test_env", "quartz_service", "false"); /*String test_env = PropUtil.getValue("test_env", "quartz_service", "false");
if("true".equals(test_env)){ if("true".equals(test_env)){
List<Map<String, Object>> listFake = new ArrayList<Map<String, Object>>() { List<Map<String, Object>> listFake = new ArrayList<Map<String, Object>>() {
public boolean add(String name, String host_description,String description, int value,String clock,int status) { public boolean add(String name, String host_description,String description, int value,String clock,int status) {
...@@ -88,7 +88,7 @@ public class WarningBusinessImpl implements WarningBusiness{ ...@@ -88,7 +88,7 @@ public class WarningBusinessImpl implements WarningBusiness{
} }
page.setCount(22); page.setCount(22);
} }
} }*/
return page; return page;
} }
......
...@@ -13,6 +13,7 @@ import com.gaowj.business.UsergroupBusiness; ...@@ -13,6 +13,7 @@ import com.gaowj.business.UsergroupBusiness;
import com.gaowj.business.action.BasicAction; import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager; import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException; import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.PropUtil;
import com.gaowj.business.util.RequestUtils; import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.Status; import com.gaowj.business.util.Status;
import com.zabbix4j.ZabbixApi; import com.zabbix4j.ZabbixApi;
...@@ -55,7 +56,7 @@ public class actAction extends BasicAction { ...@@ -55,7 +56,7 @@ public class actAction extends BasicAction {
private static ZabbixApi zabbixApi; private static ZabbixApi zabbixApi;
static { static {
String url = "http://192.168.1.142/api_jsonrpc.php"; String url = PropUtil.getValue("zabbixIp", "quartz_service", "false");
zabbixApi = new ZabbixApi(url); zabbixApi = new ZabbixApi(url);
try { try {
......
...@@ -6,6 +6,7 @@ import java.util.Map; ...@@ -6,6 +6,7 @@ import java.util.Map;
import com.gaowj.business.action.BasicAction; import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException; import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.PropUtil;
import com.gaowj.business.util.RequestUtils; import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.Status; import com.gaowj.business.util.Status;
import com.zabbix4j.ZabbixApi; import com.zabbix4j.ZabbixApi;
...@@ -36,7 +37,8 @@ public class actAction extends BasicAction { ...@@ -36,7 +37,8 @@ public class actAction extends BasicAction {
private static ZabbixApi zabbixApi; private static ZabbixApi zabbixApi;
static { static {
String url = "http://192.168.1.142/api_jsonrpc.php"; String url = PropUtil.getValue("zabbixIp", "quartz_service", "false");
//String url = "http://192.168.1.142/api_jsonrpc.php";
zabbixApi = new ZabbixApi(url); zabbixApi = new ZabbixApi(url);
try { try {
......
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