使用openNMS监控JBoss系统状态

openNMS一共有两种JMX agent,一种是 jmx(或叫做jboss4)plugin,另一种是JSR160 Plugin。
尽管openNMS提供了监控jboss的Jboss* Plugin, 但是只限与jboss3.2或者jboss4.x, 所以本文主要描述如何通过JSR160 Plugin来收集jboss返回的状态参数,从而达到监控jboss的目的。

一,配置capsd
打开 $OPENNMS_HOME/etc/capsd-configuration.xml, 添加如下代码:

<protocol-plugin protocol="JBoss" class-name="org.opennms.netmgt.capsd.plugins.Jsr160Plugin" scan="on" user-defined="false">
<property key="port" value="1090"/>
<property key="type" value="default"/>
<property key="protocol" value="rmi"/>
<property key="urlPath" value="/jmxconnector"/>
<property key="retry" value="2"/>
<property key="timeout" value="2000"/>
</protocol-plugin>


二,配置 poller(轮询)
打开 $OPENNMS_HOME/etc/poller-configuration.xml, 添加如下代码:

<service name="JBoss" interval="300000" user-defined="false" status="on">
<parameter key="port" value="1090"/>
<parameter key="retry" value="2"/>
<parameter key="timeout" value="3000"/>
<parameter key="rrd-repository" value="C:/PROGRA~2/OpenNMS/share/rrd/response"/>
<parameter key="ds-name" value="jmx"/>
<parameter key="friendly-name" value="jboss"/>
</service>


在poller-configuration.xml的末尾,加上:
<monitor service="JBoss"  	class-name="org.opennms.netmgt.poller.monitors.Jsr160Monitor" />


三,配置collected-configuration.xml
打开 $OPENNMS_HOME/etc/collected-configuration.xml,配置如下:

<package name="jboss">
<filter>IPADDR IPLIKE *.*.*.*</filter>
<include-range begin="1.1.1.1" end="254.254.254.254"/>
<service name="JBoss" interval="300000" user-defined="false" status="on">
<parameter key="port" value="1090"/>
<parameter key="retry" value="2"/>
<parameter key="timeout" value="3000"/>
<!--
<property key="username" value="<username>"/>
<property key="password" value="<password>"/>
-->
<parameter key="protocol" value="rmi"/>
<parameter key="urlPath" value="/jmxconnector"/>
<parameter key="ds-name" value="jmx"/>
<parameter key="friendly-name" value="jboss"/>
<!-- This must match the collection name in the jmx-datacollection.xml that defines the set of mbeans you want -->
<parameter key="collection" value="jboss"/>
</service>
</package>

<collector service="JBoss" class-name="org.opennms.netmgt.collectd.Jsr160Collector"/>


四,配置jmx-datacollection-config.xml
打开 $OPENNMS_HOME/etc/collected-configuration.xml,配置如下:

<jmx-collection name="jboss">
<rrd step = "300">
<rra>RRA:AVERAGE:0.5:1:8928</rra>
<rra>RRA:AVERAGE:0.5:12:8784</rra>
<rra>RRA:MIN:0.5:12:8784</rra>
<rra>RRA:MAX:0.5:12:8784</rra>
</rrd>

<mbean name="DefaultDSManagedConnectionPool" objectname="jboss.jca:service=ManagedConnectionPool,name=DefaultDS">
<attrib name="AvailableConnectionCount" alias="DefDS_AvailConns" type="gauge"/>
<attrib name="ConnectionCount" alias="DefDS_Conns" type="gauge"/>
<attrib name="InUseConnectionCount" alias="DefDS_InUseConns" type="gauge"/>
<attrib name="ConnectionCreatedCount" alias="DefDS_CreatedConns" type="counter"/>
<attrib name="ConnectionDestroyedCount" alias="DefDS_DestroyConns" type="counter"/>
</mbean>
</jmx-collection>


五,配置snmp-graph.properties

report.jboss.defaultDS.name=Default DS
report.jboss.defaultDS.columns=DefDS_AvailConns, DefDS_Conns, DefDS_InUseConns, DefDS_CreatedConns, DefDS_DestroyConns
report.jboss.defaultDS.type=interfaceSnmp
report.jboss.defaultDS.command=--title="DS Connection Pool" \
DEF:available={rrd1}:DefDS_AvailConns:AVERAGE \
DEF:minAvailable={rrd1}:DefDS_AvailConns:MIN \
DEF:maxAvailable={rrd1}:DefDS_AvailConns:MAX \
DEF:total={rrd2}:DefDS_Conns:AVERAGE \
DEF:minTotal={rrd2}:DefDS_Conns:MIN \
DEF:maxTotal={rrd2}:DefDS_Conns:MAX \
DEF:inuse={rrd3}:DefDS_InUseConns:AVERAGE \
DEF:minInuse={rrd3}:DefDS_InUseConns:MIN \
DEF:maxInuse={rrd3}:DefDS_InUseConns:MAX \
DEF:created={rrd4}:DefDS_CreatedConns:AVERAGE \
DEF:minCreated={rrd4}:DefDS_CreatedConns:MIN \
DEF:maxCreated={rrd4}:DefDS_CreatedConns:MAX \
DEF:destroyed={rrd5}:DefDS_DestroyConns:AVERAGE \
DEF:minDestroyed={rrd5}:DefDS_DestroyConns:MIN \
DEF:maxDestroyed={rrd5}:DefDS_DestroyConns:MAX \
LINE2:available#0000ff:"Available" \
GPRINT:available:AVERAGE:" Avg \\: %5.2lf %s" \
GPRINT:available:MIN:"Min \\: %5.2lf %s" \
GPRINT:available:MAX:"Max \\: %5.2lf %s\\n" \
LINE2:total#00ff00:"Current " \
GPRINT:total:AVERAGE:" Avg \\: %5.2lf %s" \
GPRINT:total:MIN:"Min \\: %5.2lf %s" \
GPRINT:total:MAX:"Max \\: %5.2lf %s\\n" \
LINE2:inuse#ff0000:"InUse " \
GPRINT:inuse:AVERAGE:" Avg \\: %5.2lf %s" \
GPRINT:inuse:MIN:"Min \\: %5.2lf %s" \
GPRINT:inuse:MAX:"Max \\: %5.2lf %s\\n" \
LINE2:created#00fff0:"Created " \
GPRINT:created:AVERAGE:" Avg \\: %5.2lf %s" \
GPRINT:created:MIN:"Min \\: %5.2lf %s" \
GPRINT:created:MAX:"Max \\: %5.2lf %s\\n" \
LINE2:destroyed#c0a000:"Destroyed" \
GPRINT:destroyed:AVERAGE:" Avg \\: %5.2lf %s" \
GPRINT:destroyed:MIN:"Min \\: %5.2lf %s" \
GPRINT:destroyed:MAX:"Max \\: %5.2lf %s\\n"

配置完毕,重启opennms,大概5分钟后, 查看jboss做在的节点, 点击resource graphics,就可以看到刚才配置的连接池状态图已经出现了,让opennms持续收集一段时间,线状图就出来了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值