<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=DE link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Hello,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>at first please excuse my bad english.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>I have create an perl script to receive four values.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>Now I want to create four single rrd files, but I don’t
now how.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>When I start collectd with the option –T I get
this message<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>LOG: 4 - perl: Collectd::plugin_dispatch_values with
two arguments is deprecated - pass the type through values->{type}.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>At this time I get only one rrd-file with the four
values.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>What is the right way to get four single rrd-files?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>Can someone help me?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>Thanks,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>Frank<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>This is my config in collectd.conf:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><Plugin perl><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'> IncludeDir
"/home/frank"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'> BaseName
"Collectd::Plugins"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'> LoadPlugin
"Energymeter"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'></Plugin><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'>And this is my perl.script:<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>#!/usr/bin/perl -w<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>use IO::Socket;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>use strict;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>use warnings;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>package
Collectd::Plugins::Energymeter;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>use Collectd qw( :all );<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>my $dataset =<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> [<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> {<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
name => 'energy1_ds',<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
type => Collectd::DS_TYPE_GAUGE,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
min => 0,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
max => 65536.0,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> },<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> {<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
name => 'energy2_ds',<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
type => Collectd::DS_TYPE_GAUGE,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
min => 0,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
max => 65536.0,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> },<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> {<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
name => 'energy3_ds',<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
type => Collectd::DS_TYPE_GAUGE,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
min => 0,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
max => 65536.0,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> },<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> {<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
name => 'energy4_ds',<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
type => Collectd::DS_TYPE_GAUGE,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
min => 0,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
max => 65536.0,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> }<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> ];<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'># This code is executed
after loading the plugin to register it with collectd.<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>Collectd::plugin_register
(Collectd::TYPE_LOG, 'Energymeter', 'my_log' );<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>Collectd::plugin_register
(Collectd::TYPE_DATASET, 'Energymeter', $dataset);<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>Collectd::plugin_register
(Collectd::TYPE_INIT, 'Energymeter', 'my_init' );<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>Collectd::plugin_register
(Collectd::TYPE_READ, 'Energymeter', 'my_read' );<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>Collectd::plugin_register
(Collectd::TYPE_WRITE, 'Energymeter', 'my_write' );<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>Collectd::plugin_register
(Collectd::TYPE_SHUTDOWN, 'Energymeter', 'my_shutdown' );<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'># This function is called
once upon startup to initialize the plugin.<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>sub my_init<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>{<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
# open sockets, initialize data structures, ...<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
# A false return value indicates an error and causes the plugin to be<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
# disabled.<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
return 1;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>} # my_init ()<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> # This function is
called in regular intervals to collectd the data.<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>sub my_read<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>{<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my $vl
= {};<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my
$socket = '';<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my
$ip_address = "192.168.210.10";<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my
$power1 = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my
$power2 = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my
$power3 = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my
$power4 = 0;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
$socket = new IO::Socket::INET (<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
PeerAddr => $ip_address,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
PeerPort => 3673,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
Type => 1,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
Proto => getprotobyname('tcp'),<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> );<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> die
"Energymeter: Unable to open connection: $!\n"<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
unless defined $socket;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
$socket->autoflush(1);<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> print
$socket "get_value";<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> #while
(<$socket>)();<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my
$data = <$socket>;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my
@tokens = split(/ /,$data);<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> my
@local_temp = split(/:/,$tokens[0]);<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
$power1 = $local_temp[1];<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
@local_temp = split(/:/,$tokens[1]);<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
$power2 = $local_temp[1];<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
@local_temp = split(/:/,$tokens[2]);<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> $power3
= $local_temp[1];<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
@local_temp = split(/:/,$tokens[3]);<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
chop($local_temp[1]);<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
$power4 = $local_temp[1];<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
$vl->{'values'} = [ $power1, $power2, $power3, $power4 ];<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
$vl->{'plugin'} = 'Energymeter';<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
Collectd::plugin_dispatch_values ( 'Energymeter', $vl );<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> close
$socket;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'> return
1;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>}<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'># This function is called
after values have been dispatched to collectd.<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>sub my_write<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>{<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
my $type = shift;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
my $ds = shift;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
my $vl = shift;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
if (scalar (@$ds) != scalar (@{$vl->{'values'}})) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
Collectd::plugin_log (Collectd::LOG_WARNING,<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
"DS number does not match values length");<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
return;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
}<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
for (my $i = 0; $i < scalar (@$ds); ++$i) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
# do the magic to output the data<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
print "$vl->{'host'}: $vl->{'plugin'}: ";<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
if (defined $vl->{'plugin_instance'}) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
print "$vl->{'plugin_instance'}: ";<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
}<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
print "$type: ";<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
if (defined $vl->{'type_instance'}) {<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
print "$vl->{'type_instance'}: ";<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
}<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
print "$vl->{'values'}->[$i]\n";<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
}<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
return 1;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>} # my_write()<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'># This function is called
before shutting down collectd.<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>sub my_shutdown<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>{<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
# close sockets, ...<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
return 1;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>} # my_shutdown ()<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'># This function is called
when plugin_log () has been used.<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>sub my_log<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>{<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
my $level = shift;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
my $msg = shift;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
print "LOG: $level - $msg\n";<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>
return 1;<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>} # my_log ()<o:p></o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Arial><span
lang=EN-GB style='font-size:10.0pt;font-family:Arial'>return 1;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=EN-GB style='font-size:
10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>
</div>
</body>
</html>