VMware Cloud Community
BC_hyperic
Enthusiast
Enthusiast

Auto-discovery for a simple script plugin

Hi Hyperic Gurus,

I have created a simple script plugin, which works fine, except it is not auto-discovered. We are using Hyperic 3.1. What do I add for auto-discovery? If I was using an exe file instead of a .bat file how would I make the plugin auto-discovered?

The plugin is named rapid-dongle-plugin.xml, looks like
<?xml version="1.0"?>
<!--
A2iA dongle metrics
-->
<plugin>

<service name="A2iA dongle">

<config>
<option name="script"
description="Query A2iA dongle for current stats"

default="pdk/scripts/DongleMetrics.bat"/>

</config>

<property name="HAS_BUILTIN_SERVICES" value="true"/>
<plugin type="autoinventory"/>


<filter name="template"
value="exec:file=%script%,args="/>

<metric name="Availability"
template="${template}:Availability"
indicator="true"/>

<metric name="Status"
template="${template}:Status"
indicator="true"/>

<metric name="Clicks Used"
category="PERFORMANCE"
template="${template}:ClicksUsed"
indicator="true"/>

<metric name="Clicks Left"
category="PERFORMANCE"
template="${template}:ClicksLeft"
indicator="true"/>

<metric name="Days Used"
category="PERFORMANCE"
template="${template}:DaysUsed"
indicator="true"/>

<metric name="Days Left"
category="PERFORMANCE"
template="${template}:DaysLeft"
indicator="true"/>

</service>

</plugin>




The script, is named DongleMetrics.bat, looks like
echo off
echo Availability=100
echo Status=0
echo ClicksUsed=123
echo ClicksLeft=9999
echo DaysUsed=12
echo DaysLeft=9876


Thanks,
Bob
0 Kudos
3 Replies
excowboy
Virtuoso
Virtuoso

Hi Bob,

is there a custom application running on the boxes where you use the dongles ?
Then add something like this:

<server name=customapp>

<config>
<option name="process.query"
description="Process Query"
default="State.Name.ct=customapp"/>
</config>

<plugin type="autoinventory"
class="org.hyperic.hq.product.DaemonDetector"/>


<metric name="Availability"
alias="Availability"
template="sigar:Type=ProcState,Arg=%process.query%:State"
category="AVAILABILITY"
indicator="true"
units="percentage"
collectionType="dynamic"/>

<!-- your code for services etc. -->
</server>

hth,
Mirko
0 Kudos
BC_hyperic
Enthusiast
Enthusiast

Thanks for the help Mirko.

I added the code you suggested.

After adding the code you suggested, I saw the following lines in the agent log.

2009-01-12 09:12:47,906 DEBUG [AutoScan] Running AutoServerDetector for: A2iA_Service
2009-01-12 09:12:47,906 DEBUG [DaemonDetector] No PROC_QUERY defined for: A2iA_Service

So, I added the following line to the plugin
<property name="PROC_QUERY" value="State.Name.eq=A2iA_Service"/>

Now when I browse resources, I see A2iA_Service listed in the drop down list. When I select A2iA_Service I see one item. The availability is gray. When I click on the A2iA server I do NOT see any services listed..

If I go to browse resources, services, I do NOT see “A2iA dongle” service.

The A2iA_Service program is running.

I have stopped and started both the HQ server and agent. I have waited more than 15 minutes for HQ to discover the server.

I can manually add the dongle service to A2iA. The metrics look good. I was hoping the dongle metrics would be auto discovered.


The plugin now looks like

<?xml version="1.0"?>

<!--
A2iA dongle metrics
-->
<plugin>

<server name="A2iA_Service">

<config>
<option name="process.query"
description="Process Query"
default="State.Name.ct=A2iA_Service"/>
</config>

<plugin type="autoinventory"
class="org.hyperic.hq.product.DaemonDetector"/>

<property name="PROC_QUERY" value="State.Name.eq=A2iA_Service"/>

<metric name="Availability"
alias="Availability"
template="sigar:Type=ProcState,Arg=%process.query%:State"
category="AVAILABILITY"
indicator="true"
units="percentage"
collectionType="dynamic"/>


<service name="A2iA dongle">

<config>
<option name="script"
description="Query A2iA dongle for current stats"
default="C:\Program Files\agent-3.1.0\pdk\scripts\DongleMetrics.bat"/>

</config>

<property name="HAS_BUILTIN_SERVICES" value="true"/>
<plugin type="autoinventory"/>


<filter name="template"
value="exec:file=%script%,args="/>

<metric name="Availability"
template="${template}:Availability"
indicator="true"/>

<metric name="Status"
template="${template}:Status"
indicator="true"/>

<metric name="Clicks Used"
category="PERFORMANCE"
template="${template}:ClicksUsed"
indicator="true"/>

<metric name="Clicks Left"
category="PERFORMANCE"
template="${template}:ClicksLeft"
indicator="true"/>

<metric name="Days Used"
category="PERFORMANCE"
template="${template}:DaysUsed"
indicator="true"/>

<metric name="Days Left"
category="PERFORMANCE"
template="${template}:DaysLeft"
indicator="true"/>

</service>

</server>

</plugin>
0 Kudos
BC_hyperic
Enthusiast
Enthusiast

Adding to my previous message

The agent log has
009-01-12 09:48:34,015 DEBUG [AutoScan] Running AutoServerDetector for: A2iA_Service
2009-01-12 09:48:34,015 DEBUG [DaemonDetector] Using PROC_QUERY=State.Name.eq=A2iA_Service for A2iA_Service
2009-01-12 09:48:34,015 DEBUG [DaemonDetector] 'State.Name.eq=A2iA_Service' matched 1 processes
2009-01-12 09:48:34,015 ERROR [DaemonDetector] 'A2iA_Service Win32' measurement plugin not found
org.hyperic.hq.product.PluginNotFoundException: measurement plugin name=A2iA_Service Win32 not found
at org.hyperic.hq.product.PluginManager.getPlugin(PluginManager.java:285)
at org.hyperic.hq.product.ServerDetector.mergeConfigDefaults(ServerDetector.java:861)
at org.hyperic.hq.product.ServerDetector.setMeasurementConfig(ServerDetector.java:894)
at org.hyperic.hq.product.DaemonDetector.newServerResource(DaemonDetector.java:155)
at org.hyperic.hq.product.DaemonDetector.newServerResource(DaemonDetector.java:146)



The server log
2009-01-12 09:49:08,703 INFO [org.hyperic.hq.appdef.server.session.AIQRV_approve]
Created server (null): {sortName=null runtimeAutodiscovery=false wasAutodiscovered=false
autodiscoveryZombie=false configResponseId=null modifiedBy=hqadmin owner=hqadmin
location=null name=rapidtest1 A2iA_Service
autoinventoryIdentifier=C:\Program Files\A2iA\A2iA CheckReader V3.6 R2\Server\A2iA_Service.exe
installPath=C:\Program Files\A2iA\A2iA CheckReader V3.6 R2\Server\A2iA_Service.exe
description=null servicesAutomanaged=false id=null mTime=null cTime=null}
0 Kudos