170 likes | 361 Vues
Agent & PDK. JBossNetwork Enterprise Manager. Agenda. Overview of the Agent Architecture Server Agent communications Plugin Development Kit MX4J Example. Agent overview. The JBN EM Server Controls all agents Provides the user interface for interactive monitoring
E N D
Agent & PDK JBossNetwork Enterprise Manager The Professional Open Source™ Company
Agenda • Overview of the Agent Architecture • Server Agent communications • Plugin Development Kit • MX4J Example 2 The Professional Open Source™ Company
Agent overview • The JBN EM Server • Controls all agents • Provides the user interface for interactive monitoring • Tracks and stores historical information including metrics data and control history • Provides security and access control to agent features 3 The Professional Open Source™ Company
Agent overview • JBN EM Agent • Acts on behalf of the server • Organizes auto-inventory scans • Collects metrics information according to the server configured schedule • Accumulated metrics information is streamed to the server on a regular basis 4 The Professional Open Source™ Company
Server agent communication Platform C JBN EM Agent JBN EM Server JBoss Tomcat Control Apache Metrics Platform B JBN EM Agent Platform A JBN EM Agent plugins JBoss A JBoss A Apache JBoss B Apache JBoss B 5 The Professional Open Source™ Company
Plugin overview • A JBN EM Plugin is a self-contained jar or xml file representing a platform, server or service that can be monitored • They include metadata about the inventory hierarch of these resource types in the form of an xml descriptor • This metadata is loaded by both the server and the agent • Plugin hooks are available for • Measurement (metrics) • Control • Auto Inventory • Response Time 6 The Professional Open Source™ Company
Plugin descriptor • The plugin descriptor is named “hq-plugin.xml” when deployed in a plugin jar <plugin package="net.hyperic.hq.product.mx4j"> <property name="template-config“ value="jmxUrl=%jmxUrl%"/> <filter name="ServerInfo“ value="hyperic:type=ServerInfo"/> <server name="Example Server“ version="1.0" description="Example MX4J 3.0 Based Server"> <!-- package attribute above is prepended --> <plugin type="measurement“ class="MX4JMeasurementPlugin"/> <plugin type="autoinventory“ class="MX4JDetector"/> … 7 The Professional Open Source™ Company
Plugin services • Metrics are defined against platforms, servers and services …. <service name="Echo Service"> <plugin type="control“ class="MX4JControlPlugin"/> <config> <option name="service.name" description="Service Name" default=""/> </config> <actions include="start,stop"/> <metrics include="echo-service"/> </service> … 8 The Professional Open Source™ Company
Plugin metrics • Metrics are point in time recordings of numeric information from a resource • Metrics are defined against resources in the descriptor • The server can manage metrics templates that define the default collection interval • The server can define custom collection intervals for a specific sevice 9 The Professional Open Source™ Company
Plugin metrics …. <metrics name="echo-service“> <metric name="Availability" alias="Availability" template="${EchoService},name=%service.name%:${alias}" category="AVAILABILITY" defaultOn="true" indicator="true" units="percentage" collectionType="dynamic"/> <metric name="Uptime" alias="Uptime" template="${EchoService},name=%service.name%:${alias}" category="AVAILABILITY" defaultOn="true" indicator="false" units="ms" collectionType="static"/> </metrics> 10 The Professional Open Source™ Company
Plugin metrics implementation public class MX4JMeasurementPlugin extends MeasurementPlugin { public MetricValue getValue(Metric metric) throws PluginException, MetricNotFoundException, MetricUnreachableException { String jmxUrl = metric.getProperties().getProperty(PROP_JMXURL); String objectName = metric.getObjectName(); String attribute = metric.getAttributeName(); JMXServiceURL url = new JMXServiceURL(jmxUrl); JMXConnector connector = JMXConnectorFactory.connect(url); MBeanServerConnection conn = connector.getMBeanServerConnection(); ObjectName objName = new ObjectName(objectName); return conn.getAttribute(objName, attribute); double val = Double.valueOf(obj.toString()).doubleValue(); return new MetricValue(val); } … 11 The Professional Open Source™ Company
Example metrics defaults 12 The Professional Open Source™ Company
Plugin controls • Below is an example of resource control provided by a plugin • This plugin implements three control actions, start, stop and reload via <actions include="start,stop,restart"/> • These actions can be scheduled and are historically tracked 13 The Professional Open Source™ Company
Plugin controls implementation public void doAction(String action) throws PluginException { String jmxUrl = this.config.getValue(MX4JUtil.PROP_JMXURL); String name = this.config.getValue(MX4JDetector.PROP_SERVICE_NAME); String object = "hyperic:type=EchoServer,name=" + name; // Default to error setResult(RESULT_FAILURE); if (action.equals("start")) { setState(STATE_STARTING); MX4JUtil.invoke(jmxUrl, object, action); setResult(RESULT_SUCCESS); setState(STATE_STARTED); } else if (action.equals("stop")) { setState(STATE_STOPPING); MX4JUtil.invoke(jmxUrl, object, action); setResult(RESULT_SUCCESS); setState(STATE_STOPPED); } } 14 The Professional Open Source™ Company
Plugin autoinventory • The autoinventory plugin can search for known services using means appropriate to the service • HTTP server management could attempt connection to an admin URL on port 80 for example • Autoinventory plugins can also configure file system properties to integrate with the search architecture • Implements List discoverServices(ConfigResponse serverConfig) 15 The Professional Open Source™ Company
Review • We’ve covered • The Server/Agent architecture of JBN EM • The Server management and display of metrics collection, control operation and autoinventory • The Agent plugin architecture including • The execution of plugin implementations • The definition of resource metadata • The implementation of metrics gathering 16 The Professional Open Source™ Company
Q & A Thanks for your time! 17 The Professional Open Source™ Company