// Home | Go Back //

/*
 * Copyright (c) 2002 iReasoning Inc. All Rights Reserved.
 * 
 * This SOURCE CODE FILE, which has been provided by iReasoning Inc. as part
 * of an iReasoning Software product for use ONLY by licensed users of the product,
 * includes CONFIDENTIAL and PROPRIETARY information of iReasoning Inc.  
 *
 * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
 * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
 * THE PRODUCT.
 *
 * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD IREASONING SOFTWARE, ITS
 * RELATED COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY
 * CLAIMS OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR
 * DISTRIBUTION OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES
 * ARISING OUT OF OR RESULTING FROM THE USE, MODIFICATION, OR
 * DISTRIBUTION OF PROGRAMS OR FILES CREATED FROM, BASED ON, AND/OR
 * DERIVED FROM THIS SOURCE CODE FILE.
 */

package agent.mib2;

import java.util.*;
import java.io.*;
import java.net.*;
import javax.management.*;
import com.sun.jdmk.comm.HtmlAdaptorServer;
import com.ireasoning.util.*;
import com.ireasoning.protocol.snmp.*;

/**
 * A JMX adaptor for remotely managing agent.
 * You can use web browser pointing to http://localhost:8082
 * to view MBeans information. 
*
* Note: In order to compile and run this code, SUN's jmxtools.jar (included in SUN JMX RI) needs to be included in classpath. */
public class JMXAdaptor { public static void main( String[] args ) { try { MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer(); HtmlAdaptorServer htmlServer = new HtmlAdaptorServer(); ObjectName objName = new ObjectName( "Adaptor:name=html,port=8082" ); mbeanServer.registerMBean( htmlServer, objName); //start html adapter, listening on port 8082 htmlServer.start(); // use default agent port 161 int port = 161; String configFile = "SnmpAgent.xml"; Agent agent = new Agent(mbeanServer, port, configFile); agent.start(); } catch(Exception e) { Logger.error(e); } } }