[collectd] Using Cacti as a frontend for collectd

Florent Monbillard f.monbillard at gmail.com
Sat Nov 1 16:03:30 CET 2008


Hi Sebastian,

On Sat, Nov 1, 2008 at 10:32, Sebastian Harl <sh at tokkee.org> wrote:
> Hi Florent,
>
> On Fri, Oct 31, 2008 at 04:28:06PM +0100, Florent Monbillard wrote:
>> On Fri, Jul 11, 2008 at 7:49 PM, Pavel Georgiev <pavel at netclime.com> wrote:
>> > Has anyone managed to use cacti just as a frontend for collectd (or
>> > use both tools in any other way)? I read in the FAQ there are
>> > reports of people doing this but I could not find any info about
>> > that.
>>
>> You have to do this manually. Create your datasources and point them to
>> collectd datasource files. More you have datasources, longer is this step...
>> When you finish "importing" datasources, you can use them in cacti like usual,
>> referencing them into graphs.
>
> How does such a data-source definition look like? Is it specific for a
> certain installation or is it some generic definition of the data found
> in the RRD files. In the latter case, would it make sense to ship your
> definitions somewhere in contrib/ in the collectd sources so others
> won't have to recreate them over and over again?

Sadly, it's the first case : it's specific of your collectd installation
(RRD directory = BaseDir setting).

To create a new datasource in cacti, you have to fill the folowing parameters:
- datasource path: the full path to the RRD file
- data Input Method: the script/source used to gather data for this data source
(select it to none as collectd does this job for you)
- step is 10 in default collectd installation
- you can safely let others datasource paramaters their default values

Next, you have to fill all the datasource items it contains:
- name of the piece of data inside of the rrd file: to get it, you can
use rrdtool info on
collectd rrd file:

rrdtool info df-boot.rrd
filename = "df-boot.rrd"
rrd_version = "0003"
step = 10
last_update = 1225547692
ds[used].type = "GAUGE"
ds[used].minimal_heartbeat = 20
ds[used].min = 0.0000000000e+00
ds[used].max = 1.1258999068e+15
ds[used].last_ds = "18265088.000000"
ds[used].value = 3.6530176000e+07
ds[used].unknown_sec = 0
ds[free].type = "GAUGE"
ds[free].minimal_heartbeat = 20
ds[free].min = 0.0000000000e+00
ds[free].max = 1.1258999068e+15
ds[free].last_ds = "77301760.000000"
ds[free].value = 1.5460352000e+08
ds[free].unknown_sec = 0

here, two datasource items: used and free. Create one datasource item for each.

- Datasource type is also important: in the example above, both are GAUGE type.
For traffic RRDs files, it's COUNTER type. rrdtool info can tell you
which to use.
- Heartbeat is 20 in default collectd installation

That could lead in a very long setup depending how many datasources
and hosts you have. Hopefully, datasource templates come into play.
You can create templates that will fill all the common parameters
(step, heartbeat, datasource items name and type, associated RRA's,
maximum value, ...), so when you create a new datasource using a
template, you only have to fill the RRD's path. That helps a bit ;)

>> To try not repeat this 42 times or more, I created datasource
>> templates to fit the
>> structure of collectd common datasources (which uses "value" or "count" most
>> of the time). That helps a bit...
>
> That template might also be a nice thing to include in collectd.
>
> What do you think?

In cacti, I can export the templates I have created if you want. That
will not cover all collectd plugins, only those I am using, but it's a
start...

> Cheers,
> Sebastian
>

Cheers,

Florent



More information about the collectd mailing list