VMware Cloud Community
bjchip_hyperic
Enthusiast
Enthusiast

PLEASE explain "template" in context of simple custom jar

OK... I've read the docs, I've looked at source, I've boned up on JMX, I've tried the Heinz* varieties of syntax to get a REALLY simple plugin (extends MeasurementPlugin, implements getValue( Metric metric ) to work when included in the test

java -jar <Agent Directory>/pdk/lib/hq-product.jar -Dplugins.include=yourPluginName -m metric

*I have at least 57 not-working examples that simply get loaded and say nothing at all.

When it doesn't error and doesn't return any debug except that it loaded the jars, it is simply frustrating. I am frustrated. It is probably blindingly simple and I will want to kick myself once it is understood but I have to echo the the complaints of others that it is not explained all that well. JMX queries and xml only plugins are all wonderful but when we want to write Java we're all stuck behind glass wall.

template is a modification of JMX ObjectName according to the doc

http://support.hyperic.com/display/DOC/Measurement+Plugin#MeasurementPlugin-template

which says it looks like:

domain:properties:attribute:connection-properties

Not everything is required... as I saw no connection-properties in ../pdk/plugins/*.jar. What IS required is not clear.

What if you don't have properties to specify?

How does the "Domain" relate to our plugin class and package?

How do you just get the value of an attribute? How do you make it work in the SIMPLEST case.

The examples are not simple examples of a jar type that works. The best one seems to be the jboss but it still leaves too much unclear.

Some idea of how the code that uses that template actually executes the stuff inside would be a VERY good thing.

respectfully
BJ
0 Kudos
14 Replies
bjchip_hyperic
Enthusiast
Enthusiast

You can't just use that java command that way now. You have to specify type.

java -jar ./pdk/lib/hq-product.jar -Dplugins.include=BasicHypericMeasurements -m metric -t BasicHypericMeasurements -Dlog=DEBUG

I may have some extra stuff in here still... but
.
.
.
DEBUG [main] [ControlPluginManager] PluginNotFound creating plugin for service 'BasicHypericMeasurements' from server 'NetworkServer'
DEBUG [main] [LogTrackPluginManager] PluginNotFound creating plugin for service 'BasicHypericMeasurements' from server 'NetworkServer'
DEBUG [main] [ConfigTrackPluginManager] PluginNotFound creating plugin for service 'BasicHypericMeasurements' from server 'NetworkServer'
Called getValue Availability
BasicHypericMeasurements Availability:
com.hyro.hypericplugins.BasicHypericMeasurements:type=BasicHypericMeasurements:Availability
=>100.0%<=
Called getValue Counter
BasicHypericMeasurements Counter:
com.hyro.hypericplugins.BasicHypericMeasurements:type=BasicHypericMeasurements:Counter
=>0.0<=
Called getValue Random
BasicHypericMeasurements Random:
com.hyro.hypericplugins.BasicHypericMeasurements:type=BasicHypericMeasurements:Random
=>0.8<=


The hq-plugins.xml goes in an etc subdirectory in your jar.

I have been tripping over this business for the better part of 2 days now. I hope it helps someone.

The type has to match. If it doesn't match it doesn't do anything at all. Just WHAT it has to match is still a little bit speculative. I forced it all to be the same.

Thanks
BJ
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

Oh yes... you may want to look at this as well.

BJ
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

Notes:

1. I still do not know how the "domain" relates to class and package identification... it works... but it still is not clear.

2. The document on-line which explains the java test is misleading as it omits the requirement for the type flag. This was available elsewhere in the forums. It should be corrected

http://support.hyperic.com/display/DOC/Test+Plugin

BJ
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

This is a little simpler and also works with the java code. It is instructive of some things that can be left out.

respectfully
BJ
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

There's a lot of questions left... the internals of the MeasurementPlugin class that can be used among other things... all the rest not yet understood. It is a starting point. Good Luck.
0 Kudos
mnana
Contributor
Contributor

Hi, thx for your explanation.
In fact is there any posibility to see that in the web interface( I mean the counter and the random? ) and how can do that.

best regards.

Mnana
0 Kudos
sylvestersteele
Contributor
Contributor

Bj,
My experience with developing custom plugins has been almost as
harrowing as yours. I agree with you that the online documentation is
inadequate. While this forum does help from time to time, its not the
most helpful forum I have used. If you go through the forums you will
find quite a few of my questions unanswered/ not satisfactorily
answered, and while I appreciate people spending their time here,
somehow it hasn't been as helpful as I'd like.

I have to say that I do not understand developing custom plugins 100%,
but I understand enough to get by. It has happened to me sometimes that
the plugin will not work from command line, but works when you actually
deploy it. I don't know why this happens.

Regards,
sylvestersteele+hyperic@gmail.com


0 Kudos
mnana
Contributor
Contributor

Hi,
I want to ask why the counter return always 0 and doesn't increment at all!!!!

Thx.

mnana
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

Well... that'd probably have something to do with the Java rather than the plugin implementation. I did not even try to deploy the test to the Server as I really have a more complex target in mind.

That one has java that already works... the puzzle is the plugin and how to implement.

Since trying to deploy that java from inside the plugin handed me a Java StackOverflow which NEVER occurs outside the plugin, but seems to be immune to the amount of memory given to the JVM stack, (recursion problem most likely) I gave it up.

respectfully
BJ
0 Kudos
bjchip_hyperic
Enthusiast
Enthusiast

Well... that'd probably have something to do with the Java rather than the plugin implementation. I did not even try to deploy the test to the Server as I really have a more complex target in mind.

That one has java that already works... the puzzle is the plugin and how to implement.

Since trying to deploy that java from inside the plugin handed me a Java StackOverflow which NEVER occurs outside the plugin, but seems to be immune to the amount of memory given to the JVM stack, (recursion problem most likely) I gave it up.

respectfully
BJ
0 Kudos
preindl_hyperic
Contributor
Contributor

I am trying to customize the basic hyperic measurement plugin given here. I have so far simply created an intellij project that creates a jar file based on the two files given above, hq-plugin.xml and basichypericmeasurement.java. I have refactored the code changing the class to MyBasicHypericMeasurement to avoid conflict with the existing jar.

I am able to successfully gather metrics from the command line:
C:\hyperic\agent-4.2.0>java -jar bundles\agent-4.2.0-1260\pdk\lib\hq-product.jar -Dplugins.include=MyBasicHypericMeasurements -t MyBasicHypericMeasurements

When I add the plugin using the hyperic web app, it complains "Configuration Properties for the server are not set.Please configure the server before configuring this service."

The jar given earlier in the forum works perfectly. I am simply trying to build the same jar so I have something to work from. Any ideas? The xml files has no references to a server, so I'm not sure what server to configure. Is there a way to see what server it thinks it needs?

Thanks!
Phil
0 Kudos
preindl_hyperic
Contributor
Contributor

In my agent.log file, I found the following line:
2009-11-30 10:33:40,865 ERROR [Thread-0] [MeasurementCommandsService] Error getting real time measurement: Plugin not found: measurement plugin name=MyBasicHypericMeasurements not found
0 Kudos
preindl_hyperic
Contributor
Contributor

There was an issue with the jdk version. I set -target 1.5 for the compile options, which has reduced the errors in the logfile, but it still complains that the server is not configured.

Thanks
0 Kudos
preindl_hyperic
Contributor
Contributor

For my purposes, the issue seems to be acceptably resolved. In the xml, I changed service to server. The plugin will now successfully deploy as a server rather than a service. It still isn't at all clear to me what the issue was, but it's "good enough."

Thanks!
0 Kudos