You can't use an operation like a metric, no. Operation results are not
graphed over a historical time range like metrics.
The JMX plugin essentially assumes that MBean "attributes" are RHQ
metrics and MBean "operations" are RHQ operations. Your "First Count"
MBean object must have an MBean "operation" called
"getFirstCount(boolean p1)". In JMX terms, that's not an attribute
(which is accessible using normal getters/setters). That's a JMX operation.
What you can do is:
1) give your resource a <plugin-configuration> that has a simple
property "first count configuration setting" (or whatever you want to
call it) - define it like you tried here (e.g. type="boolean"
default="false" and whatever else you want).
2) Take out the parameter XML from your metric. Just define the metric
like everything else
3) Your plugin can have a Java class in it that extends
MBeanResourceComponent and whose getValues() method will first check to
see which metric it is to collect - if its not "First Count" then just
use JMX normally to get the MBean attribute - if its "First Count", then
your subclass will know "ah, this isn't a real JMX attribute, its really
an operation that I want to "pretend" is a attribute and return its
value as a metric data point - so I'll call the MBean operation, passing
in the plugin configuration's parameter value, and return it like its an
attribute/metric." The user can change that parameter's value by just
going to the Inventory>Connection subtab of your resource and change it
there.
That's the power of the plugin system and plugin API - what you expose
as metrics can be anything you want - even if, under the covers in your
managed resource, it really isn't a "metric" (e.g. it isn't a JMX
attribute). You just have to write some code to do this customization.
On 08/26/2010 12:18 PM, Cesar William wrote:
But is there a way to do it (use the operation result like a metric
showing a graph)?
On Thu, Aug 26, 2010 at 1:04 PM, John Mazzitelli <mazz(a)redhat.com
<mailto:mazz@redhat.com>> wrote:
Metrics don't have "parameters". We have an XML Schema .xsd that is
available that contains the full schema with comments for documentation
that show you valid descriptor info:
http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=tree;f=modules/core/clie...
That shows you the rhq-plugin.xsd AND the configuration.xsd (which is
reused in other places, rhq-plugin.xsd among them).
On 08/26/2010 11:05 AM, Cesar William wrote:
> Hi,
> I have this service:
>
> <service name="Usage"
discovery="MBeanResourceDiscoveryComponent"
> class="MBeanResourceComponent"
> description="Usage"
> createDeletePolicy="neither"
singleton="true">
> <plugin-configuration>
> <c:simple-property name="objectName" readOnly="true"
> default="javax.slee.usage:type=Usage"/>
> <c:simple-property name="nameTemplate"
default="SleeUsage"/>
> </plugin-configuration>
> <operation name="getFirstCount"
> displayName="getFirstCount"
> description="Operation exposed for management">
> <parameters>
> <c:simple-property name="p1" type="boolean"
required="true"
> default="false"/>
> </parameters>
> <results>
> <c:simple-property name="operationResult"
type="long"/>
> </results>
> </operation>
> <metric property="FirstCount"
> displayName="First Count"
> defaultOn="true"
> displayType="summary"
> defaultInterval="30000"
> description="First Count">
> <parameters>
> <c:simple-property name="p1" type="boolean"
default="false"/>
> </parameters>
> </metric>
> </service>
>
> The operation works fine. But in the metric I can't pass a parameter
> like I done. How can I show the FirstCount in metric?
>
> --
> Att,
> Cesar William Alvarenga
>
>
>
> _______________________________________________
> rhq-users mailing list
> rhq-users(a)lists.fedorahosted.org
<mailto:rhq-users@lists.fedorahosted.org>
>
https://fedorahosted.org/mailman/listinfo/rhq-users
_______________________________________________
rhq-users mailing list
rhq-users(a)lists.fedorahosted.org
<mailto:rhq-users@lists.fedorahosted.org>
https://fedorahosted.org/mailman/listinfo/rhq-users
--
Att,
Cesar William Alvarenga