users@glassfish.java.net

RE: BUG? HELP NEED:Management Rule with MBean does not work

From: 真嶌 晋 <susumu.majima_at_mail.rakuten.co.jp>
Date: Mon, 23 Jun 2008 11:47:30 +0900

Hello,

I guess it's bug. Does anyone have the same problem?
I would like developers to chek it.
 
Susumu

> -----Original Message-----
> From: 真嶌 晋 [mailto:susumu.majima_at_mail.rakuten.co.jp]
> Sent: Friday, June 20, 2008 7:21 PM
> To: users_at_glassfish.dev.java.net
> Subject: HELP NEED:Management Rule with MBean does not work
>
>
> Hello,
>
> I write dummy MBean to check gauge monitor functionality.
> I need that he/she successfully wrote management rules with
> MBean helps me.
>
> ACTION MBEAN
> =============
>
> package asap.action;
>
> public interface GaugeActionMBean {
>
> }
>
>
> package asap.action;
>
> import java.util.logging.Logger;
>
> import javax.management.Notification;
> import javax.management.NotificationListener;
>
> public class GaugeAction implements GaugeActionMBean,
> NotificationListener {
>
> private Logger log = Logger.getLogger("GaugeAction");
>
> @Override
> public void handleNotification(Notification
> notification, Object handback) {
>
> log.info("****" + notification.toString() + "****");
>
> }
>
> }
>
>
> DUMMY CHECKING MBEAN
> ======================
>
> package asap.mbeans;
>
> public interface DummyGaugeMBean {
> public long getGuage();
> }
>
> package asap.mbeans;
>
> import java.util.logging.Logger;
>
> public class DummyGauge implements DummyGaugeMBean {
>
> Logger log = Logger.getLogger("DummyGauge");
>
> private long gauge = 100000L;
> private long multi = 1L;
> private final long GAUGE_STEP = 100000L;
> private final long MAX_GAUGE = 1000000L;
> private final long MIN_GAUGE = 100000L;
>
> @Override
> public synchronized long getGuage() {
> return setupGauge();
> }
>
> private long setupGauge() {
>
> gauge += multi * GAUGE_STEP;
>
> if(gauge == MAX_GAUGE || gauge == MIN_GAUGE) {
> multi *= -1L;
> }
>
> log.info("DummyGauge" + gauge);
>
> return gauge;
>
> }
>
> }
>
> --------------------------------------------------------------
> 1) create-mbean for above two.
> asadmin create-mbean --name GaugeAction
> asap.action.GaugeAction asadmin create-mbean --name
> Dummygauge asap.mbeans.Dummygauge
>
> 2) create-management-rule
> asadmin create-management-rule --action gaugeAction
> --eventtype monitor --eventloglevel WARNING --eventproperties
> monitortype=gaugemonitor:lowthreshold=300000:
> highthreshold=900000:numbertype=long:observedobject=user¥¥:imp
> l¥¥-class¥¥name¥¥=
> asap.mbeans.DummyGauge¥¥,name¥¥=DummyGauge¥¥,server¥¥=server:o
> bservedattribute=Gauge Gauge_Rule
>
>
>
> I notice DummyGauge never be called by checking server.log.
>
> Log in GaugeAction says "The obeserved object must be
> accessible in the MBeanServerConnection".
> What it means. Is rule I set wrong ? Anything will be helpful.
>
>
> LOG
> [#|2008-06-20T18:08:26.795+0900|INFO|sun-appserver9.1|GaugeAct
> ion|_ThreadID=14;_ThreadName=JMX Monitor Executor Pool
> [Thread-1];|****javax.management.monitor.MonitorNotification[s
> ource=com.sun.appserver.selfmanagement:version=3,monitortype=g
> augemonitor,highthreshold=900000,observedattribute=Gauge,numbe
> rtype=long,lowthreshold=300000][type=jmx.monitor.error.mbean][
> message=The observed object must be accessible in the
> MBeanServerConnection.]****|#]
>
> Thanks in advance,
>
> Susumu Majima
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>