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¥¥:impl¥¥-class¥¥name¥¥=
asap.mbeans.DummyGauge¥¥,name¥¥=DummyGauge¥¥,server¥¥=server:observedattribute=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|GaugeAction|_ThreadID=14;_ThreadName=JMX Monitor Executor Pool [Thread-1];|****javax.management.monitor.MonitorNotification[source=com.sun.appserver.selfmanagement:version=3,monitortype=gaugemonitor,highthreshold=900000,observedattribute=Gauge,numbertype=long,lowthreshold=300000][type=jmx.monitor.error.mbean][message=The observed object must be accessible in the MBeanServerConnection.]****|#]
Thanks in advance,
Susumu Majima