📄 alert.java
字号:
if(AlertProperties.isNotAction(AlertProperties.cics_warninglog_level))
{
try
{ //regionerror warning 数目
String[] timestamp = DBAccess.getLatestData(
"select timestamp from regionerror where ipaddress='" + hostip +
"' order by id desc");
Vector usagesV = DBAccess.getBatchData(
"select warning from regionerror where ipaddress='" + hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < usagesV.size(); i++)
{
int warning = Integer.parseInt( (String)usagesV.elementAt(i));
if(warning > AlertProperties.cics_warninglog_min)
{
msg += WarningMsg.CICSREGIONSLOG_WARNINGLOG_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"cics warning 数目\"警报数据时产生异常");
e.printStackTrace();
}
}
if(AlertProperties.isNotAction(AlertProperties.cics_errorlog_level))
{
try
{ //regionerror error 数目
String[] timestamp = DBAccess.getLatestData(
"select timestamp from regionerror where ipaddress='" + hostip +
"' order by id desc");
Vector usagesV = DBAccess.getBatchData(
"select error from regionerror where ipaddress='" + hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < usagesV.size(); i++)
{
int error = Integer.parseInt( (String)usagesV.elementAt(i));
if(error > AlertProperties.cics_errorlog_min)
{
msg += WarningMsg.CICSREGIONSLOG_ERRORLOG_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"cics error 数目\"警报数据时产生异常");
e.printStackTrace();
}
}
if(AlertProperties.isNotAction(AlertProperties.cics_transaction_level))
{
try
{ //cics transaxion 数目
String[] timestamp = DBAccess.getLatestData(
"select timestamp from cicslogspace where ipaddress='" + hostip +
"' order by id desc");
Vector usagesV = DBAccess.getBatchData(
"select freepages ,total from cicslogspace where ipaddress='" +
hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < usagesV.size(); )
{
int freepages = Integer.parseInt( (String)usagesV.elementAt(i++));
int total = Integer.parseInt( (String)usagesV.elementAt(i++));
int ratio = freepages / total;
if(ratio > AlertProperties.cics_transaction_min)
{
msg += WarningMsg.CICS_TRANSACTION_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"cics transaction 数目\"警报数据时产生异常");
e.printStackTrace();
}
}
if(AlertProperties.isNotAction(AlertProperties.cics_region_pool_level))
{
try
{ //region pool RATIO
String[] timestamp = DBAccess.getLatestData(
"select timestamp from cicsregspar where ipaddress='" + hostip +
"' order by id desc");
Vector usagesV = DBAccess.getBatchData(
"select RCurrentAllocated ,RegionPoolSize from cicsregspar where ipaddress='" +
hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < usagesV.size(); )
{
int RCurrentAllocated = Integer.parseInt( (String)usagesV.elementAt(
i++));
int RegionPoolSize = Integer.parseInt( (String)usagesV.elementAt(i++));
int ratio = (RegionPoolSize - RCurrentAllocated) * 100 /
RegionPoolSize;
if(ratio < AlertProperties.cics_region_pool_min)
{
msg += WarningMsg.CICS_REGION_POOL_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"cics transaction 数目\"警报数据时产生异常");
e.printStackTrace();
}
}
if(AlertProperties.isNotAction(AlertProperties.cics_task_share_level))
{
try
{ //region pool RATIO
String[] timestamp = DBAccess.getLatestData(
"select timestamp from cicsregspar where ipaddress='" + hostip +
"' order by id desc");
Vector usagesV = DBAccess.getBatchData(
"select TCurrentAllocated ,TaskShrPoolSize from cicsregspar where ipaddress='" +
hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < usagesV.size(); )
{
int TCurrentAllocated = Integer.parseInt( (String)usagesV.elementAt(
i++));
int TaskShrPoolSize = Integer.parseInt( (String)usagesV.elementAt(i++));
int ratio = (TaskShrPoolSize - TCurrentAllocated) * 100 /
TaskShrPoolSize;
if(ratio < AlertProperties.cics_task_share_min)
{
msg += WarningMsg.CICS_REGION_TASKSHARE_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"cics transaction 数目\"警报数据时产生异常");
e.printStackTrace();
}
}
if(AlertProperties.isNotAction(AlertProperties.cics_applicatin_level))
{
try
{ //CICS APPLICATION 数目
String[] timestamp = DBAccess.getLatestData(
"select timestamp from cicsregspar where ipaddress='" + hostip +
"' order by id desc");
Vector usagesV = DBAccess.getBatchData(
"select AppServerFull from cicsregspar where ipaddress='" + hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < usagesV.size(); i++)
{
int AppServerFull = Integer.parseInt( (String)usagesV.elementAt(i));
if(AppServerFull > AlertProperties.cics_applicatin_min)
{
msg += WarningMsg.CICS_APPLICATIONSERVER_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"cics error 数目\"警报数据时产生异常");
e.printStackTrace();
}
}
if(AlertProperties.isNotAction(AlertProperties.cics_abend_level))
{
try
{ //CICS TaskTransabended 数目
String[] timestamp = DBAccess.getLatestData(
"select timestamp from cicsregspar where ipaddress='" + hostip +
"' order by id desc");
Vector usagesV = DBAccess.getBatchData(
"select TaskTransabended from cicsregspar where ipaddress='" +
hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < usagesV.size(); i++)
{
int TaskTransabended = Integer.parseInt( (String)usagesV.elementAt(i));
if(TaskTransabended > AlertProperties.cics_abend_min)
{
msg += WarningMsg.CICS_ABEND_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"cics error 数目\"警报数据时产生异常");
e.printStackTrace();
}
}
if(AlertProperties.isNotAction(AlertProperties.cics_jam_level))
{
try
{ //CICS TaskTransabended 数目
String[] timestamp = DBAccess.getLatestData(
"select timestamp from cicsregspar where ipaddress='" + hostip +
"' order by id desc");
Vector usagesV = DBAccess.getBatchData(
"select TaskPeak from cicsregspar where ipaddress='" + hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < usagesV.size(); i++)
{
int TaskPeak = Integer.parseInt( (String)usagesV.elementAt(i));
if(TaskPeak > AlertProperties.cics_jam_min)
{
msg += WarningMsg.CICS_JAM_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"cics error 数目\"警报数据时产生异常");
e.printStackTrace();
}
}
if(AlertProperties.isNotAction(AlertProperties.sna_linkstation_level))
{
try
{ //SNA linkstation status
String[] timestamp = DBAccess.getLatestData(
"select timestamp from snals where ipaddress='" + hostip +
"' order by id desc");
Vector result = DBAccess.getBatchData(
"select state from snals where ipaddress='" + hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < result.size(); i++)
{
String status = (String)result.elementAt(i);
if(!status.equalsIgnoreCase(AlertProperties.sna_linkstation_normal))
{
msg += WarningMsg.SNA_LINKSTATION_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"CICS regions \"警报数据时产生异常");
e.printStackTrace();
}
}
if(AlertProperties.isNotAction(AlertProperties.sna_LU_level))
{
try
{ //SNA linkstation status
String[] timestamp = DBAccess.getLatestData(
"select timestamp from snasession where ipaddress='" + hostip +
"' order by id desc");
Vector result = DBAccess.getBatchData(
"select Session from snasession where ipaddress='" + hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < result.size(); i++)
{
String status = (String)result.elementAt(i);
if("".equals(status))
{
msg += WarningMsg.SNA_LU_MSG;
break;
}
}
}
catch(NullPointerException ne)
{}
catch(Exception e)
{
System.err.println("在生成\"snasession\"警报数据时产生异常");
e.printStackTrace();
}
}
// System.out.println("电话报警信息:" + msg);
if(msg.equals(init))
{ //如果没有得到任何警告信息
msg = null;
}
return msg;
}
public static String getAutoRunScripts(String hostip)
{
String init = "";
String scripts = init;
try
{ //fs
String[] timestamp = DBAccess.getLatestData(
"select timestamp from fs where ipaddress='" + hostip +
"' order by id desc");
Vector result = DBAccess.getBatchData(
"select used ,Mounted from fs where ipaddress='" + hostip +
"' and timestamp='" + timestamp[0] + "'");
for(int i = 0; i < result.size() / 2; i++)
{
String tempUsed = (String)result.elementAt(i * 2);
int value = Integer.parseInt(tempUsed);
if(value > AlertProperties.fs_use_min)
{
scripts += "fs." + (String)result.elementAt(i * 2 + 1) + ".ritem@";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -