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

📄 node.jsp

📁 opennms得相关源码 请大家看看
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<!--//// This file is part of the OpenNMS(R) Application.//// OpenNMS(R) is Copyright (C) 2002-2003 The OpenNMS Group, Inc.  All rights reserved.// OpenNMS(R) is a derivative work, containing both original code, included code and modified// code that was published under the GNU General Public License. Copyrights for modified // and included code are below.//// OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.//// Modifications://// 2004 Jan 15: Added node admin function.// 2003 Feb 07: Fixed URLEncoder issues.// 2003 Feb 01: Added response time link (Bug #684) and HTTP link (Bug #469).// 2002 Nov 26: Fixed breadcrumbs issue.// // Original code base Copyright (C) 1999-2001 Oculan Corp.  All rights reserved.//// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.//// For more information contact://      OpenNMS Licensing       <license@opennms.org>//      http://www.opennms.org///      http://www.opennms.com///--><%@page language="java" contentType="text/html" session="true" import="java.text.DateFormat,java.io.File,org.opennms.web.element.*,java.util.*,org.opennms.web.authenticate.Authentication,org.opennms.web.event.*,java.net.*,org.opennms.netmgt.utils.IPSorter,org.opennms.web.performance.*,org.opennms.web.response.*,org.opennms.web.asset.*" %><%!    protected int telnetServiceId;    protected int httpServiceId;    protected int dellServiceId;    protected int snmpServiceId;    protected PerformanceModel perfModel;    protected ResponseTimeModel rtModel;    AssetModel model = new AssetModel();    File file = new File("@install.etc.dir@/vulnerabilities.enable");        public void init() throws ServletException {        this.statusMap = new HashMap();        this.statusMap.put( new Character('A'), "Active" );        this.statusMap.put( new Character(' '), "Unknown" );        this.statusMap.put( new Character('D'), "Deleted" );                try {            this.telnetServiceId = NetworkElementFactory.getServiceIdFromName("Telnet");        }        catch( Exception e ) {            throw new ServletException( "Could not determine the Telnet service ID", e );        }                        try {            this.perfModel = new PerformanceModel( org.opennms.core.resource.Vault.getHomeDir() );        }        catch( Exception e ) {            throw new ServletException( "Could not initialize the PerformanceModel", e );        }                try {            this.httpServiceId = NetworkElementFactory.getServiceIdFromName("HTTP");        }        catch( Exception e ) {            throw new ServletException( "Could not determine the HTTP service ID", e );        }        try {            this.dellServiceId = NetworkElementFactory.getServiceIdFromName("Dell-OpenManage");        }        catch( Exception e ) {            throw new ServletException( "Could not determine the Dell-OpenManage service ID", e );        }        try {            this.snmpServiceId = NetworkElementFactory.getServiceIdFromName("SNMP");        }        catch( Exception e ) {            throw new ServletException( "Could not determine the Dell-OpenManage service ID", e );        }        try {            this.perfModel = new PerformanceModel( org.opennms.core.resource.Vault.getHomeDir() );        }        catch( Exception e ) {            throw new ServletException( "Could not initialize the PerformanceModel", e );        }        try {            this.rtModel = new ResponseTimeModel( org.opennms.core.resource.Vault.getHomeDir() );        }        catch( Exception e ) {            throw new ServletException( "Could not initialize the ResponseTimeModel", e );        }    }%><%    String nodeIdString = request.getParameter( "node" );    if( nodeIdString == null ) {        throw new org.opennms.web.MissingParameterException( "node" );    }    int nodeId = Integer.parseInt( nodeIdString );    //get the database node info    Node node_db = NetworkElementFactory.getNode( nodeId );    if( node_db == null ) {        //handle this WAY better, very awful        throw new ServletException( "No such node in database" );    }    //get the child interfaces    Interface[] intfs = NetworkElementFactory.getActiveInterfacesOnNode( nodeId );    if( intfs == null ) {         intfs = new Interface[0];     }    //find the telnet interfaces, if any    String telnetIp = null;    Service[] telnetServices = NetworkElementFactory.getServicesOnNode(nodeId, this.telnetServiceId);        if( telnetServices != null && telnetServices.length > 0 ) {        ArrayList ips = new ArrayList();        for( int i=0; i < telnetServices.length; i++ ) {            ips.add(InetAddress.getByName(telnetServices[i].getIpAddress()));        }                InetAddress lowest = IPSorter.getLowestInetAddress(ips);                if( lowest != null ) {            telnetIp = lowest.getHostAddress();        }    }        //find the HTTP interfaces, if any    String httpIp = null;    Service[] httpServices = NetworkElementFactory.getServicesOnNode(nodeId, this.httpServiceId);    if( httpServices != null && httpServices.length > 0 ) {        ArrayList ips = new ArrayList();        for( int i=0; i < httpServices.length; i++ ) {            ips.add(InetAddress.getByName(httpServices[i].getIpAddress()));        }        InetAddress lowest = IPSorter.getLowestInetAddress(ips);        if( lowest != null ) {            httpIp = lowest.getHostAddress();        }    }    //find the Dell-OpenManage interfaces, if any    String dellIp = null;    Service[] dellServices = NetworkElementFactory.getServicesOnNode(nodeId, this.dellServiceId);    if( dellServices != null && dellServices.length > 0 ) {        ArrayList ips = new ArrayList();        for( int i=0; i < dellServices.length; i++ ) {            ips.add(InetAddress.getByName(dellServices[i].getIpAddress()));        }        InetAddress lowest = IPSorter.getLowestInetAddress(ips);        if( lowest != null ) {            dellIp = lowest.getHostAddress();        }    }    //find if SNMP is on this node     boolean isSnmp = false;    Service[] snmpServices = NetworkElementFactory.getServicesOnNode(nodeId, this.snmpServiceId);    if( snmpServices != null && snmpServices.length > 0 ) 	isSnmp = true;    //Get Asset Info for this node    Asset asset = this.model.getAsset( nodeId );%><html><head>  <title><%=node_db.getLabel()%> | Node | OpenNMS Web Console</title>  <base HREF="<%=org.opennms.web.Util.calculateUrlBase( request )%>" />  <link rel="stylesheet" type="text/css" href="includes/styles.css" /></head><body marginwidth="0" marginheight="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0"><% String breadcrumb1 = "<a href='element/index.jsp'>Search</a>"; %>

⌨️ 快捷键说明

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