schedule2012.rmll.infoschedule2012.rmll.info/img/pdf/rmll-2012-collectd.pdf · performance analysis...

53
Performance Analysis and Capacity Planing collectd – the system statistics collection daemon Sebastian ‘tokkee’ Harl <[email protected]> teamix GmbH / collectd core team Libre Software Meeting 2012 July 10, 2012

Upload: others

Post on 22-Apr-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

Performance Analysis and Capacity Planingcollectd – the system statistics collection daemon

Sebastian ‘tokkee’ Harl<[email protected]>

teamix GmbH / collectd core team

Libre Software Meeting 2012July 10, 2012

Page 2: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

teamix GmbH

Solid IT-InfrastructureLocation: Nuremberg, Munich, Frankfurt

Open-Source Monitoring NetworkN-IX NetApp JuniperRiverbed VMWare Trainings

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 2

Page 3: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd OverviewOverviewMain Features

Feature Overview

Extending collectd

Extras

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 3

Page 4: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd overview

• collectd collects performance data of systems• some (simple) examples:

CPU utilizationmemory utilizationnetwork traffic

• collectd collects and stores the performance data• stored data is usually used to generate graphs• → performance analysis, capacity planing• not to be confused with monitoring!• Homepage: http://collectd.org/

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 4

Page 5: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

Main features

• daemon• free software (mostly GPL)• portable (Linux, *BSD, Solaris, . . . )• scalable (OpenWrt, . . . , Cluster / Cloud)• sophisticated network support• efficient (default resolution: 10 seconds)• flexible architecture• modular (more than 100 plugins in Version 5.1)

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 5

Page 6: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

Main features

• daemon• free software (mostly GPL)• portable (Linux, *BSD, Solaris, . . . )• scalable (OpenWrt, . . . , Cluster / Cloud)• sophisticated network support• efficient (default resolution: 10 seconds)• flexible architecture• modular (more than 100 plugins in Version 5.1)

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 5

Page 7: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

10 seconds resolution

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 6

Page 8: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

Main features

• daemon• free software (mostly GPL)• portable (Linux, *BSD, Solaris, . . . )• scalable (OpenWrt, . . . , Cluster / Cloud)• sophisticated network support• efficient (default resolution: 10 seconds)• flexible architecture• modular (more than 100 plugins in version 5.1)

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 7

Page 9: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

available plugins (version 5.1)

amqp apache apcups apple sensors ascentbattery bind conntrack contextswitch cpucpufreq csv curl curl json curl xmldbi df disk dns emailentropy ethstat exec filecount fscacheGenericJMX.java gmond hddtemp interface ipmiiptables ipvs irq java libvirtload logfile lpar madwifi match empty countermatch hashed match regex match timediff match value mbmonmd memcachec memcached memory modbusMonitorus.pm multimeter mysql netapp netlinknetwork nfs nginx notify desktop notify emailntpd numa nut olsrd onewireopenvpn OpenVZ.pm oracle perl pinbaping postgresql powerdns processes protocolspython redis routeros rrdcached rrdtoolsensors serial snmp swap syslogtable tail tape target notification target replacetarget scale target set target v5upgrade tcpconns teamspeak2ted thermal threshold tokyotyrant unixsockuptime users uuid varnish vmemvserver wireless write graphite write http write mongodbwrite redis xmms zfs arc

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 8

Page 10: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd setup

• daemon collects data locally ⇒ runs on every client system(exceptions: SNMP, databases, etc.)

• one or more central servers• clients push their data to the central servers• first steps: install; select plugins; start daemon;

enjoy ;-)

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 9

Page 11: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

data display: Collection 4 (C4)

• provide collected data through JSON• different frontends possible• efficiently handles large amounts of data• flexible configuration of graphs

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 10

Page 12: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

data display: Graphite

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 11

Page 13: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd Overview

Feature OverviewCPU, memory, network I/ONetworking SupportRRDtool SupportGeneric Plugins (Overview)

Extending collectd

Extras

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 12

Page 14: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

plugin overview

• specialized read pluginsCPU, memory, network interfaces, . . .

• IO pluginsnetwork pluginRRDtool, RRDCacheDGraphiteMongoDB, RedisAMQP

• generic pluginsSNMPtailPostgreSQL

• filter-chains

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 13

Page 15: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

CPU, memory, network I/O

configuration synopsis

LoadPlugin "cpu"LoadPlugin "memory"LoadPlugin "interface"

<Plugin interface>Interface loInterface sit0IgnoreSelected true

</Plugin>

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 14

Page 16: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

CPU, memory, network I/O

configuration synopsis

LoadPlugin "cpu"LoadPlugin "memory"LoadPlugin "interface"

<Plugin interface>Interface loInterface sit0IgnoreSelected true

</Plugin>

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 14

Page 17: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

CPU, memory, network I/O

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 15

Page 18: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

CPU, memory, network I/O

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 16

Page 19: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

CPU, memory, network I/O

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 17

Page 20: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

Networking Support

modes of operation

• send data (“client”)• receive data (“server”)• forward data (“proxy”)• Unicast (“point-to-point”)• Multicast (“point-to-group”)• IPv4 and IPv6

rule them allModes may be mixed arbitrarily.

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 18

Page 21: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

network plugin: server / client

synopsis: client

LoadPlugin "network"

<Plugin "network">Server "collectd0.example.com"Server "collectd1.example.com"Server "ff18::efc0:4a42"

</Plugin>

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 19

Page 22: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

network plugin: server / client

synopsis: server

LoadPlugin "network"

<Plugin "network">Listen "collectd0.example.com"Listen "ff18::efc0:4a42"

</Plugin>

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 20

Page 23: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

network plugin: proxy

synopsis: proxy

LoadPlugin "network"

<Plugin "network">Listen "collectgw.extern.example.com"Server "collectd1.intern.example.com"Forward true

</Plugin>

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 21

Page 24: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

RRDtool plugin

• writes data to RRD files efficiently → caching• functionality now also available in RRDtool as stand-alone RRD

Caching Daemon (RRDCacheD)

synopsis

LoadPlugin "rrdtool"

<Plugin "rrdtool">DataDir "/var/lib/collectd/rrd"

</Plugin>

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 22

Page 25: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

RRDtool plugin (caching)

configuration synopsis

<Plugin "rrdtool">DataDir "/var/lib/collectd/rrd"

CacheTimeout 3600 # 1 hourCacheFlush 86400 # 1 day

WritesPerSecond 30</Plugin>

• FLUSH command allows for graphing of current values

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 23

Page 26: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

generic plugins (overview)

• idea: generic approaches rather than specialized solutions• → user configuration determines behavior• ⇒ new equipment does not require a new version of collectd• examples: SNMP, tail, curl, DBI, PostgreSQL

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 24

Page 27: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

SNMP plugin: UPS load

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 25

Page 28: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

tail plugin: SSH brute-force attack

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 26

Page 29: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd Overview

Feature Overview

Extending collectdUNIXSOCK interfaceCustom Extensions

Extras

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 27

Page 30: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

custom extensions (overview)

• collectd API: C, Perl, Python, Java• external programs may use unixsock or exec plugins

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 28

Page 31: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

interacting with collectd

UNIXSOCK plugin

• opens a UNIX socket• text and line based protocol

(e. g. PUTVAL, FLUSH, LISTVAL, GETVAL)• query and submit values• collectd-nagios• collectdctl (since version 5.0)• cussh.pl: “collectd UNIX socket shell”

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 29

Page 32: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

UNIXSOCK plugin: example

-> | GETVAL "FQDN/load/load"<- | 3 Values found<- | shortterm=4.000000e-02<- | midterm=6.000000e-02<- | longterm=7.000000e-02

-> | PUTVAL FQDN/users/users 1341851406:42<- | 0 Success: 1 value has been dispatched.

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 30

Page 33: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

Perl plugin

overview

• integrates a Perl interpreter(similar to Apache’s mod perl)

• compiles Perl code only once• exports internal API

(→ full flexibility available)

also available

• Java and Python

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 31

Page 34: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

exec plugin

overview

• executes arbitrary programs / scripts• parses STDOUT of the program• respawns process upon termination

(cf. init)

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 32

Page 35: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

exec plugin: example

#! /bin/bashINTVL=${COLLECTD_INTERVAL:-10}CHOST="${COLLECTD_HOSTNAME:-localhost}"IDENT="$CHOST/magic/magic_level"while sleep $INTVLdo

V=‘magic --level‘echo "PUTVAL \"$IDENT\" interval=$INTVL ‘date +%s‘:$V"

done

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 33

Page 36: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

Future

• aggregation of arbitrary values• per-plugin interval settings• Nagios support (pushing information to Nagios)• store data in RMDBSs• . . .

http://collectd.org/wiki/index.php/Roadmap

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 34

Page 37: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd

Thank you for your attention!

Questions?

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 35

Page 38: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd

Contact:Sebastian “tokkee” Harl

teamix GmbH, Nuremberg<[email protected]>

<[email protected]> — irc.freenode.net/#collectd — http://identi.ca/collectdhttp://tokkee.org/events.html

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 36

Page 39: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd Overview

Feature Overview

Extending collectd

ExtrasSNMP pluginRRDCacheD Plugincollectd InternalsPerl Plugin

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 37

Page 40: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

SNMP plugin

overview

• queries network equipment via SNMP• generic: not specialized for any particular hardware• queries multiple systems in parallel

configuration

• “Data” Block• “Host” block

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 38

Page 41: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

SNMP plugin

synopsis: data block

<Plugin "snmp"><Data "ifmib_if_octets64">

Type "if_octets"Table trueInstance "IF-MIB::ifName"Values "IF-MIB::ifHCInOctets" \

"IF-MIB::ifHCOutOctets"</Data>

</Plugin>

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 39

Page 42: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

SNMP plugin

synopsis: host block

<Plugin "snmp"><Host "switch0.intern.musterfirma.de">

Address "10.0.42.2"Version 1Community "public"Collect "ifmib_if_octets64"Interval 60

</Host></Plugin>

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 40

Page 43: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

RRDCacheD plugin

overview

• generalizes caching idea of the rrdtool plugin• standalone daemon• integrated into RRDtool (available since version 1.4)• extended feature set, e. g. journal• benefit: restart collectd without losing cache

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 41

Page 44: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

RRDCacheD pluginSu

chba

um

Upd

ate-

Que

ue

Flus

h-Q

ueue

Upd

ate-

Thr

ead

Dat

eisy

stem

graphic c© Florian “octo” Forster

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 42

Page 45: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

RRDCacheD pluginSu

chba

um

Upd

ate-

Que

ue

Flus

h-Q

ueue

Upd

ate-

Thr

ead

Dat

eisy

stem

graphic c© Florian “octo” Forster

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 42

Page 46: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

RRDCacheD pluginSu

chba

um

Upd

ate-

Que

ue

Flus

h-Q

ueue

Upd

ate-

Thr

ead

Dat

eisy

stem

graphic c© Florian “octo” Forster

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 42

Page 47: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

RRDCacheD pluginSu

chba

um

Upd

ate-

Que

ue

Flus

h-Q

ueue

Upd

ate-

Thr

ead

Dat

eisy

stem

graphic c© Florian “octo” Forster

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 42

Page 48: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd internals

core: read thread()

core: dispatch values()

p = get next plugin();sleep until due(p);

plugin1.c:read()

p->callback();...dispatch values(v);

...plugin write(v);

plugin2.c:write()

...

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 43

Page 49: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd internals

core: read thread()

core: dispatch values()

p = get next plugin();sleep until due(p);

plugin1.c:read()

p->callback();

...dispatch values(v);

...plugin write(v);

plugin2.c:write()

...

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 43

Page 50: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd internals

core: read thread()core: dispatch values()

p = get next plugin();sleep until due(p);

plugin1.c:read()

p->callback();

...dispatch values(v);

...plugin write(v);

plugin2.c:write()

...

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 43

Page 51: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd internals

core: read thread()

core: dispatch values()

p = get next plugin();sleep until due(p);

plugin1.c:read()

p->callback();

...dispatch values(v);

...plugin write(v);

plugin2.c:write()

...

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 43

Page 52: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

collectd internals

core: read thread()

core: dispatch values()

p = get next plugin();sleep until due(p);

plugin1.c:read()

p->callback();

...dispatch values(v);

...plugin write(v);

plugin2.c:write()

...

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 43

Page 53: schedule2012.rmll.infoschedule2012.rmll.info/IMG/pdf/RMLL-2012-collectd.pdf · Performance Analysis and Capacity Planing - collectd the system statistics collection daemon Author:

Perl plugin: example

package Collectd::Plugin::Magic;use Collectd qw( :all );sub magic_read{

my $vl = { plugin => ’magic’,values => [Magic->getCurrentLevel ()] };

plugin_dispatch_values (’magic_level’, $vl);}plugin_register (TYPE_READ, ’magic’, ’magic_read’);

c© 2012 Sebastian Harl, CC-BY-SA collectd – slide 44