⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alert.java

📁 “JSP数据库项目案例导航”一书从第一章到第十一章各章实例的源程序文件以及数据库文件。 注意: 1. 本书中的案例提供的数据库环境不同
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                    "' order by id desc");
                Vector result = DBAccess.getBatchData(
                    "select status from cicsregions where ipaddress='" + hostip +
                    "' and timestamp='" + timestamp[0] + "'");
                for(int i = 0; i < result.size(); i++)
                {
                    String status = ( (String)result.elementAt(i)).trim();
                    if(!status.equalsIgnoreCase(AlertProperties.region_normal.trim()))
                    {
                        msg += WarningMsg.CICSREGIONS_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"CICS regions \"警报数据时产生异常");
                e.printStackTrace();
            }
        }

        if(AlertProperties.isWarning(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_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"cics warning 数目\"警报数据时产生异常");
                e.printStackTrace();
            }
        }

        if(AlertProperties.isWarning(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_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"cics error 数目\"警报数据时产生异常");
                e.printStackTrace();
            }
        }

        if(AlertProperties.isWarning(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 * 100 / total;
                    if(ratio > AlertProperties.cics_transaction_min)
                    {
                        msg += WarningMsg.CICS_TRANSACTION_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"cics transaction 数目\"警报数据时产生异常");
                e.printStackTrace();
            }

        }

        if(AlertProperties.isWarning(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_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"cics transaction 数目\"警报数据时产生异常");
                e.printStackTrace();
            }
        }

        if(AlertProperties.isWarning(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_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"cics transaction 数目\"警报数据时产生异常");
                e.printStackTrace();
            }
        }

        if(AlertProperties.isWarning(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_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"cics error 数目\"警报数据时产生异常");
                e.printStackTrace();
            }
        }

        if(AlertProperties.isWarning(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_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"cics error 数目\"警报数据时产生异常");
                e.printStackTrace();
            }
        }

        if(AlertProperties.isWarning(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_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"cics error 数目\"警报数据时产生异常");
                e.printStackTrace();
            }
        }

        if(AlertProperties.isWarning(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)).trim();
                    if(!status.equalsIgnoreCase(AlertProperties.sna_linkstation_normal))
                    {
                        msg += WarningMsg.SNA_LINKSTATION_CODE;
                        break;
                    }
                }
            }
            catch(NullPointerException ne)
            {}
            catch(Exception e)
            {
                System.err.println("在生成\"snals \"警报数据时产生异常");
                e.printStackTrace();
            }
        }

        if(AlertProperties.isWarning(AlertProperties.sna_LU_level))
        {
            try
            { //SNA snasession 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_CODE;
                        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;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -