The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojo::Netdata::Chart - Represents a Netdata chart and dimensions

SYNOPSIS

my $chart = Mojo::Netdata::Chart->new;
$chart->data_to_string;
$chart->to_string;

DESCRIPTION

Mojo::Netdata::Chart is a class that represents a Netdata chart and dimensions. See https://learn.netdata.cloud/docs/agent/collectors/plugins.d#chart for more details.

ATTRIBUTES

chart_type

$str = $chart->chart_type;

Either "area", "line" or "stacked". Defaults to "line".

context

$str = $chart->context;

Defaults to "default".

dimensions

$hash_ref = $chart->dimensions;

See "dimension".

family

$str = $chart->family;

Defaults to "id".

id

$str = $chart->id;

Required to be set.

module

$str = $chart->module;

Defaults to empty string.

name

$str = $chart->name;

Defaults to empty string.

options

$str = $chart->options;

Defaults to empty string.

plugin

$str = $chart->options;

Defaults to "mojo". The default is subject to change!

priority

$int = $chart->priority;

Defaults to 10000.

title

$str = $chart->title;

Defaults to "name" or "id".

type

$str = $chart->type;

Required to be set.

units

$str = $chart->units;

Defaults to "#".

update_every

$num = $chart->update_every;

How often to update Netdata.

METHODS

data_to_string

$str = $chart->data_to_string;

Takes the values in "dimensions" and creates a string with SET, suitable to be sent to Netdata.

dimension

$dimension = $chart->dimension($id);
$chart = $chart->dimension($id => {name => 'cool'});
$chart = $chart->dimension($id => {value => 42});

Used to get or set an item in "dimensions". Possible keys are "algorithm", "divisor", "multiplier", "name" and "options".

See https://learn.netdata.cloud/docs/agent/collectors/plugins.d#dimension for more details.

to_string

$str = $chart->to_string;

Creates a string with CHART and DIMENSION, suitable to be sent to Netdata.

SEE ALSO

Mojo::Netdata.