Commit 1175e063 by 罗绍泽

服务器监控 CPU,IO,内存,磁盘使用率等图表,服务器监控

parent 32af9bf9
eclipse.preferences.version=1
performed.operation.me.install.springfacet=1.0
#Mon Mar 10 11:34:19 CST 2014
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType\:\:jdk1.6.0_31/owners=jst.java\:6.0
eclipse.preferences.version=1
<root>
<facet id="me.spring">
<node name="libprov">
<attribute name="provider-id" value="spring-no-op-library-provider"/>
</node>
</facet>
</root>
...@@ -124,6 +124,41 @@ ...@@ -124,6 +124,41 @@
<property name="filters" value="stat" /> <property name="filters" value="stat" />
</bean> </bean>
<!-- 增加数据源dataSource-zabbix -->
<bean id="dataSource-zabbix" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 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="username" value="root" />
<property name="password" value="mysql_root_password" />
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="1" />
<property name="minIdle" value="1" />
<property name="maxActive" value="20" />
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="60000" />
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000" />
<property name="validationQuery" value="SELECT 'x'" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
<property name="poolPreparedStatements" value="true" />
<property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
<!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->
<property name="filters" value="stat" />
</bean>
<!-- 增加事务transactionManager-system --> <!-- 增加事务transactionManager-system -->
<bean id="transactionManager-system" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <bean id="transactionManager-system" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource-system"/> <property name="dataSource" ref="dataSource-system"/>
...@@ -205,4 +240,5 @@ ...@@ -205,4 +240,5 @@
<import resource="business-system.xml"/> <import resource="business-system.xml"/>
<import resource="business-standard.xml"/> <import resource="business-standard.xml"/>
<import resource="business-test.xml"/> <import resource="business-test.xml"/>
<import resource="business-monitoring.xml"/>
</beans> </beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="sqlSessionFactory-monitoring" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource-zabbix" />
<property name="configLocation" value="/WEB-INF/conf/gaowj/bl/mybatis-config.xml" />
<property name="mapperLocations">
<list>
<value>classpath:com/gaowj/business/host/hostDAO.xml</value>
<value>classpath:com/gaowj/business/trigger/triggerDAO.xml</value>
<value>classpath:com/gaowj/business/usergroup/usergroupDAO.xml</value>
</list>
</property>
</bean>
<bean id="TriggerBusiness" class="com.gaowj.business.trigger.TriggerBusinessImpl">
<property name="triggerDAO">
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.trigger.triggerDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-monitoring" />
</bean>
</property>
</bean>
<bean id="HostBusiness" class="com.gaowj.business.host.HostBusinessImpl">
<property name="hostDAO">
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.host.hostDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-monitoring" />
</bean>
</property>
</bean>
<bean id="UsergroupBusiness" class="com.gaowj.business.usergroup.UsergroupBusinessImpl">
<property name="usergroupDAO">
<bean class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.gaowj.business.usergroup.usergroupDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory-monitoring" />
</bean>
</property>
</bean>
</beans>
...@@ -298,3 +298,18 @@ ...@@ -298,3 +298,18 @@
.icon-ext-34_40{ .icon-ext-34_40{
background:url('../../../../images/icons/(34,40).png') no-repeat left center; background:url('../../../../images/icons/(34,40).png') no-repeat left center;
} }
.icon-ext-19_16{
background:url('../../../../images/icons/(19,16).png') no-repeat left center;
}
.icon-ext-47_22{
background:url('../../../../images/icons/(47,22).png') no-repeat left center;
}
.icon-ext-19_13{
background:url('../../../../images/icons/(19,13).png') no-repeat left center;
}
.icon-ext-42_40{
background:url('../../../../images/icons/(42,40).png') no-repeat left center;
}
.icon-ext-47_06{
background:url('../../../../images/icons/(47,06).png') no-repeat left center;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="hostTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<form id="hostTab_searchForm" style="float:left">
主机名称: <input id="FIELD_NAME" name="FIELD_NAME" type="text" style="width: 200px" >
</form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
</div>
<div id="detail" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/monitoring/pages/host/js/hostModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/monitoring/pages/host/js/hostTab.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/lib/echarts/echarts.min.js" charset="utf-8"></script>
<%@page contentType="text/html; charset=UTF-8"%>
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" />
<input type="hidden" name="FIELD_TRIGGERID" id="TRIGGERID"/>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;">
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>服务器名:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="NAME" name="NAME" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>服务器标识:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="SYSTEM_UNAME" name="SYSTEM_UNAME" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>系统位数:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="SYSTEM_BIT" name="SYSTEM_BIT" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>内核版本:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="SYSTEM_KERNEL" name="SYSTEM_KERNEL" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>已运行时间:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="SYSTEM_KERNEL" name="SYSTEM_UPTIME" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>CPU型号:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="CPU_INFO" name="CPU_INFO" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>CPU核数:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="CPU_CORES" name="CPU_CORES" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>内存容量:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="MEMORY_SIZE" name="MEMORY_SIZE" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>硬盘容量:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="DISK_INFO" name="DISK_INFO" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>网卡信息:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="IP_INFO" name="IP_INFO" style="width:500px" />
</td>
</tr>
</table>
</form>
\ No newline at end of file
<%@page contentType="text/html; charset=UTF-8"%>
<form id="inputForm" method="post" style="width: 100%;">
<input id="FIELD_HOSTID" name="FIELD_HOSTID" type="hidden" />
监控项: <input id="FIELD_ITEM" name="FIELD_ITEM" type="text" style="width: 200px" />
时间段: <input id="FIELD_STARTTIME" name="FIELD_STARTTIME" type="text" style="width: 200px" value="${startTime}"/>至
<input id="FIELD_ENDTIME" name="FIELD_ENDTIME" type="text" style="width: 200px" value="${endTime}"/>
</form>
<div id="echars" style="width:100%;height:370px;">
</div>
\ No newline at end of file
//此乃本模块与后台交互的方法接口部分
var hostModule = function(format) {
this.module = "";
this.action = "";
this.format = format;
};
//定义数据交互
hostModule.prototype = BusinessObject;
//获取所有主机数据
hostModule.prototype.listAll = function(){};
//获取主机数据
hostModule.prototype.list = function(){};
//获取主机Cpu数据
hostModule.prototype.listCpu = function(){};
//获取主机内存数据
hostModule.prototype.listMemorySize = function(){};
//获取主机网络流出流量数据
hostModule.prototype.listNetOut = function(){};
//获取主机网络流入流量数据
hostModule.prototype.listNetIn = function(){};
//获取主机磁盘使用空间数据
hostModule.prototype.listVfsFsSize = function(){};
//获取主机磁盘IO数据(读取)
hostModule.prototype.listIORead = function(){};
//获取主机磁盘IO数据(写入)
hostModule.prototype.listIOWirte = function(){};
//创建一个数据操作对象,然后再后续使用
hostModule.act = new hostModule("json").delegate("hostAct");
//创建一个数据获取对象,然后再后续使用
hostModule.data = new hostModule("json").delegate("hostData");
//说明: 1、所有方法里统一传递josn格式的参数,用于后台交互,如data.listTables(param) ,如没有参数则传'{}',如data.listTables({})
// 2、前后台数据获取传输协议 如:json[{'0':{pageCount':'2','pageNo':'1','pageSize':'20','rowSet':'[{0},{1}....]'}}]
// 3、前后台增删改的返回状态 如:json[{'0':{'rowSet':{'NAME':'-1','VALUE':'保存失败'}}}]
//此乃本模块与后台交互的方法接口部分
var triggerModule = function(format) {
this.module = "";
this.action = "";
this.format = format;
};
//定义数据交互
triggerModule.prototype = BusinessObject;
//插入数据
triggerModule.prototype.insertTrigger = function(){};
//修改数据
triggerModule.prototype.updateTrigger = function(){};
//删除数据
triggerModule.prototype.deleteTrigger = function(){};
//创建一个数据操作对象,然后再后续使用
triggerModule.act = new triggerModule("json").delegate("triggerAct");
//创建一个数据获取对象,然后再后续使用
triggerModule.data = new triggerModule("json").delegate("triggerData");
//说明: 1、所有方法里统一传递josn格式的参数,用于后台交互,如data.listTables(param) ,如没有参数则传'{}',如data.listTables({})
// 2、前后台数据获取传输协议 如:json[{'0':{pageCount':'2','pageNo':'1','pageSize':'20','rowSet':'[{0},{1}....]'}}]
// 3、前后台增删改的返回状态 如:json[{'0':{'rowSet':{'NAME':'-1','VALUE':'保存失败'}}}]
/**
* 序号:1
* 功能:定义分页(EasyUI)
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:无需更改
**/
var ls_width = $(window).width();
var ls_height = $(window).height();
var local_page=1;
var rows=20;
var listPageSize = [10,20,50,100,500,1000];
var queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
var tab_n = 0;
//重置分页参数
function resetQueryData(){
queryData = "";
queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
}
//定义附件关联模块ID(1:一般业务,2:测试信息,3:审批业务,999:其它数据 )
var ls_module_id='2';
//定义当前模块业务类型(YBYW:一般业务,SPGL:审批业务)
var ls_ywlx = 'YBYW';
/****/
/**
* 序号:2
* 功能:构建下拉框内容
* 参数:
* 说明:方便新增、修改页面里的下拉选项加载数据
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载警告级别数据
var v_priority_data = [{CODE_ID:'0',CODE_NAME:'未分类'},{CODE_ID:'1',CODE_NAME:'信息'},{CODE_ID:'2',CODE_NAME:'警告'},{CODE_ID:'3',CODE_NAME:'一般严重'},{CODE_ID:'4',CODE_NAME:'严重'},{CODE_ID:'5',CODE_NAME:'灾难'}];
//加载状态
var v_status_data = [{CODE_ID:'0',CODE_NAME:'已启用'},{CODE_ID:'1',CODE_NAME:'停用的'}];
//加载主机列表
var v_host_data = hostModule.data.listAll().rowSet;
$('#FIELD_HOSTID').val(v_host_data[0].HOSTID);
$('#FIELD_HOSTID').combobox({
data : v_host_data,
valueField : 'HOSTID',
textField : 'NAME',
editable:false,
panelHeight:'auto'
});
/****/
/**
* 序号:3
* 功能:构建主页面列表
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//定义grid列表
var ls_title="触发器维护";
var is_column = [ [
{field : 'PRIORITY',title : '严重性',width : 100,align : 'center',formatter:function(value,row,index){
for(var i=0;i<v_priority_data.length;i++){
if(v_priority_data[i].CODE_ID==value){
return v_priority_data[i].CODE_NAME;
}
}
}},
{field : 'DESCRIPTION',title : '名称',width : 350,align : 'left'
},
{field : 'EXPRESSION',title : '表达式',width : 350,align : 'left'
},
{field : 'STATUS',title : '状态',width : 350,align : 'left',formatter:function(value,row,index){
for(var i=0;i<v_status_data.length;i++){
if(v_status_data[i].CODE_ID==value){
return v_status_data[i].CODE_NAME;
}
}
}},
] ];
//列表加载完成回调
function dataOnLoadSuccess(){
}
//设置颜色和每行高度
function rowstyler(index,row){
if(row.STATUS == '1'){
return 'color:red;height:30px;';
}
else{
return 'color:green;height:30px;';
}
}
//展示列表
datagrid("list",ls_title,gaowj.WEB_APP_NAME + "/triggerData_list",Object.assign({},$("#triggerTab_searchForm").getFormVal(),queryData),is_column,60,80);
/****/
/**
* 序号:4
* 功能:设置主页面操作列菜单
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//操用列显示更多(一般情况下无需更改)
function formatMenu(value, data,index) {
var returnData="";
return returnData
+ "<span class=\"icon-ext-moremenu\" style=\"padding-left:20px;*width:20px;\"></span>"
+ "<span data-p1="+index+" class=\"easyui-tooltip\" style=\"color:blue;cursor:pointer;\">更多</span>";
}
//上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){
//上浮菜单具体按钮
var optionMenu=new Array();
optionMenu[0]=makeBtnOneParama('编辑','icon-edit',"editRow",index);
optionMenu[1]=makeBtnOneParama('删除','icon-clear',"deleteRow",index);
var splitStr=' | ';
var returnData='';
for(var i=0;i<optionMenu.length;i++){
returnData+=splitStr+optionMenu[i];
}
return returnData.substr(splitStr.length-1);
}
//单个按钮构造
function makeBtn(text,cssClass,click){
return "<span class=\""+cssClass+"\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\""+click+"\">"+text+"</a>";
}
//单按钮单参数构造
function makeBtnOneParama(text,cssClass,clickName,index){
return makeBtn(text,cssClass,clickName+"('"+ index + "')");
}
//返回菜单集的菜单个数(需更改)
function getOptionMenuCount(){
var is_menu_count = 2;
return is_menu_count;
}
/****/
/**
* 序号:5
* 功能:新增修改弹出
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载增加子页面
function addRow(){
var is_row={OPETYPE:'insert'};
openEditRow("triggerView_triggerTabDetail",is_row,"新增",true,0.65,0.95,0,0);
}
//加载增加子页面成功后的回调
function addUrlOnloadCallback(is_row){
$('#PRIORITY').combobox({
data : v_priority_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
}
//保存
function insertData(is_entity){
var v_result = triggerModule.act.insertTrigger(is_entity);
$('#list').datagrid('reload');
return v_result;
}
//加载修改子页面
function editRow(index) {
var is_row = $('#list').datagrid('getRows')[index];
is_row.OPETYPE = 'update';
openEditRow("triggerView_triggerTabDetail",is_row,"编辑",true,0.65,0.95,0,0);
}
//加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){
for(k in is_row){
is_row['FIELD_'+k]=is_row[k];
}
$("#inputForm").form('load',is_row);
$('#PRIORITY').combobox({
data : v_priority_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
}
//保存
function updateData(is_entity){
var v_result = triggerModule.act.updateTrigger(is_entity);
$('#list').datagrid('reload');
return v_result;
}
/****/
/**
* 序号:6
* 功能:单个删除
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function deleteRow(index){
var is_row = $('#list').datagrid('getData')[index];
var code = is_row.UUID;
$.messager.confirm('提示', '确定删除?', function(r) {
if (r) {
var v_query = {};
v_query.FIELD_CODE = code;
var v_result = studentModule.studentActAction.deleteStudent(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
});
}
/****/
/**
* 序号:7
* 功能:批量删除
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function deleteBatchRow(){
var code="";
var rows = $('#list').datagrid('getSelections');
for(var i=0; i<rows.length; i++){
code = code + rows[i].TRIGGERID+",";
}
if(rows == null || rows == ""){
$.messager.alert('提示',"请选择需删除的记录!",'info');
return;
}
if(code.length>0){
code = code.substring(0,code.length - 1);
}
$.messager.confirm('提示', '确定删除?', function(r) {
if (r) {
var v_query = {};
v_query.FIELD_CODE = code;
var v_result = triggerModule.act.deleteTrigger(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
});
}
/****/
/**
* 序号:8
* 功能:刷新
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function refreshRow(){
$("#triggerTab_searchForm")[0].reset();
$('#FIELD_HOSTID').combobox('clear');
$('#FIELD_HOSTID').combobox('setValue',v_host_data[0].HOSTID);
$('#list').datagrid('load',$("#triggerTab_searchForm").getFormVal());
}
/****/
/**
* 序号:9
* 功能:查询
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function searchRow(){
var v_query = $("#triggerTab_searchForm").getFormVal();
$('#list').datagrid('load',v_query);
}
/****/
/**
* 序号:10
* 功能:高级查询弹出
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载高级查询子页面
function advsearchRow(){
var is_row={OPETYPE:'ww'};
openAdvsearchRow("studentView_studentAdvsearch",is_row,"高级查询",true,0.65,0.95,0,0);
}
//加载高级查询子页面成功后的回调
function addAdvsearchCallback(is_row){
}
//高级查询
function advsearchData(is_entity){
$('#list').datagrid('load',is_entity);
}
/****/
/**
* 序号:11
* 功能:处理接口附件
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function uploadcommonRow(index){
}
/****/
/**
* 序号:12
* 功能:批量处理接口附件
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function uploadcommonBatchRow(){
}
/****/
\ No newline at end of file
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="triggerTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<form id="triggerTab_searchForm" style="float:left">
主机: <input id="FIELD_HOSTID" name="FIELD_HOSTID" type="text" style="width: 200px" class="easyui-combobox">
</form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
</div>
<div id="detail" style="overflow:auto;"></div>
<div id="advsearch" style="overflow:auto;"></div>
<div id="uploadcommon" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/monitoring/pages/trigger/js/triggerModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/monitoring/pages/host/js/hostModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/monitoring/pages/trigger/js/triggerTab.js" charset="utf-8"></script>
<%@page contentType="text/html; charset=UTF-8"%>
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" />
<input type="hidden" name="FIELD_TRIGGERID" id="TRIGGERID"/>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;">
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>描述:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="DESCRIPTION" name="FIELD_DESCRIPTION" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>警告级别:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="PRIORITY" name="FIELD_PRIORITY" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>表达式:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="EXPRESSION" name="FIELD_EXPRESSION" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>备注:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="COMMENTS" name="FIELD_COMMENTS" style="width:500px" />
</td>
</tr>
</table>
</form>
\ No newline at end of file
//此乃本模块与后台交互的方法接口部分
var usergroupModule = function(format) {
this.module = "";
this.action = "";
this.format = format;
};
//定义数据交互
usergroupModule.prototype = BusinessObject;
//插入数据
usergroupModule.prototype.insertUsergroup = function(){};
//修改数据
usergroupModule.prototype.updateUsergroup = function(){};
//删除数据
usergroupModule.prototype.deleteUsergroup = function(){};
//创建一个数据操作对象,然后再后续使用
usergroupModule.act = new triggerModule("json").delegate("usergroupAct");
//创建一个数据获取对象,然后再后续使用
usergroupModule.data = new triggerModule("json").delegate("usergroupData");
//说明: 1、所有方法里统一传递josn格式的参数,用于后台交互,如data.listTables(param) ,如没有参数则传'{}',如data.listTables({})
// 2、前后台数据获取传输协议 如:json[{'0':{pageCount':'2','pageNo':'1','pageSize':'20','rowSet':'[{0},{1}....]'}}]
// 3、前后台增删改的返回状态 如:json[{'0':{'rowSet':{'NAME':'-1','VALUE':'保存失败'}}}]
/**
* 序号:1
* 功能:定义分页(EasyUI)
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:无需更改
**/
var ls_width = $(window).width();
var ls_height = $(window).height();
var local_page=1;
var rows=20;
var listPageSize = [10,20,50,100,500,1000];
var queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
var tab_n = 0;
//重置分页参数
function resetQueryData(){
queryData = "";
queryData = eval("({'page':'"+local_page+"','rows':'"+rows+"'})");
}
//定义附件关联模块ID(1:一般业务,2:测试信息,3:审批业务,999:其它数据 )
var ls_module_id='2';
//定义当前模块业务类型(YBYW:一般业务,SPGL:审批业务)
var ls_ywlx = 'YBYW';
/****/
/**
* 序号:2
* 功能:构建下拉框内容
* 参数:
* 说明:方便新增、修改页面里的下拉选项加载数据
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载状态
var v_status_data = [{CODE_ID:'0',CODE_NAME:'已启用'},{CODE_ID:'1',CODE_NAME:'停用的'}];
/****/
/**
* 序号:3
* 功能:构建主页面列表
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//定义grid列表
var ls_title="用户组维护";
var is_column = [ [
{field : 'NAME',title : '名称',width : 350,align : 'left'
},
{field : 'USERS_STATUS',title : '状态',width : 350,align : 'left',formatter:function(value,row,index){
for(var i=0;i<v_status_data.length;i++){
if(v_status_data[i].CODE_ID==value){
return v_status_data[i].CODE_NAME;
}
}
}
}
] ];
//列表加载完成回调
function dataOnLoadSuccess(){
}
//设置颜色和每行高度
function rowstyler(index,row){
return 'color:green;height:30px;';
}
//展示列表
datagrid("list",ls_title,gaowj.WEB_APP_NAME + "/usergroupData_list",Object.assign({},$("#tusergroupTab_searchForm").getFormVal(),queryData),is_column,60,80);
/****/
/**
* 序号:4
* 功能:设置主页面操作列菜单
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//操用列显示更多(一般情况下无需更改)
function formatMenu(value, data,index) {
var returnData="";
return returnData
+ "<span class=\"icon-ext-moremenu\" style=\"padding-left:20px;*width:20px;\"></span>"
+ "<span data-p1="+index+" class=\"easyui-tooltip\" style=\"color:blue;cursor:pointer;\">更多</span>";
}
//上浮横向菜单集里的具体菜单项(需更改)
function getOptionMenu(data,index){
//上浮菜单具体按钮
var optionMenu=new Array();
optionMenu[0]=makeBtnOneParama('编辑','icon-edit',"editRow",index);
optionMenu[1]=makeBtnOneParama('删除','icon-clear',"deleteRow",index);
var splitStr=' | ';
var returnData='';
for(var i=0;i<optionMenu.length;i++){
returnData+=splitStr+optionMenu[i];
}
return returnData.substr(splitStr.length-1);
}
//单个按钮构造
function makeBtn(text,cssClass,click){
return "<span class=\""+cssClass+"\" style=\"padding-left:20px;*width:20px;\"></span><a href=\"javascript:void(0);\" onclick=\""+click+"\">"+text+"</a>";
}
//单按钮单参数构造
function makeBtnOneParama(text,cssClass,clickName,index){
return makeBtn(text,cssClass,clickName+"('"+ index + "')");
}
//返回菜单集的菜单个数(需更改)
function getOptionMenuCount(){
var is_menu_count = 2;
return is_menu_count;
}
/****/
/**
* 序号:5
* 功能:新增修改弹出
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载增加子页面
function addRow(){
var is_row={OPETYPE:'insert'};
openEditRow("usergroupView_usergroupTabDetail",is_row,"新增",true,0.65,0.95,0,0);
}
//加载增加子页面成功后的回调
function addUrlOnloadCallback(is_row){
$('#USERS_STATUS').val(0);
$('#USERS_STATUS').combobox({
data : v_status_data,
valueField : 'CODE_ID',
textField : 'CODE_NAME',
editable:false,
panelHeight:'auto'
});
}
//保存
function insertData(is_entity){
var v_result = usergroupModule.act.insertUsergroup(is_entity);
$('#list').datagrid('reload');
return v_result;
}
//加载修改子页面
function editRow(index) {
var is_row = $('#list').datagrid('getRows')[index];
is_row.OPETYPE = 'update';
openEditRow("usergroupView_usergroupTabDetail",is_row,"编辑",true,0.65,0.95,0,0);
}
//加载修改子页面成功后的回调
function updateUrlOnloadCallback(is_row){
}
//保存
function updateData(is_entity){
var v_result = usergroupModule.act.updateUsergroup(is_entity);
$('#list').datagrid('reload');
return v_result;
}
/****/
/**
* 序号:6
* 功能:单个删除
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function deleteRow(index){
var is_row = $('#list').datagrid('getData')[index];
var code = is_row.UUID;
$.messager.confirm('提示', '确定删除?', function(r) {
if (r) {
var v_query = {};
v_query.FIELD_CODE = code;
var v_result = studentModule.studentActAction.deleteStudent(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
});
}
/****/
/**
* 序号:7
* 功能:批量删除
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function deleteBatchRow(){
var code="";
var rows = $('#list').datagrid('getSelections');
for(var i=0; i<rows.length; i++){
code = code + rows[i].TRIGGERID+",";
}
if(rows == null || rows == ""){
$.messager.alert('提示',"请选择需删除的记录!",'info');
return;
}
if(code.length>0){
code = code.substring(0,code.length - 1);
}
$.messager.confirm('提示', '确定删除?', function(r) {
if (r) {
var v_query = {};
v_query.FIELD_CODE = code;
var v_result = triggerModule.act.deleteTrigger(v_query);
$.messager.alert('提示',v_result.VALUE);
$('#list').datagrid('reload');
}
});
}
/****/
/**
* 序号:8
* 功能:刷新
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function refreshRow(){
$("#usergroupTab_searchForm")[0].reset();
$('#list').datagrid('load',$("#usergroupTab_searchForm").getFormVal());
}
/****/
/**
* 序号:9
* 功能:查询
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function searchRow(){
var v_query = $("#usergroupTab_searchForm").getFormVal();
$('#list').datagrid('load',v_query);
}
/****/
/**
* 序号:10
* 功能:高级查询弹出
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
//加载高级查询子页面
function advsearchRow(){
var is_row={OPETYPE:'ww'};
openAdvsearchRow("studentView_studentAdvsearch",is_row,"高级查询",true,0.65,0.95,0,0);
}
//加载高级查询子页面成功后的回调
function addAdvsearchCallback(is_row){
}
//高级查询
function advsearchData(is_entity){
$('#list').datagrid('load',is_entity);
}
/****/
/**
* 序号:11
* 功能:处理接口附件
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function uploadcommonRow(index){
}
/****/
/**
* 序号:12
* 功能:批量处理接口附件
* 参数:
* 说明:
* 作者:高伟杰
* 时间:2016-01-22
* 单位:宁波金网
* 备注:需更改
**/
function uploadcommonBatchRow(){
}
/****/
\ No newline at end of file
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="usergroupTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<form id="usergroupTab_searchForm" style="float:left">
名称: <input id="FIELD_HOSTID" name="FIELD_HOSTID" type="text" style="width: 200px" class="easyui-combobox">
</form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
</div>
<div id="detail" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/monitoring/pages/usergroup/js/usergroupModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/monitoring/pages/usergroup/js/usergroupTab.js" charset="utf-8"></script>
<%@page contentType="text/html; charset=UTF-8"%>
<form id="inputForm" method="post" style="width: 100%;">
<input type="hidden" name="FIELD_OPETYPE" id="OPETYPE" />
<input type="hidden" name="FIELD_USRGRPID" id="USRGRPID"/>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableStyle" style="margin: 10px 15px; width: 95%; line-height: 30px;">
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>名称:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="NAME" name="FIELD_NAME" style="width:500px" />
</td>
</tr>
<tr>
<td style="width: 15%;" class="tableStyleLable">
<span>状态:</span>
</td>
<td style="width: 85%">
<input class="easyui-textbox" id="USERS_STATUS" name="FIELD_USERS_STATUS" style="width:500px" />
</td>
</tr>
</table>
</form>
\ No newline at end of file
//此乃本模块与后台交互的方法接口部分
var warningModule = function(format) {
this.module = "";
this.action = "";
this.format = format;
};
//定义数据交互
warningModule.prototype = BusinessObject;
//查询警告列表
warningModule.prototype.list = function(){};
//创建一个数据获取对象,然后再后续使用
warningModule.warningDataAction = new warningModule("json").delegate("warningData");
//说明: 1、所有方法里统一传递josn格式的参数,用于后台交互,如data.listTables(param) ,如没有参数则传'{}',如data.listTables({})
// 2、前后台数据获取传输协议 如:json[{'0':{pageCount':'2','pageNo':'1','pageSize':'20','rowSet':'[{0},{1}....]'}}]
// 3、前后台增删改的返回状态 如:json[{'0':{'rowSet':{'NAME':'-1','VALUE':'保存失败'}}}]
<%@page contentType="text/html; charset=UTF-8"%>
<%@ include file="/gaowj/header-simple-1.0.jsp"%>
<div id="warningTab">
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_body.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_table.css" charset="utf-8"></link>
<link rel="stylesheet" type="text/css" href="${ctx}/jwapp/common/css/content_input.css" charset="utf-8"></link>
</div>
<table id="list" style="width: 100%; height: 100%;"></table>
<div id="tb">
<form id="warningTab_searchForm" style="float:left">
是否已毕业: <input id="FIELD_STATUS" name="FIELD_STATUS" type="text" style="width: 100px" class="easyui-combobox">&nbsp;&nbsp;
姓名: <input class="easyui-textbox" id="FIELD_NAME" name="FIELD_NAME" style="width:200px"/>&nbsp;&nbsp;
</form>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="javascript:searchRow()">查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-advsearch',plain:true" onclick="javascript:advsearchRow()">高级查询</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="javascript:refreshRow()">刷新</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="javascript:addRow()">新增</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear',plain:true" onclick="javascript:deleteBatchRow()">删除</a>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ext-file',plain:true" onclick="javascript:uploadcommonBatchRow()">附件</a>
</div>
<div id="detail" style="overflow:auto;"></div>
<div id="advsearch" style="overflow:auto;"></div>
<div id="uploadcommon" style="overflow:auto;"></div>
<script type="text/javascript" src="${ctx}/jwapp/pages/standard/js/jwStandardModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/monitoring/pages/warning/js/warningModule.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/monitoring/pages/warning/js/warningTab.js" charset="utf-8"></script>
...@@ -4,5 +4,61 @@ ...@@ -4,5 +4,61 @@
"http://struts.apache.org/dtds/struts-2.3.dtd"> "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts> <struts>
<package name="src_monitoring" extends="gaowj">
<action name="warningView_*" class="com.gaowj.monitoring.action.viewAction" method="{1}">
<result name="{1}">/monitoring/pages/warning/{1}.jsp</result>
</action>
<action name="warningAct_*" class="com.gaowj.monitoring.action.actAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="warningData_*" class="com.gaowj.monitoring.action.dataAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="usergroupView_*" class="com.gaowj.usergroup.action.viewAction" method="{1}">
<result name="{1}">/monitoring/pages/usergroup/{1}.jsp</result>
</action>
<action name="usergroupAct_*" class="com.gaowj.usergroup.action.actAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="usergroupData_*" class="com.gaowj.usergroup.action.dataAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="triggerView_*" class="com.gaowj.trigger.action.viewAction" method="{1}">
<result name="{1}">/monitoring/pages/trigger/{1}.jsp</result>
</action>
<action name="triggerAct_*" class="com.gaowj.trigger.action.actAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="triggerData_*" class="com.gaowj.trigger.action.dataAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="hostView_*" class="com.gaowj.host.action.viewAction" method="{1}">
<result name="{1}">/monitoring/pages/host/{1}.jsp</result>
</action>
<action name="hostAct_*" class="com.gaowj.host.action.actAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
<action name="hostData_*" class="com.gaowj.host.action.dataAction" method="{1}">
<result name="json" type="json">
<param name="root">jsonObject</param>
</result>
</action>
</package>
</struts> </struts>
package com.gaowj.business;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
@Service
public interface HostBusiness {
/**
* 分页获取记录
* @param entity
* @throws BusinessException
*/
Page<Map<String, Object>> list_host(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String, Object>> list_host(Map<String, Object> query)throws BusinessException ;
List<Map<String, Object>> list_cpu(Map<String, Object> query)throws BusinessException ;
List<Map<String, Object>> list_memorySize(Map<String, Object> query)throws BusinessException ;
List<Map<String, Object>> list_netOut(Map<String, Object> query)throws BusinessException ;
List<Map<String, Object>> list_netIn(Map<String, Object> query)throws BusinessException ;
List<Map<String, Object>> list_vfsFsSize(Map<String, Object> query)throws BusinessException ;
List<Map<String, Object>> list_io_read(Map<String, Object> query)throws BusinessException ;
List<Map<String, Object>> list_io_wirte(Map<String, Object> query)throws BusinessException ;
}
package com.gaowj.business;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
@Service
public interface TriggerBusiness {
/**
* 分页获取记录
* @param entity
* @throws BusinessException
*/
Page<Map<String, Object>> list_trigger(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
}
package com.gaowj.business;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
@Service
public interface UsergroupBusiness {
/**
* 分页获取记录
*
* @param entity
* @throws BusinessException
*/
Page<Map<String, Object>> list_usergroup(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException;
}
package com.gaowj.business.host;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.HostBusiness;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
public class HostBusinessImpl implements HostBusiness {
private hostDAO hostDAO;
public hostDAO getHostDAO() {
return hostDAO;
}
public void setHostDAO(hostDAO hostDAO) {
this.hostDAO = hostDAO;
}
@Override
public Page<Map<String, Object>> list_host(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException {
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
// 获取列表
if (query.get("NAME") != null && !"".equals(query.get("NAME"))) {
query.put("NAME", "%" + query.get("NAME") + "%");
}
List<Map<String, Object>> items = hostDAO.list_host(new RowBounds(pageStart, pageSize), query);
// 获取列表个数
int count = hostDAO.list_count_host(query);
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_host(Map<String, Object> query) throws BusinessException {
// 获取列表
List<Map<String, Object>> hosts = hostDAO.list_host(query);
return hosts;
}
@Override
public List<Map<String, Object>> list_cpu(Map<String, Object> query) throws BusinessException {
// 获取列表
List<Map<String, Object>> cpus = hostDAO.list_cpu(query);
return cpus;
}
@Override
public List<Map<String, Object>> list_memorySize(Map<String, Object> query) throws BusinessException {
// 获取列表
List<Map<String, Object>> memorySizeAvailables = hostDAO.list_memorySizeAvailable(query);
List<Map<String, Object>> memorySizeTotals = hostDAO.list_memorySizeTotal(query);
// 内存总大小
BigDecimal total = BigDecimal.ZERO;
if (memorySizeTotals.size() > 0) {
total = new BigDecimal(memorySizeTotals.get(0).get("VALUE").toString());
}
for (Map<String, Object> m : memorySizeAvailables) {
BigDecimal size = new BigDecimal(m.get("VALUE").toString());
m.put("VALUE", size.divide(total, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));
}
return memorySizeAvailables;
}
@Override
public List<Map<String, Object>> list_netOut(Map<String, Object> query) throws BusinessException {
// 获取列表
List<Map<String, Object>> netOuts = hostDAO.list_netOut(query);
return netOuts;
}
@Override
public List<Map<String, Object>> list_netIn(Map<String, Object> query) throws BusinessException {
// 获取列表
List<Map<String, Object>> netIns = hostDAO.list_netIn(query);
return netIns;
}
@Override
public List<Map<String, Object>> list_vfsFsSize(Map<String, Object> query) throws BusinessException {
// 获取列表
List<Map<String, Object>> vfsFsSizes = hostDAO.list_vfsFsSize(query);
return vfsFsSizes;
}
@Override
public List<Map<String, Object>> list_io_read(Map<String, Object> query) throws BusinessException {
// 获取列表
List<Map<String, Object>> ioReads = hostDAO.list_io_read(query);
return ioReads;
}
@Override
public List<Map<String, Object>> list_io_wirte(Map<String, Object> query) throws BusinessException {
// 获取列表
List<Map<String, Object>> ioWrites = hostDAO.list_io_wirte(query);
return ioWrites;
}
}
package com.gaowj.business.host;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
public interface hostDAO {
List<Map<String, Object>> list_host(RowBounds rowbounds, Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_host(Map<String, Object> query) throws BusinessException;
int list_count_host(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_cpu(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_memorySizeAvailable(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_memorySizeTotal(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_netOut(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_netIn(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_vfsFsSize(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_io_read(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_io_wirte(Map<String, Object> query) throws BusinessException;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaowj.business.host.hostDAO">
<sql id="Where_Clause">
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="NAME != null and NAME != ''">
and h.name LIKE #{NAME}
</if>
</trim>
</sql>
<sql id="Where_Clause_HostInfo">
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="HOSTID != null and HOSTID != ''">
and h.HOSTID = #{HOSTID}
</if>
<if test="STARTTIME != null and STARTTIME != ''">
<![CDATA[
and h.CLOCK >= #{STARTTIME}
]]>
</if>
<if test="ENDTIME != null and ENDTIME != ''">
<![CDATA[
and h.CLOCK <= #{ENDTIME}
]]>
</if>
</trim>
</sql>
<select id="list_host" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM hosts_sysinfo_view h
<include refid="Where_Clause" />
order by h.name ASC
</select>
<select id="list_count_host" parameterType="map" resultType="int">
SELECT count(*) FROM hosts_sysinfo_view h
<include refid="Where_Clause" />
</select>
<select id="list_cpu" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM hosts_cpu_view h
<include refid="Where_Clause_HostInfo" />
</select>
<select id="list_memorySizeAvailable" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM hosts_memory_size_available h
<include refid="Where_Clause_HostInfo" />
</select>
<select id="list_memorySizeTotal" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM hosts_memory_size_total h
<include refid="Where_Clause_HostInfo" />
ORDER BY h.CLOCK DESC
</select>
<select id="list_netOut" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM hosts_net_out_view h
<include refid="Where_Clause_HostInfo" />
</select>
<select id="list_netIn" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM hosts_net_in_view h
<include refid="Where_Clause_HostInfo" />
</select>
<select id="list_vfsFsSize" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM hosts_vfs_fs_size_pfree_view h
<include refid="Where_Clause_HostInfo" />
</select>
<select id="list_io_read" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM hosts_disk_read_view h
<include refid="Where_Clause_HostInfo" />
</select>
<select id="list_io_wirte" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM hosts_disk_wirte_view h
<include refid="Where_Clause_HostInfo" />
</select>
</mapper>
\ No newline at end of file
package com.gaowj.business.trigger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.TriggerBusiness;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
public class TriggerBusinessImpl implements TriggerBusiness {
private triggerDAO triggerDAO;
public triggerDAO getTriggerDAO() {
return triggerDAO;
}
public void setTriggerDAO(triggerDAO triggerDAO) {
this.triggerDAO = triggerDAO;
}
@Override
public Page<Map<String, Object>> list_trigger(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException {
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
// 获取列表
List<Map<String, Object>> items = triggerDAO.list_trigger(new RowBounds(pageStart, pageSize), query);
change_expression(items);
// 获取列表个数
int count = triggerDAO.list_count_trigger(query);
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
/**
* 处理触发器的表达式
*
* @param items
*/
private void change_expression(List<Map<String, Object>> items) {
Map<String, Object> query = new HashMap<String, Object>();
List<String> listTriggerid = new ArrayList<String>();
for (Map<String, Object> m : items) {
if (m.get("TRIGGERID") != null) {
listTriggerid.add(m.get("TRIGGERID").toString());
}
}
query.put("TRIGGERIDIDS", listTriggerid);
// 通过触发器id获取这些触发器的function对象
List<Map<String, Object>> listFunction = triggerDAO.list_function(query);
for (Map<String, Object> m : items) {
if (m.get("EXPRESSION") != null) {
String expression = m.get("EXPRESSION").toString();
// 将表达式中大括号包含的id,用所有function尝试替换一遍
for (Map<String, Object> f : listFunction) {
expression = expression.replaceAll(escapeExprSpecialWord("{" + f.get("FUNCTIONID") + "}"), "{" + f.get("FUNCTION_EXPRESSION") + "}");
}
m.put("EXPRESSION", expression);
}
}
}
/**
* 转义正则特殊字符 ($()*+.[]?\^{},|)
*
* @param keyword
* @return
*/
private String escapeExprSpecialWord(String keyword) {
if (keyword != null && !"".equals(keyword)) {
String[] fbsArr = { "\\", "$", "(", ")", "*", "+", ".", "[", "]", "?", "^", "{", "}", "|" };
for (String key : fbsArr) {
if (keyword.contains(key)) {
keyword = keyword.replace(key, "\\" + key);
}
}
}
return keyword;
}
}
package com.gaowj.business.trigger;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
public interface triggerDAO {
List<Map<String, Object>> list_trigger(RowBounds rowbounds, Map<String, Object> query) throws BusinessException;
int list_count_trigger(Map<String, Object> query) throws BusinessException;
List<Map<String, Object>> list_function(Map<String, Object> query) throws BusinessException;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaowj.business.trigger.triggerDAO">
<sql id="Where_Clause">
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="HOSTID != null and HOSTID != ''">
and h.hostid = #{HOSTID}
</if>
</trim>
</sql>
<select id="list_trigger" parameterType="map" resultType="upperCaseKeyMap">
SELECT h.hostid,tri.* FROM hosts_trigger_relative_view h
LEFT JOIN `triggers` tri ON h.triggerid=tri.triggerid
<include refid="Where_Clause" />
order by tri.description ASC
</select>
<select id="list_count_trigger" parameterType="map" resultType="int">
SELECT count(*) FROM hosts_trigger_relative_view h
LEFT JOIN `triggers` tri ON h.triggerid=tri.triggerid
<include refid="Where_Clause" />
</select>
<select id="list_function" parameterType="map" resultType="upperCaseKeyMap">
SELECT * FROM function_expression_view h
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="HOSTID != null and HOSTID != ''">
and h.hostid = #{HOSTID}
</if>
<if test="HOSTIDS != null and HOSTIDS != ''">
AND h.hostid IN
<foreach collection="HOSTIDS" item="hostid" open="("
separator="," close=")">
#{hostid}
</foreach>
</if>
<if test="TRIGGERIDID != null and TRIGGERIDID != ''">
and h.triggerid = #{TRIGGERIDID}
</if>
<if test="TRIGGERIDIDS != null and TRIGGERIDIDS != ''">
AND h.triggerid IN
<foreach collection="TRIGGERIDIDS" item="triggerid" open="("
separator="," close=")">
#{triggerid}
</foreach>
</if>
</trim>
</select>
</mapper>
\ No newline at end of file
package com.gaowj.business.usergroup;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.UsergroupBusiness;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
public class UsergroupBusinessImpl implements UsergroupBusiness {
private usergroupDAO usergroupDAO;
public usergroupDAO getUsergroupDAO() {
return usergroupDAO;
}
public void setUsergroupDAO(usergroupDAO usergroupDAO) {
this.usergroupDAO = usergroupDAO;
}
@Override
public Page<Map<String, Object>> list_usergroup(int pageNo, int pageSize, Map<String, Object> query) throws BusinessException {
// 计算起始记录
int pageStart = (pageNo - 1) * pageSize;
// 获取列表
List<Map<String, Object>> items = usergroupDAO.list_usergroup(new RowBounds(pageStart, pageSize), query);
// 获取列表个数
int count = usergroupDAO.list_count_usergroup(query);
// 创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
}
package com.gaowj.business.usergroup;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException;
public interface usergroupDAO {
List<Map<String, Object>> list_usergroup(RowBounds rowbounds, Map<String, Object> query) throws BusinessException;
int list_count_usergroup(Map<String, Object> query) throws BusinessException;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gaowj.business.usergroup.usergroupDAO">
<sql id="Where_Clause">
<trim prefix="WHERE" prefixOverrides="AND |OR">
<if test="NAME != null and NAME != ''">
and t.NAME = #{NAME}
</if>
and t.usrgrpid > 12
</trim>
</sql>
<select id="list_usergroup" parameterType="map" resultType="upperCaseKeyMap">
SELECT * from usrgrp t
<include refid="Where_Clause" />
order by t.usrgrpid DESC
</select>
<select id="list_count_usergroup" parameterType="map" resultType="int">
SELECT count(*) from usrgrp t
<include refid="Where_Clause" />
</select>
</mapper>
\ No newline at end of file
package com.gaowj.host.action;
import com.gaowj.business.action.BasicAction;
import net.sf.json.JSONObject;
public class actAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6496396449440750926L;
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
}
package com.gaowj.host.action;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gaowj.business.HostBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import net.sf.json.JSONObject;
public class dataAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6083279531948261141L;
private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public int getRows() {
rows = getPageSize();
return rows;
}
public void setRows(int rows) {
setPageSize(rows);
this.rows = getPageSize();
}
public int getPage() {
page = getPageNo();
return page;
}
public void setPage(int page) {
setPageNo(page);
this.page = getPageNo();
}
public String listCpu(){
HostBusiness business = BusinessManager.getBusiness(HostBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> pageRows = business.list_cpu(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listMemorySize(){
HostBusiness business = BusinessManager.getBusiness(HostBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> pageRows = business.list_memorySize(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listNetOut(){
HostBusiness business = BusinessManager.getBusiness(HostBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> pageRows = business.list_netOut(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listNetIn(){
HostBusiness business = BusinessManager.getBusiness(HostBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> pageRows = business.list_netIn(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listVfsFsSize(){
HostBusiness business = BusinessManager.getBusiness(HostBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> pageRows = business.list_vfsFsSize(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listIORead(){
HostBusiness business = BusinessManager.getBusiness(HostBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> pageRows = business.list_io_read(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listIOWirte(){
HostBusiness business = BusinessManager.getBusiness(HostBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> pageRows = business.list_io_wirte(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String list() throws BusinessException {
HostBusiness business = BusinessManager.getBusiness(HostBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_host(page,rows,query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listAll() throws BusinessException {
HostBusiness business = BusinessManager.getBusiness(HostBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> listRows = business.list_host(query);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(listRows));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", listRows.size());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
}
package com.gaowj.host.action;
import java.util.Date;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
import com.jw.app.business.utils.DateTools;
public class viewAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 949181442473248671L;
public String hostTab() throws BusinessException{
return "hostTab";
}
public String hostTabDetail() throws BusinessException{
return "hostTabDetail";
}
public String hostTabMonitorRow() throws BusinessException{
request.setAttribute("startTime", DateTools.getYestodayFrom());
request.setAttribute("endTime", DateTools.getServerDateTime(10));
return "hostTabMonitorRow";
}
}
package com.gaowj.monitoring.action;
import com.gaowj.business.action.BasicAction;
import net.sf.json.JSONObject;
public class actAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6496396449440750926L;
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
}
package com.gaowj.monitoring.action;
import com.gaowj.business.action.BasicAction;
import net.sf.json.JSONObject;
public class dataAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6083279531948261141L;
private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public int getRows() {
rows = getPageSize();
return rows;
}
public void setRows(int rows) {
setPageSize(rows);
this.rows = getPageSize();
}
public int getPage() {
page = getPageNo();
return page;
}
public void setPage(int page) {
setPageNo(page);
this.page = getPageNo();
}
}
package com.gaowj.monitoring.action;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
public class viewAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 949181442473248671L;
public String warningTab() throws BusinessException{
return "warningTab";
}
}
package com.gaowj.trigger.action;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.Status;
import com.zabbix4j.ZabbixApi;
import com.zabbix4j.ZabbixApiException;
import com.zabbix4j.host.HostCreateRequest;
import com.zabbix4j.trigger.TriggerCreateRequest;
import com.zabbix4j.trigger.TriggerCreateResponse;
import com.zabbix4j.trigger.TriggerDeleteRequest;
import com.zabbix4j.trigger.TriggerDeleteResponse;
import com.zabbix4j.trigger.TriggerUpdateRequest;
import com.zabbix4j.trigger.TriggerUpdateResponse;
import net.sf.json.JSONObject;
public class actAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6496396449440750926L;
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
private static ZabbixApi zabbixApi;
static {
String url = "http://192.168.1.142/api_jsonrpc.php";
zabbixApi = new ZabbixApi(url);
try {
zabbixApi.login("Admin", "zabbix");
} catch (ZabbixApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String insertTrigger() throws BusinessException{
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
TriggerCreateRequest request = new TriggerCreateRequest();
TriggerCreateRequest.Params params = request.getParams();
params.setDescription(entity.get("DESCRIPTION").toString());
params.setExpression(entity.get("EXPRESSION").toString());
/*Possible values are:
0 - (default) not classified;
1 - information;
2 - warning;
3 - average;
4 - high;
5 - disaster.*/
params.setPriority(Integer.valueOf(entity.get("PRIORITY").toString()));
params.setComments(entity.get("COMMENTS").toString());
zabbixApi.trigger().create(request);
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
e.printStackTrace();
}
return "json";
}
public String updateTrigger() throws BusinessException{
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
TriggerUpdateRequest request=new TriggerUpdateRequest();
TriggerUpdateRequest.Params params=request.getParams();
params.setTriggerid(Integer.valueOf(entity.get("TRIGGERID").toString()));
params.setDescription(entity.get("DESCRIPTION").toString());
params.setExpression(entity.get("EXPRESSION").toString());
/*Possible values are:
0 - (default) not classified;
1 - information;
2 - warning;
3 - average;
4 - high;
5 - disaster.*/
params.setPriority(Integer.valueOf(entity.get("PRIORITY").toString()));
params.setComments(entity.get("COMMENTS").toString());
zabbixApi.trigger().update(request);
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
e.printStackTrace();
}
return "json";
}
public String deleteTrigger() throws BusinessException{
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
TriggerDeleteRequest request=new TriggerDeleteRequest();
List<Integer> list_triggerid=new ArrayList<Integer>();
String code=entity.get("CODE").toString();
for(String c:code.split(",")){
list_triggerid.add(Integer.valueOf(c));
}
request.setParams(list_triggerid);
zabbixApi.trigger().delete(request);
jsonObject.putAll(Status.getStatusSuccessMessage("删除成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("删除失败"));
e.printStackTrace();
}
return "json";
}
}
package com.gaowj.trigger.action;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;
import com.gaowj.business.TriggerBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import net.sf.json.JSONObject;
public class dataAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6083279531948261141L;
private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public int getRows() {
rows = getPageSize();
return rows;
}
public void setRows(int rows) {
setPageSize(rows);
this.rows = getPageSize();
}
public int getPage() {
page = getPageNo();
return page;
}
public void setPage(int page) {
setPageNo(page);
this.page = getPageNo();
}
public String list() throws BusinessException {
TriggerBusiness business = BusinessManager.getBusiness(TriggerBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_trigger(pageNo,pageSize, query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
}
package com.gaowj.trigger.action;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
public class viewAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 949181442473248671L;
public String triggerTab() throws BusinessException{
return "triggerTab";
}
public String triggerTabDetail() throws BusinessException{
return "triggerTabDetail";
}
}
package com.gaowj.usergroup.action;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.Status;
import com.zabbix4j.ZabbixApi;
import com.zabbix4j.ZabbixApiException;
import com.zabbix4j.host.HostCreateRequest;
import com.zabbix4j.trigger.TriggerCreateRequest;
import com.zabbix4j.trigger.TriggerCreateResponse;
import com.zabbix4j.trigger.TriggerDeleteRequest;
import com.zabbix4j.trigger.TriggerDeleteResponse;
import com.zabbix4j.trigger.TriggerUpdateRequest;
import com.zabbix4j.trigger.TriggerUpdateResponse;
import com.zabbix4j.usergroup.UserGroupCreateRequest;
import com.zabbix4j.usergroup.UserGroupCreateResponse;
import com.zabbix4j.usergroup.UserGroupDeleteRequest;
import com.zabbix4j.usergroup.UserGroupUpdateRequest;
import net.sf.json.JSONObject;
public class actAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6496396449440750926L;
private JSONObject jsonObject = new JSONObject();
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
private static ZabbixApi zabbixApi;
static {
String url = "http://192.168.1.142/api_jsonrpc.php";
zabbixApi = new ZabbixApi(url);
try {
zabbixApi.login("Admin", "zabbix");
} catch (ZabbixApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String insertUsergroup() throws BusinessException{
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
UserGroupCreateRequest request=new UserGroupCreateRequest();
UserGroupCreateRequest.Params params = request.getParams();
params.setName(entity.get("NAME").toString());
params.setUsers_status(Integer.valueOf(entity.get("USERS_STATUS").toString()));
zabbixApi.usergroup().create(request);
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
e.printStackTrace();
}
return "json";
}
public String updateUsergroup() throws BusinessException{
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
UserGroupUpdateRequest request=new UserGroupUpdateRequest();
UserGroupUpdateRequest.Params params = request.getParams();
params.setName(entity.get("NAME").toString());
params.setUsers_status(Integer.valueOf(entity.get("USERS_STATUS").toString()));
zabbixApi.usergroup().update(request);
jsonObject.putAll(Status.getStatusSuccessMessage("保存成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("保存失败"));
e.printStackTrace();
}
return "json";
}
public String deleteUsergroup() throws BusinessException{
Map<String, Object> entity = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
jsonObject = new JSONObject();
try {
UserGroupDeleteRequest request=new UserGroupDeleteRequest();
List<Integer> list_triggerid=new ArrayList<Integer>();
String code=entity.get("CODE").toString();
for(String c:code.split(",")){
list_triggerid.add(Integer.valueOf(c));
}
request.setParams(list_triggerid);
zabbixApi.usergroup().delete(request);
jsonObject.putAll(Status.getStatusSuccessMessage("删除成功"));
} catch (Exception e) {
jsonObject.putAll(Status.getStatusErrorMessage("删除失败"));
e.printStackTrace();
}
return "json";
}
}
package com.gaowj.usergroup.action;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;
import com.gaowj.business.TriggerBusiness;
import com.gaowj.business.UsergroupBusiness;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.QueryParamUtil;
import com.gaowj.business.util.RequestUtils;
import net.sf.json.JSONObject;
public class dataAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = -6083279531948261141L;
private JSONObject jsonObject = new JSONObject();
private int rows = 20;// 每页显示的记录数
private int page = 1;// 当前第几页
public JSONObject getJsonObject() {
return jsonObject;
}
public void setJsonObject(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
public int getRows() {
rows = getPageSize();
return rows;
}
public void setRows(int rows) {
setPageSize(rows);
this.rows = getPageSize();
}
public int getPage() {
page = getPageNo();
return page;
}
public void setPage(int page) {
setPageNo(page);
this.page = getPageNo();
}
public String list() throws BusinessException {
UsergroupBusiness business = BusinessManager.getBusiness(UsergroupBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_usergroup(pageNo,pageSize, query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
}
package com.gaowj.usergroup.action;
import com.gaowj.business.action.BasicAction;
import com.gaowj.business.exception.BusinessException;
public class viewAction extends BasicAction {
/**
*
*/
private static final long serialVersionUID = 949181442473248671L;
public String usergroupTab() throws BusinessException{
return "usergroupTab";
}
public String usergroupTabDetail() throws BusinessException{
return "usergroupTabDetail";
}
}
...@@ -11,6 +11,7 @@ import org.apache.commons.lang.StringUtils; ...@@ -11,6 +11,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.StudentBusiness; import com.gaowj.business.StudentBusiness;
import com.gaowj.business.TriggerBusiness;
import com.gaowj.business.exception.BusinessException; import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page; import com.gaowj.business.util.Page;
import com.gaowj.business.util.SessionUtil; import com.gaowj.business.util.SessionUtil;
......
...@@ -5,6 +5,7 @@ import java.util.Map; ...@@ -5,6 +5,7 @@ import java.util.Map;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import com.gaowj.business.TriggerBusiness;
import com.gaowj.business.StudentBusiness; import com.gaowj.business.StudentBusiness;
import com.gaowj.business.SystemOpeBusiness; import com.gaowj.business.SystemOpeBusiness;
import com.gaowj.business.action.BasicAction; import com.gaowj.business.action.BasicAction;
......
...@@ -9,6 +9,7 @@ import java.util.Map; ...@@ -9,6 +9,7 @@ import java.util.Map;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import com.gaowj.business.StudentBusiness; import com.gaowj.business.StudentBusiness;
import com.gaowj.business.TriggerBusiness;
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;
......
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