Search in sources :

Example 1 with MetricData

use of com.sun.messaging.jmq.util.MetricData in project openmq by eclipse-ee4j.

the class JVMMonitor method getMonitorData.

@Override
protected Hashtable getMonitorData() {
    Hashtable mapMessage = new Hashtable();
    MetricManager mm = Globals.getMetricManager();
    MetricData md = mm.getMetrics();
    mapMessage.put("freeMemory", Long.valueOf(md.freeMemory));
    mapMessage.put("maxMemory", Long.valueOf(Runtime.getRuntime().maxMemory()));
    mapMessage.put("totalMemory", Long.valueOf(md.totalMemory));
    return mapMessage;
}
Also used : MetricManager(com.sun.messaging.jmq.jmsserver.service.MetricManager) MetricData(com.sun.messaging.jmq.util.MetricData)

Example 2 with MetricData

use of com.sun.messaging.jmq.util.MetricData in project openmq by eclipse-ee4j.

the class BrokerMetricsMonitor method getMonitorData.

@Override
protected Hashtable getMonitorData() {
    Hashtable mapMessage = new Hashtable();
    MetricManager mm = Globals.getMetricManager();
    MetricData md = mm.getMetrics();
    mapMessage.put("numConnections", Long.valueOf(md.nConnections));
    mapMessage.put("numMsgsIn", Long.valueOf(md.totals.messagesIn));
    mapMessage.put("numMsgsOut", Long.valueOf(md.totals.messagesOut));
    mapMessage.put("numMsgs", Long.valueOf(Globals.getDestinationList().totalCount()));
    mapMessage.put("msgBytesIn", Long.valueOf(md.totals.messageBytesIn));
    mapMessage.put("msgBytesOut", Long.valueOf(md.totals.messageBytesOut));
    mapMessage.put("numPktsIn", Long.valueOf(md.totals.packetsIn));
    mapMessage.put("numPktsOut", Long.valueOf(md.totals.packetsOut));
    mapMessage.put("pktBytesIn", Long.valueOf(md.totals.packetBytesIn));
    mapMessage.put("pktBytesOut", Long.valueOf(md.totals.packetBytesOut));
    mapMessage.put("totalMsgBytes", Long.valueOf(Globals.getDestinationList().totalBytes()));
    /*
         * Calculate number of destinations. We cannot use Destination.destinationsSize() here because that includes all
         * destinations. We need to filter out internal/admin destinations - basically what is returned by DestListMonitor.
         */
    Iterator[] itrs = Globals.getDestinationList().getAllDestinations(null);
    Iterator itr = itrs[0];
    long numDests = 0;
    while (itr.hasNext()) {
        Destination oneDest = (Destination) itr.next();
        if (oneDest.isInternal() || oneDest.isAdmin() || (oneDest.getDestinationName().equals(MessageType.JMQ_BRIDGE_ADMIN_DEST)) || (oneDest.getDestinationName().equals(MessageType.JMQ_ADMIN_DEST))) {
            continue;
        }
        numDests++;
    }
    mapMessage.put("numDestinations", Long.valueOf(numDests));
    return mapMessage;
}
Also used : MetricManager(com.sun.messaging.jmq.jmsserver.service.MetricManager) MetricData(com.sun.messaging.jmq.util.MetricData)

Example 3 with MetricData

use of com.sun.messaging.jmq.util.MetricData in project openmq by eclipse-ee4j.

the class MetricManager method getMetrics.

/**
 * Gather performance data for all connections in a broker, compute dervied numbers, and return in one convenience class
 */
public synchronized MetricData getMetrics() {
    MetricData md = new MetricData();
    Runtime rt = Runtime.getRuntime();
    long currentTime = System.currentTimeMillis();
    // long elapsedSecs = (currentTime - lastSampleTime) / 1000;
    float elapsedSecs = (currentTime - lastSampleTime) / (float) 1000;
    MetricCounters totals = getMetricCounters(null);
    // Copy values into MetricData
    md.timestamp = currentTime;
    md.totalMemory = rt.totalMemory();
    md.freeMemory = rt.freeMemory();
    md.nConnections = totals.nConnections;
    // Totals are straight copies
    md.setTotals(totals);
    // Rates must be computed
    md.rates.messagesIn = (long) ((totals.messagesIn - lastSample.messagesIn) / elapsedSecs);
    md.rates.messageBytesIn = (long) ((totals.messageBytesIn - lastSample.messageBytesIn) / elapsedSecs);
    md.rates.packetsIn = (long) ((totals.packetsIn - lastSample.packetsIn) / elapsedSecs);
    md.rates.packetBytesIn = (long) ((totals.packetBytesIn - lastSample.packetBytesIn) / elapsedSecs);
    md.rates.messagesOut = (long) ((totals.messagesOut - lastSample.messagesOut) / elapsedSecs);
    md.rates.messageBytesOut = (long) ((totals.messageBytesOut - lastSample.messageBytesOut) / elapsedSecs);
    md.rates.packetsOut = (long) ((totals.packetsOut - lastSample.packetsOut) / elapsedSecs);
    md.rates.packetBytesOut = (long) ((totals.packetBytesOut - lastSample.packetBytesOut) / elapsedSecs);
    lastSampleTime = currentTime;
    lastSample = totals;
    return md;
}
Also used : MetricCounters(com.sun.messaging.jmq.util.MetricCounters) MetricData(com.sun.messaging.jmq.util.MetricData)

Aggregations

MetricData (com.sun.messaging.jmq.util.MetricData)3 MetricManager (com.sun.messaging.jmq.jmsserver.service.MetricManager)2 MetricCounters (com.sun.messaging.jmq.util.MetricCounters)1