8000 Add write_syslog output plugin by sradco · Pull Request #3019 · collectd/collectd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add write_syslog output plugin #3019

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

Merged
merged 1 commit into from
May 7, 2019
Merged
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
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ Jiri Tyr <jiri.tyr at gmail.com>
Julien Ammous <j.ammous at gmail.com>
- Lua plugin.

Shirly Radco <sradco at redhat.com>
- write_syslog plugin.

Kevin Bowling <kbowling at llnw.com>
- write_tsdb plugin for http://opentsdb.net/

Expand Down
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
newer libmicrohttpd. Thanks to Pavel Rochnyak. #2849
* Write Prometheus plugin: set "SO_REUSEADDRESS" on listening socket.
Thanks to Pavel Rochnyak. #2570, #2673
* Write Syslog plugin: The new "write_syslog" plugin writes value
lists as syslog messages. Thanks to Shirly Radco. #3019

2017-11-17, Version 5.8.0
* collectd: The core daemon is now completely licensed under the MIT
Expand Down
6 changes: 6 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,12 @@ write_stackdriver_la_LIBADD = libformat_stackdriver.la libgce.la liboauth.la \
$(BUILD_WITH_LIBCURL_LIBS)
endif

if BUILD_PLUGIN_WRITE_SYSLOG
pkglib_LTLIBRARIES += write_syslog.la
write_syslog_la_SOURCES = src/write_syslog.c
write_syslog_la_LDFLAGS = $(PLUGIN_LDFLAGS)
endif

if BUILD_PLUGIN_WRITE_TSDB
pkglib_LTLIBRARIES += write_tsdb.la
write_tsdb_la_SOURCES = src/write_tsdb.c
Expand Down
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,10 @@ Features
Sends data to Sensu, a stream processing and monitoring system, via the
Sensu client local TCP socket.

- write_syslog
Sends data in syslog format, using TCP, where the message
contains the metric in human or JSON format.

- write_tsdb
Sends data OpenTSDB, a scalable no master, no shared state time series
database.
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6931,6 +6931,7 @@ AC_PLUGIN([write_redis], [$with_libhiredis], [Redis output plug
AC_PLUGIN([write_riemann], [$with_libriemann_client], [Riemann output plugin])
AC_PLUGIN([write_sensu], [yes], [Sensu output plugin])
AC_PLUGIN([write_stackdriver], [$plugin_write_stackdriver], [Google Stackdriver Monitoring output plugin])
AC_PLUGIN([write_syslog], [yes], [Syslog output plugin])
AC_PLUGIN([write_tsdb], [yes], [TSDB output plugin])
AC_PLUGIN([xencpu], [$plugin_xencpu], [Xen Host CPU usage])
AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
Expand Down Expand Up @@ -7356,6 +7357,7 @@ AC_MSG_RESULT([ write_redis . . . . . $enable_write_redis])
AC_MSG_RESULT([ write_riemann . . . . $enable_write_riemann])
AC_MSG_RESULT([ write_sensu . . . . . $enable_write_sensu])
AC_MSG_RESULT([ write_stackdriver . . $enable_write_stackdriver])
AC_MSG_RESULT([ write_syslog . . . . $enable_write_syslog])
AC_MSG_RESULT([ write_tsdb . . . . . $enable_write_tsdb])
AC_MSG_RESULT([ xencpu . . . . . . . $enable_xencpu])
AC_MSG_RESULT([ xmms . . . . . . . . $enable_xmms])
Expand Down
11 changes: 11 additions & 0 deletions contrib/redhat/collectd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
%define with_write_redis 0%{!?_without_write_redis:1}
%define with_write_riemann 0%{!?_without_write_riemann:1}
%define with_write_sensu 0%{!?_without_write_sensu:1}
%define with_write_syslog 0%{!?_without_write_syslog:1}
%define with_write_tsdb 0%{!?_without_write_tsdb:1}
%define with_xmms 0%{!?_without_xmms:0%{?_has_xmms}}
%define with_zfs_arc 0%{!?_without_zfs_arc:1}
Expand Down Expand Up @@ -1857,6 +1858,12 @@ Collectd utilities
%define _with_write_sensu --disable-write_sensu
%endif

%if %{with_write_syslog}
%define _with_write_syslog --enable-write_syslog
%else
%define _with_write_syslog --disable-write_syslog
%endif

%if %{with_write_tsdb}
%define _with_write_tsdb --enable-write_tsdb
%else
Expand Down Expand Up @@ -2054,6 +2061,7 @@ Collectd utilities
%{?_with_write_redis} \
%{?_with_write_riemann} \
%{?_with_write_sensu} \
%{?_with_write_syslog} \
%{?_with_write_tsdb} \
%{?_with_xencpu} \
%{?_with_xmms} \
Expand Down Expand Up @@ -2388,6 +2396,9 @@ fi
%if %{with_write_log}
%{_libdir}/%{name}/write_log.so
%endif
%if %{with_write_syslog}
%{_libdir}/%{name}/write_syslog.so
%endif
%if %{with_write_sensu}
%{_libdir}/%{name}/write_sensu.so
%endif
Expand Down
13 changes: 13 additions & 0 deletions src/collectd.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
#@BUILD_PLUGIN_WRITE_RIEMANN_TRUE@LoadPlugin write_riemann
#@BUILD_PLUGIN_WRITE_SENSU_TRUE@LoadPlugin write_sensu
#@BUILD_PLUGIN_WRITE_STACKDRIVER_TRUE@LoadPlugin write_stackdriver
#@BUILD_PLUGIN_WRITE_SYSLOG_TRUE@LoadPlugin write_syslog
#@BUILD_PLUGIN_WRITE_TSDB_TRUE@LoadPlugin write_tsdb
#@BUILD_PLUGIN_XENCPU_TRUE@LoadPlugin xencpu
#@BUILD_PLUGIN_XMMS_TRUE@LoadPlugin xmms
Expand Down Expand Up @@ -1808,6 +1809,18 @@
# Url "https://monitoring.googleapis.com/v3"
#</Plugin>

#<Plugin write_syslog>
# <Node>
# Host "localhost"
# Port "44514"
# Prefix "collectd"
# MessageFormat "human"
# HostTags ""
# StoreRates false
# AlwaysAppendDS false
# </Node>
#</Plugin>

#<Plugin write_tsdb>
# <Node>
# Host "localhost"
Expand Down
135 changes: 135 additions & 0 deletions src/collectd.conf.pod
10000
Original file line number Diff line number Diff line change
Expand Up @@ -10596,6 +10596,141 @@ C<https://monitoring.googleapis.com/v3>.

=back

=head2 Plugin C<write_syslog>

The C<write_syslog> plugin writes data in I<syslog> format log messages.
It implements the basic syslog protocol, RFC 5424, extends it with
content-based filtering, rich filtering capabilities,
flexible configuration options and adds features such as using TCP for transport.
The plugin can connect to a I<Syslog> daemon, like syslog-ng and rsyslog, that will
ingest metrics, transform and ship them to the specified output.
The plugin uses I<TCP> over the "line based" protocol with a default port 44514.
The data will be sent in blocks of at most 1428 bytes to minimize the number of
network packets.

Synopsis:

<Plugin write_syslog>
ResolveInterval 60
ResolveJitter 60
<Node "example">
Host "syslog-1.my.domain"
Port "44514"
Prefix "collectd"
MessageFormat "human"
HostTags ""
</Node>
</Plugin>

The configuration consists of one or more E<lt>B<Node>E<nbsp>I<Name>E<gt>
blocks and global directives.

Global directives are:

=over 4

=item B<ResolveInterval> I<seconds>

=item B<ResolveJitter> I<seconds>

When I<collectd> connects to a syslog node, it will request the hostname from
DNS. This can become a problem if the syslog node is unavailable or badly
configured because collectd will request DNS in order to reconnect for every
metric, which can flood your DNS. So you can cache the last value for
I<ResolveInterval> seconds.
Defaults to the I<Interval> of the I<write_syslog plugin>, e.g. 10E<nbsp>seconds.

You can also define a jitter, a random interval to wait in addition to
I<ResolveInterval>. This prevents all your collectd servers to resolve the
hostname at the same time when the connection fails.
Defaults to the I<Interval> of the I<write_syslog plugin>, e.g. 10E<nbsp>seconds.

B<Note:> If the DNS resolution has already been successful when the socket
closes, the plugin will try to reconnect immediately with the cached
information. DNS is queried only when the socket is closed for a longer than
I<ResolveInterval> + I<ResolveJitter> seconds.

=back

Inside the B<Node> blocks, the following options are recognized:

=over 4

=item B<Host> I<Address>

Hostname or address to connect to. Defaults to C<localhost>.

=item B<Port> I<Service>

Service name or port number to connect to. Defaults to C<44514>.


=item B<HostTags> I<String>

When set, I<HostTags> is added to the end of the metric.
It is intended to be used for adding additional metadata to tag the metric with.
Dots and whitespace are I<not> escaped in this string.

Examples:

When MessageFormat is set to "human".

["prefix1" "example1"="example1_v"]["prefix2" "example2"="example2_v"]"

When MessageFormat is set to "JSON", text should be in JSON format.
Escaping the quotation marks is required.

HostTags "\"prefix1\": {\"example1\":\"example1_v\",\"example2\":\"example2_v\"}"

=item B<MessageFormat> I<String>

I<MessageFormat> selects the format in which messages are sent to the
syslog deamon, human or JSON. Defaults to human.

Syslog message format:

<priority>VERSION ISOTIMESTAMP HOSTNAME APPLICATION PID MESSAGEID STRUCTURED-DATA MSG

The difference between the message formats are in the STRUCTURED-DATA and MSG parts.

Human format:

<166>1 ISOTIMESTAMP HOSTNAME collectd PID MESSAGEID
["collectd" "value": "v1" "plugin"="plugin_v" "plugin_instance"="plugin_instance_v"
"type_instance"="type_instance_v" "type"="type_v" "ds_name"="ds_name_v" "interval"="interval_v" ]
"host_tag_example"="host_tag_example_v" plugin_v.type_v.ds_name_v="v1"

JSON format:

<166>1 ISOTIMESTAMP HOSTNAME collectd PID MESSAGEID STRUCTURED-DATA
{
"collectd": {
"time": time_as_epoch, "interval": interval_v, "plugin": "plugin_v",
"plugin_instance": "plugin_instance_v", "type":"type_v",
"type_instance": "type_instance_v", "plugin_v": {"type_v": v1}
} , "host":"host_v", "host_tag_example": "host_tag_example_v"
}

=item B<StoreRates> B<false>|B<true>

If set to B<true>, convert counter values to rates. If set to B<false>
(the default) counter values are stored as is, as an increasing
integer number.

=item B<AlwaysAppendDS> B<false>|B<true>

If set to B<true>, append the name of the I<Data Source> (DS) to the "metric"
identifier. If set to B<false> (the default), this is only done when there is
more than one DS.

=item B<Prefix> I<String>

When set, I<Prefix> is added to all metrics names as a prefix. It is intended in
case you want to be able to define the source of the specific metric. Dots and
whitespace are I<not> escaped in this string.

=back

=head2 Plugin C<xencpu>

This plugin collects metrics of hardware CPU load for machine running Xen
Expand Down
Loading
0