You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Matteo <sp...@gmail.com> on 2012/11/26 11:06:56 UTC

Count number of messages

Hello,
in our infrastructure we are currently running Qpid java broker 0.12, with
a pretty standard configuration.

We have the need to connect our monitoring system to Qpid and count some
metrics. In particular, we would like to know the total number of messages
handled by all the queues at any given time.

What is the easiest way to implement it.

Thanks,
Mat

Re: Count number of messages

Posted by Matteo <sp...@gmail.com>.
Alex,
I found that <statistics> was missing from my configuration, so I didn't
have the total attribute values in the VirtualHost.VirtualHostManager.test
bean.

It's working good now.

Thanks,
Matteo


On Mon, Nov 26, 2012 at 12:34 PM, Matteo <sp...@gmail.com> wrote:

> Hello Alex,
> managed to connect via jconsole to verify the Attribute values for
> VirtualHost.VirtualHostManager.test (had some firewall issues on the return
> ports)
>
> Problem I have now is that all those attributes are 0, although I can see
> traffic on the queue.
>
>
> Thanks,
> Matteo
>
>
>
>
>
> On Mon, Nov 26, 2012 at 11:52 AM, Oleksandr Rudyy <or...@gmail.com>wrote:
>
>> Hi Mat,
>>
>> Could you please clarify what do you mean under "messages handled by
>> all the queues at any given time"?
>>
>> Is it the total number of messages received by the queues, or the
>> total number of messages hold by the queues or messages
>> receive/delivery rates?
>>
>> If any of the above, the  easiest way to get such information is to
>> use broker JMX API.
>> For example, you can get the value of total number of messages
>> received on virtual host by looking into attribute
>> "TotalMessagesReceived" on virtual host MBean.
>>
>> Here is the sample JMX code, retrieving the value of
>> "TotalMessagesReceived" for virtual host "test" :
>>
>> public static void main(String[] args) throws Exception
>>     {
>>         Map<String, Object> environment = new HashMap<String, Object>();
>>
>>      environment.put(JMXConnector.CREDENTIALS, new String[]
>> {"admin","admin"});
>>      JMXServiceURL url =  new
>> JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi");
>>      JMXConnector jmxConnector = JMXConnectorFactory.connect(url,
>> environment);
>>      MBeanServerConnection mbsc =
>>  jmxConnector.getMBeanServerConnection();
>>
>>      ObjectName virtualHost = new
>>
>> ObjectName("org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=\"test\"");
>>      Long totalNumberOfMessagesOnVirtualHost =
>> (Long)mbsc.getAttribute(virtualHost, "TotalMessagesReceived");
>>
>>      System.out.println("Number of messages:" +
>> totalNumberOfMessagesOnVirtualHost);
>>
>>     }
>>
>> Kind Regards,
>> Alex
>>
>> On 26 November 2012 10:06, Matteo <sp...@gmail.com> wrote:
>> > Hello,
>> > in our infrastructure we are currently running Qpid java broker 0.12,
>> with
>> > a pretty standard configuration.
>> >
>> > We have the need to connect our monitoring system to Qpid and count some
>> > metrics. In particular, we would like to know the total number of
>> messages
>> > handled by all the queues at any given time.
>> >
>> > What is the easiest way to implement it.
>> >
>> > Thanks,
>> > Mat
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>> For additional commands, e-mail: users-help@qpid.apache.org
>>
>>
>

Re: Count number of messages

Posted by Matteo <sp...@gmail.com>.
Hello Alex,
managed to connect via jconsole to verify the Attribute values for
VirtualHost.VirtualHostManager.test (had some firewall issues on the return
ports)

Problem I have now is that all those attributes are 0, although I can see
traffic on the queue.


Thanks,
Matteo




On Mon, Nov 26, 2012 at 11:52 AM, Oleksandr Rudyy <or...@gmail.com> wrote:

> Hi Mat,
>
> Could you please clarify what do you mean under "messages handled by
> all the queues at any given time"?
>
> Is it the total number of messages received by the queues, or the
> total number of messages hold by the queues or messages
> receive/delivery rates?
>
> If any of the above, the  easiest way to get such information is to
> use broker JMX API.
> For example, you can get the value of total number of messages
> received on virtual host by looking into attribute
> "TotalMessagesReceived" on virtual host MBean.
>
> Here is the sample JMX code, retrieving the value of
> "TotalMessagesReceived" for virtual host "test" :
>
> public static void main(String[] args) throws Exception
>     {
>         Map<String, Object> environment = new HashMap<String, Object>();
>
>      environment.put(JMXConnector.CREDENTIALS, new String[]
> {"admin","admin"});
>      JMXServiceURL url =  new
> JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi");
>      JMXConnector jmxConnector = JMXConnectorFactory.connect(url,
> environment);
>      MBeanServerConnection mbsc =  jmxConnector.getMBeanServerConnection();
>
>      ObjectName virtualHost = new
>
> ObjectName("org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=\"test\"");
>      Long totalNumberOfMessagesOnVirtualHost =
> (Long)mbsc.getAttribute(virtualHost, "TotalMessagesReceived");
>
>      System.out.println("Number of messages:" +
> totalNumberOfMessagesOnVirtualHost);
>
>     }
>
> Kind Regards,
> Alex
>
> On 26 November 2012 10:06, Matteo <sp...@gmail.com> wrote:
> > Hello,
> > in our infrastructure we are currently running Qpid java broker 0.12,
> with
> > a pretty standard configuration.
> >
> > We have the need to connect our monitoring system to Qpid and count some
> > metrics. In particular, we would like to know the total number of
> messages
> > handled by all the queues at any given time.
> >
> > What is the easiest way to implement it.
> >
> > Thanks,
> > Mat
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: Count number of messages

Posted by Oleksandr Rudyy <or...@gmail.com>.
Hi Mat,

Could you please clarify what do you mean under "messages handled by
all the queues at any given time"?

Is it the total number of messages received by the queues, or the
total number of messages hold by the queues or messages
receive/delivery rates?

If any of the above, the  easiest way to get such information is to
use broker JMX API.
For example, you can get the value of total number of messages
received on virtual host by looking into attribute
"TotalMessagesReceived" on virtual host MBean.

Here is the sample JMX code, retrieving the value of
"TotalMessagesReceived" for virtual host "test" :

public static void main(String[] args) throws Exception
    {
        Map<String, Object> environment = new HashMap<String, Object>();

     environment.put(JMXConnector.CREDENTIALS, new String[] {"admin","admin"});
     JMXServiceURL url =  new
JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi");
     JMXConnector jmxConnector = JMXConnectorFactory.connect(url, environment);
     MBeanServerConnection mbsc =  jmxConnector.getMBeanServerConnection();

     ObjectName virtualHost = new
ObjectName("org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=\"test\"");
     Long totalNumberOfMessagesOnVirtualHost =
(Long)mbsc.getAttribute(virtualHost, "TotalMessagesReceived");

     System.out.println("Number of messages:" +
totalNumberOfMessagesOnVirtualHost);

    }

Kind Regards,
Alex

On 26 November 2012 10:06, Matteo <sp...@gmail.com> wrote:
> Hello,
> in our infrastructure we are currently running Qpid java broker 0.12, with
> a pretty standard configuration.
>
> We have the need to connect our monitoring system to Qpid and count some
> metrics. In particular, we would like to know the total number of messages
> handled by all the queues at any given time.
>
> What is the easiest way to implement it.
>
> Thanks,
> Mat

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org