November 29, 2009
filed under opennms
Tagged metering, opennms, power, stromverbrauch, stromzähler, yello
Network-enabled power meters are getting “common” and at least one german electricity supplier fits his customers with power meters which they can read out over the network.

The powermeter is exposing the current consumption over a website.

This little page is very lean and loads quickly. The figures are available as real html text and not as some fancy flash stuff.
OpenNMS has the http collector, which allows to grab almost arbitrary values from a web page and feed them into OpenNMS.
To make that happen you need to define a http collector, first:
<http-collection name="powercount5">
<rrd step="1">
<rra>RRA:AVERAGE:0.5:1:8928</rra>
<rra>RRA:AVERAGE:0.5:60:8784</rra>
<rra>RRA:MIN:0.5:60:8784</rra>
<rra>RRA:MAX:0.5:60:8784</rra>
</rrd>
<uris>
<uri name="powercounts5">
<url path="/index.html"
user-agent="Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412 (KHTML, like
Gecko) Safari/412"
matches="(?s).*?akt_leistung..([0-9]+).*" response-range="0-399" >
</url>
<attributes>
<attrib alias="powercount5" match-group="1" type="counter32"/>
</attributes>
</uri>
</uris>
</http-collection>
The regular expression in matches will find the number which follows “akt_leistung” (current consumption). This number will be interpreted as a counter32 (just asking myself if gauge would not be more apropriate..).
Once the collector is defined, it needs to be put into a collection:
<service name="HttpPowerCount5" interval="1000" user-defined="false" status="on" >
<parameter key="http-collection" value="powercount5" />
<parameter key="retry" value="1" />
<parameter key="timeout" value="2000" />
<parameter key="thresholding-enabled" value="true"/>
</service>
The collection needs to know as well which plugin to use for this service:
<collector service="HttpPowerCount5" class-name="org.opennms.netmgt.collectd.HttpCollector" />
Lastly, the service needs to be discovered:
<protocol-plugin protocol="HttpPowerCount5" class-name="org.opennms.netmgt.capsd.plugins.HttpPlugin" scan="on">
<property key="port" value="80" />
<property key="timeout" value="5000" />
<property key="retry" value="1" />
<property key="max-ret-code" value="405"/>
<property key="url" value="/index.html"/>
<property key="response-text" value="~.*akt_leistung.*"/>
</protocol-plugin>
The next step is to switch to a gauge value, that means however that I need to delete the graphs..before doing so I wanted to show off a bit ;-)
Update: The gauge makes it to look much better:

Power Consumption Graph
RSS /
Comments are closed.
Tweets that mention geneva::information » Analyzing Power Consumption with OpenNMS -- Topsy.com
on November 29, 2009 at 17:37
[...] This post was mentioned on Twitter by OpenNMS, indigo423. indigo423 said: RT @opennms: New planet post: Analyzing Power Consumption with OpenNMS http://bit.ly/8Dmtu0 – good for thresholding example ;) [...]
uberVU - social comments
on November 30, 2009 at 00:06
Social comments and analytics for this post…
This post was mentioned on Identica by opennms: New planet post: Analyzing Power Consumption with OpenNMS