I wrote a plugin for Buildbot (http://buildbot.net/trac) monitoring, but I am unable to get it to work like I'd want/expect.
Here's what I would like: basic process information (mem, cpu, ...), basic HTTP info (response time & code), report number of successful and failed builds. I thought I'd put the process info in a server tag, and treat the HTTP part as service. When I test the plugin from the command line it reports the server and one service were autodiscovered, but I don't get any metrics on the command line, and only the metrics for the server part in the UI. And of the server metrics, only 2 are included by default in the indicator view, even though I would have expected 3.
I am running 4.0.0 RC1. I put the buildbot-plugin.xml file into bundles/agent-4.0.0-889/pdk/plugins/buildbot-plugin.xml for the agent, and hq-engine/server/default/deploy/hq.ear/hq-plugins/buildbot-plugin.xml for the server. I restart the agent after each update of the XML file.
buildbot-plugin.xml:
<!DOCTYPE plugin [
<!ENTITY process-metrics SYSTEM "/pdk/plugins/process-metrics.xml">
]>
<plugin>
<script name="hq-buildbot-stats">
<![CDATA[
#!/usr/bin/env python
import urllib2
html = urllib2.urlopen('http://glama:8010/one_box_per_builder').read()
print 'SuccessfulBuilds=%d' % html.count('successful')
print 'FailedBuilds=%d' % html.count('failed')
]]>
</script>
<server name="Buildbot">
<property name="DEFAULT_LOG_FILE"
value="/path/to/buildmaster/testdir/twistd.log"/>
<!-- DaemonDetector requires PROC_QUERY according to msmq-plugin.xml -->
<property name="PROC_QUERY"
value="Pid.PidFile.eq=/path/to/buildmaster/testdir/twistd.pid"/>
<config>
<option name="process.query"
description="Process Query"
default="${PROC_QUERY}"/>
</config>
<plugin type="autoinventory"
class="org.hyperic.hq.product.DaemonDetector"/>
<plugin type="measurement"
class="org.hyperic.hq.product.MeasurementPlugin"/>
<plugin type="log_track"
class="org.hyperic.hq.product.LogFileTailPlugin"/>
<metric name="Availability"
template="sigar:Type=ProcState,Arg=%process.query%:State"
indicator="true"/>
<metric name="Process Cpu Usage"
template="sigar:Type=ProcCpu,Arg=%process.query%:Percent"
indicator="true"
units="percentage"/>
<metric name="Process Resident Memory Size"
template="sigar:Type=ProcMem,Arg=%process.query%:Resident"
indicator="true"
units="B"/>
<metric name="Process Threads"
template="sigar:Type=ProcState,Arg=%process.query%:Threads"
indicator="true"/>
<property name="HAS_BUILTIN_SERVICES" value="true"/>
<service name="HTTP">
<plugin type="autoinventory"/>
<metric name="Availability"
template="${http.template},port=8010:Availability"
category="AVAILABILITY"
units="percentage"
defaultOn="true"
indicator="true"/>
<metric name="HTTP Response Time"
template="${http.template},port=8010:ResponseTime"
category="THROUGHPUT"
units="ms"
defaultOn="true"
indicator="true"/>
<metric name="HTTP Response Code"
template="${http.template},port=8010:ResponseCode"
category="UTILIZATION"
defaultOn="true"
indicator="true"/>
<filter name="template"
value="exec:timeout=10,file=pdk/work/scripts/buildbot/hq-buildbot-stats,exec=%exec%:${alias}"/>
<metric name="Successful Builds"
indicator="true"/>
<metric name="Failed Builds"
indicator="true"/>
</service>
</server>
</plugin>