JBossSNMPAdapterGetValues

简介:
 

Mapping-configuration, attributes.xml

This file defines the mapping from SNMP-oids to MBeans and their attributes.
(Note: xml driven get/set mapping functionality is available since  jboss v4.0.4.GA.)
The toplevel element  attribute-mapping contains a list of mbeans.
Each  mbean element has to have a  name attribute that specifies the
JMX object name of the mbean to monitor. It can also have an  oid-prefix element
that will be prepended to the oids of the attributes. The  mbean element contains a list
of  attribute tags that each have to have a  name attribute for the
MBean-attribute-name and an  oid attribute that defines the oid under which
this attribute can be queried.

Setup in general configuration

In order to work, the mapping file must be included in the SnmpAgentService-MBean in an attribute called  RequestHandlerResName as the following snippet shows

  <!-- The SNMP adaptor MBean -->
  <mbean code="org.jboss.jmx.adaptor.snmp.agent.SnmpAgentService"
         name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor">
    
    <attribute name="RequestHandlerClassName">org.jboss.jmx.adaptor.snmp.agent.RequestHandlerImpl</attribute>       
    <attribute name="RequestHandlerResName">/attributes.xml</attribute>

Example

This is an excerpt from the sample file from the snmp-adaptor:

<attribute-mappings>
     <!-- system basic information -->
     <mbean name="jboss.system:type=ServerInfo" oid-prefix=".1.2.3.4.1">
          <attribute name="ActiveThreadCount" oid=".1"></attribute>
          <attribute name="FreeMemory" oid=".2"></attribute>
          <attribute name="MaxMemory" oid=".3"></attribute>
     </mbean>
     <mbean name="jboss.system:service=ThreadPool">
          <attribute name="QueueSize" oid=".1.2.3.4.1.4"></attribute>
     </mbean>
     <!-- tomcat global http request processing -->
     <mbean name="jboss.web:name=http-0.0.0.0-8080,type=GlobalRequestProcessor">
          <attribute name="requestCount" oid=".1.2.3.4.1.5"></attribute>
     </mbean>
     <!-- Tx Manager statistics -->
     <mbean name="jboss:service=TransactionManager">
          <attribute name="CommitCount" oid=".1.2.3.4.1.6"></attribute>
          <attribute name="RollbackCount" oid=".1.2.3.4.1.7"></attribute>
          <attribute name="TransactionCount" oid=".1.2.3.4.1.8"></attribute>
     </mbean>
     <!-- DefaultDS statistics -->
     <mbean name="jboss.jca:name=DefaultDS,service=ManagedConnectionPool" 
          oid-prefix=".1.2.3.4.1">
          <attribute name="InUseConnectionCount" oid=".9"></attribute>
     </mbean>
</attribute-mappings>
Note that the provided values will change in the future.
The adaptor now also has support for the MIB-2 system group ( RFC1213)

Reload a changed config

The SnmpAdaptor-MBean now has a  reconfigureRequestHandler Method which forces the adaptor to reread the attributes.xml file without the need to completely restart the adaptor.

Example SNMP-MIB for the above example file

This is an extremely simple MIB file that you can load into your management station to
query the respective values.
Note that this MIB will change in the future.

JBOSS-MIB DEFINITIONS ::=BEGIN
-- Tree roots
org     OBJECT IDENTIFIER ::= { iso 2 } -- "iso" = 1
jboss     OBJECT IDENTIFIER ::= { org 3 }
as     OBJECT IDENTIFIER ::= { jboss 4 }
system     OBJECT IDENTIFIER ::= { as 1 }  -- .1.2.3.4.1
mgmt      OBJECT IDENTIFIER ::= { as 5 }
snmp     OBJECT IDENTIFIER ::= { mgmt 6 }
agent      OBJECT IDENTIFIER ::= { snmp 7 }
-- system parameters
activeThreadCount OBJECT-TYPE
     ACCESS read-only 
     DESCRIPTION
          "The number of active Threads in the system"
     ::= { system 1 } -- .1.2.3.4.1.1
freeMemory OBJECT IDENTIFIER ::= {system 2} -- .1.2.3.4.1.2
maxMemory OBJECT IDENTIFIER ::= {system 3} -- .1.2.3.4.1.3
threadPoolQueueSize OBJECT-TYPE
     ACCESS read-only
     DESCRIPTION
          "The size of the thread pool queue"
     ::= {system 4 }
requestCount8080 OBJECT IDENTIFIER ::= {system 5}
txCommitCount OBJECT IDENTIFIER ::= {system 6 }
txRollbackCount OBJECT IDENTIFIER ::= {system 7 }
txActiveCount OBJECT IDENTIFIER ::= {system 8 }
dbInUseCount OBJECT-TYPE
     ACCES read-only
     DESCRIPTION
          "The number of db connections currently in use"
     ::= { system 9 }

snmp-set

The adaptor now also supports snmp-set. In order for an entry to be settable, it not only needs to be marked read-write in the MIB, but also have an attribute  mode in the attributes.xml file with a value of  rw as in the following example:

   <mbean name="jboss.jmx:name=SnmpAgent,service=snmp,type=systemInfo" 
      oid-prefix=".1.3.6.1.2.1.1">
      <attribute name="SysDescr" oid=".1" mode="rw"></attribute> <!-- can be modified over snmp -->
Note that for this to work, you have to define a write-community in jboss-service.xml for the
main adaptor mbean and also have to set it in your agent. If you fail to do so, the set-request will silently time out (this comes from the underlying library).










本文转自 jxwpx 51CTO博客,原文链接:http://blog.51cto.com/jxwpx/214071,如需转载请自行联系原作者
目录
相关文章
|
5月前
|
XML Java 数据处理
深入了解 XPath
【8月更文挑战第22天】
94 0
|
8月前
|
SQL 分布式计算 HIVE
ApacheHudi使用问题汇总(一)
ApacheHudi使用问题汇总(一)
64 0
|
Windows
cclientX,pageX,screenX等详解
clientX 观点:鼠标相对于WINDOWS的坐标。 这里这个WINDOWS是指我们能看见的浏览器大小。所以不可能超过显示器的大小,如 screen.width,screen.height
128 0
XPATH
学习XPATH。
108 0
|
Web App开发
XPathHelper使用
XPathHelper使用
136 0
|
Kubernetes 网络协议 应用服务中间件
k8s的HPA
实现pod的自动伸缩
533 0
|
存储 安全 Java
PalDB 介绍
开篇  PalDB在我的工作中被大面积使用,场景我就不描述了,这里我只想直白的说一句,这个系列的PalDB博文绝对是国内最详细的,如果有兴趣非常建议收藏了好好看看。
1086 0

热门文章

最新文章