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,如需转载请自行联系原作者
目录
相关文章
|
机器人
如何查询OpenAI账户余额?ChatGPT怎么查看账户余额的方法
ChatGPT是美国OpenAI研发的聊天机器人程序,也是最近火爆全网的热门应用和话题之王。很多用户在使用openai的时候不知道如何查询OpenAI账户余额?
2766 0
|
Python
循环的嵌套
在编程中,循环结构是一种非常重要的控制结构,用于重复执行一段代码。而循环的嵌套则是指在一个循环内部又包含了另一个或多个循环,使得代码的执行更加复杂和灵活。本文将介绍循环嵌套的概念、使用场景以及示例代码。
267 1
|
SQL Oracle 关系型数据库
FastAPI数据库系列(一) MySQL数据库操作 一、简介
FastAPI中你可以使用任何关系型数据库,可以通过SQLAlchemy将其轻松的适应于任何的数据库,比如: PostgreSQL MySQL SQLite Oracle Microsoft SQL Server ...
|
存储 安全 Java
Qt线程池+生产者消费者模型
Qt线程池+生产者消费者模型
642 5
|
安全 关系型数据库 数据库
阿里云RDS PostgreSQL版支持 PG17,还不来体验?
PostgreSQL被誉为最先进的开源数据库,具有强大的扩展性和灵活架构。9月26日,社区官方正式发布了PostgreSQL 17.0版本,在性能、逻辑复制、开发者体验等方面进行了优化。阿里云RDS PostgreSQL 版已支持 PostgreSQL 17.0,并在社区17.0基础上,进行了安全、成本、可运维性等多方面提升,增加多种内核特性及插件特性。
|
调度 Python
揭秘Python并发编程核心:深入理解协程与异步函数的工作原理
在Python异步编程领域,协程与异步函数成为处理并发任务的关键工具。协程(微线程)比操作系统线程更轻量级,通过`async def`定义并在遇到`await`表达式时暂停执行。异步函数利用`await`实现任务间的切换。事件循环作为异步编程的核心,负责调度任务;`asyncio`库提供了事件循环的管理。Future对象则优雅地处理异步结果。掌握这些概念,可使代码更高效、简洁且易于维护。
194 1
|
人工智能 算法 数据挖掘
技术沙龙直播|3D-Speaker多模态说话人开源详解
技术沙龙直播|3D-Speaker多模态说话人开源详解
接口签名:参数名按ASCII码从小到大排序+Key+MD5+转大写签名
接口签名:参数名按ASCII码从小到大排序+Key+MD5+转大写签名
471 1
|
安全 Linux 测试技术
|
传感器 vr&ar 计算机视觉
增强现实(AR)技术原理深度解析
【5月更文挑战第5天】本文深度解析了增强现实(AR)技术原理,包括图像识别与跟踪、三维注册技术和显示技术,并探讨了AR在游戏、教育、工业和医疗等领域的广泛应用。尽管面临准确性、成本和隐私等挑战,但随着技术进步,AR将在更多领域发挥关键作用,展现其潜力和价值。
2341 2