Striim 3.9.6 documentation

Collectd Parser

After configuring a remote host to collect and transmit system information as detailed in collectd configuration, create a UDPReader and select this parser to use the data in an application.

This parser has a single property, authfilelocation. If the remote host has security enabled for collectd, specify the path (relative to the Striim program directory) and name of the authentication file, otherwise leave the property blank. See "Server setup" in https://collectd.org/wiki/index.php/Networking_introduction for more information.

The output type is CollectdEvent. Its fields are:

field name

type

data

varies depending on the ds-type setting for the pluginName value in collectd's types.db (see http://collectd.org/documentation/manpages/types.db.5.shtml for more information): for ABSOLUTE, COUNTER, and DERIVE, the type is long or long[], for GAUGE, the type is double or double[]

hostName

string

intervalHighResolution

long

message

string

pluginInstanceName

string

pluginName

string

severity

long

time

DateTime

timeHighResolution

DateTime

timeInterval

long

typeInstanceName

string

typeName

string

The fields correspond to collectd part types (see https://collectd.org/wiki/index.php/Binary_protocol#Part_types). data corresponds to the Values part type.

The following example application receives CPU metrics and computes min, max, last, and average values for each one-minute block of data:

CREATE APPLICATION collectd;
CREATE SOURCE CollectdSource USING UDPReader (
  IpAddress:'127.0.0.1',
  PortNo:'25826'
)
PARSE USING CollectdParser ()
OUTPUT TO CollectdStream;

CREATE TYPE CpuUsageType (
  hname String,
  tStamp DateTime,
  tInstanceName String,
  pInstanceName Integer,
  cUsage double      	
);
CREATE STREAM CpuUsageStream OF CpuUsageType;

CREATE CQ CpuUsage 
INSERT INTO CpuUsageStream 
SELECT hostname, 
  TimeHighResolution,
  TypeInstanceName,
  TO_INT(PluginInstanceName),
  TO_DOUBLE(data[0]) 
FROM CollectdStream
WHERE PluginName = 'cpu';
        
CREATE JUMPING WINDOW CpuUsageWindow OVER CpuUsageStream KEEP WITHIN 1 MINUTE ON tStamp;

CREATE TYPE CpuStatisticsType (
  cpuName Integer,
  cpuType String,
  min double,
  max double,
  last double,
  avg double
);
CREATE STREAM CpuStatisticsStream OF CpuStatisticsType;

CREATE CQ CpuStatisticsCQ 
INSERT INTO CpuStatisticsStream
SELECT x.pInstanceName,
  x.tInstanceName,
  MIN(x.cUsage),
  MAX(x.cUsage),
  x.cUsage,
  AVG(x.cUsage)
FROM CpuUsageWindow x
GROUP BY x.pInstanceName,x.tInstanceName;

CREATE TARGET CpuStatisticsDump
USING SysOut(name:Stat)
INPUT FROM CpuStatisticsStream;

END APPLICATION collectd;

The output would look like this:

Stat: CpuStatisticsType_1_0{
  cpuName: "6"
  cpuType: "system"
  min: 252157.0
  max: 252312.0
  last: 252312.0
  avg: 252236.5
};
Stat: CpuStatisticsType_1_0{
  cpuName: "7"
  cpuType: "user"
  min: 33387.0
  max: 33393.0
  last: 33393.0
  avg: 33390.166666666664
};