JonB_hyperic
Contributor
Contributor

Trying to write a simple plugin

I am trying to write a simple xml plugin that checks for a script and has quick Control functionality i.e Run. Just like the Fileserver File service which I could use but the script, to force remote desktop access, is in the same path on each machine and it would be easier just to select it from Services.

I have been looking at the plugin documentation and just cannot figure out how to create the plugin.

This is what I have at the moment but while it shows up in Services it has no Control function but does show Availability. I suspect I am probably on the wrong path totally

<plugin>

<service name="Remote Access">

<config>
<option name="path"
description="OneClick"
default="C:\scripts\oneclick.bat"/>
</config>
<actions include="run"/>
<filter name="template" value="exec:file=%path%"/>

<metric name="Availability" template="${template}:Availability" indicator="true"/>
<plugin type="measurement" class="org.hyperic.hq.product.MeasurementPlugin" />

</service>

</plugin>

Cheers,
0 Kudos
2 Replies
dougm_hyperic
VMware Employee
VMware Employee

Hi Jon,

You're on the right path, the only missing piece is the control plugin class. You can actually use the same plugin as the FileServer File service by adding the following..

Withing the top-level <plugin> tag:
<classpath>
<include name="pdk/plugins/system-plugin.jar"/>
</classpath>

Within the <service> tag:
<plugin type="control"
class="org.hyperic.hq.plugin.system.FileControlPlugin"/>

Let us know if that does the trick!
JonB_hyperic
Contributor
Contributor

Thanks dougm, that helped sort out most of the problems. I now have a Quick control panel that allows me run the script.

<plugin>

<classpath>
<include name="pdk/plugins/system-plugin.jar"/>
</classpath>

<service name="Remote Access" description="Remote Access via OneClick">

<config>
<option name="path"
description="OneClick"
default="C:\scripts\oneclick.bat"/>
</config>

<plugin type="control"
class="org.hyperic.hq.plugin.system.FileControlPlugin"/>
<actions include="run"/>

</service>

</plugin>

There are still a few issues with the plugin, like configuration errors and getting an Availibility metric, that I still need to work my through.
0 Kudos