Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_tsdb plugin: Export metadata. #1655

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions src/collectd.conf.pod
Original file line number Diff line number Diff line change
Expand Up @@ -8184,6 +8184,85 @@ more than one DS.

=back

=head3 Note about rules and metadata

The C<write_tsdb> plugin recognizes metadata :

=over 4

=item B<tsdb_prefix> B<Prefix>

If set, metric name will be prefixed with B<Prefix>.

Note : B<tsdb_prefix> also applies when you define B<tsdb_id>.

=item B<tsdb_id> B<Id>

When you define B<tsdb_id>, the metric name is not calculated but is B<Id> (with prefix if you defined B<tsdb_prefix>).

=item B<tsdb_tag_plugin> B<tag_key>

=item B<tsdb_tag_pluginInstance> B<tag_key>

=item B<tsdb_tag_type> B<tag_key>

=item B<tsdb_tag_typeInstance> B<tag_key>

=item B<tsdb_tag_dsname> B<tag_key>

If a B<tsdb_tag_*> is defined, the related item is removed from the metric name. If B<tag_key> is not empty,
a tag will be added with key B<tag_key> and value the item.

=item B<tsdb_tag_add_XX> B<tag_value>

When you define a B<tsdb_tag_add_XX>, a B<tag_key>=B<tag_value> key-value pair tag is added. The
key comes from B<tsdb_tag_add_XX> and would be B<XX> here. Note that you cannot define the same tag twice.
Examples:

MetaDataSet "tsdb_tag_add_k1" "v1"
MetaDataSet "tsdb_tag_add_k2" "v2"
MetaDataSet "tsdb_tag_add_k3" "v3"

=back

Example without B<tsdb_tag_*> :

cpu.1.cpu.user

Same example with :
tsdb_tag_pluginInstance = "cpu"
tsdb_tag_type = ""

We get :
cpu.user cpu=1

In this example, pluginInstance (named "1") is removed from the metric name and is set as a tag named "cpu".
The type (named "cpu") is removed because B<tsdb_tag_type> is defined but is empty.

You can define tags with filter rules and target_set :

<Chain "PreCache">
<Rule "opentsdb_cpu">
<Match "regex">
Plugin "^cpu$"
</Match>
<Target "set">
MetaDataSet "tsdb_tag_pluginInstance" "cpu"
MetaDataSet "tsdb_tag_type" ""
</Target>
</Rule>
<Rule "opentsdb_prefix">
<Match "regex">
Host "^"
</Match>
<Target "set">
MetaDataSet "tsdb_prefix" "sys."
</Target>
</Rule>
</Chain>

This example will replace (for example) "cpu.1.cpu.user" with "sys.cpu.user cpu=1"

=head2 Plugin C<write_mongodb>

The I<write_mongodb plugin> will send values to I<MongoDB>, a schema-less
Expand Down
Loading