<commit_before>= netty-collectd image:https://secure.travis-ci.org/rhq-project/netty-collectd.svg?branch=master["Build Status", link="https://travis-ci.org/rhq-project/netty-collectd", window="_blank"]
:linkattrs:

A http://netty.io[Netty, window="_blank"] decoder for the https://collectd.org[collectd, window="_blank"] https://collectd.org/wiki/index.php/Binary_protocol[binary protocol, window="_blank"].

For instructions on how to use, refer to the https://github.com/rhq-project/netty-collectd#using[Using] section below.

== About

netty-collectd decodes collectd UDP datagrams. The decoding process results in the creation of
https://github.com/rhq-project/netty-collectd/blob/master/src/main/java/org/rhq/metrics/netty/collectd/events/Event.java[Event, window="_blank"]
object instances.

Each event instance wraps:

* the sender host
(see _Hostname_ in http://collectd.org/documentation/manpages/collectd.conf.5.shtml#global_options[collectd.conf Global Options, window="_blank"])
* a metric timestamp (when it was collected)
* the plugin data (plugin and plugin instance names)
* the type data (type and instance names)
* the values
* the interval (how often this metric is collected)

== Using

First download the source or clone this repository.

Then build it:

 mvn clean install

We're working on making the bits available in a Maven repository.

=== Show me something quickly!

You need to start a collectd process configured to send metrics to a remote peer.
This is the job of the
http://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_network[Network Plugin, window="_blank"].

....
LoadPlugin network

<Plugin network>
 Server "127.0.0.1"
 TimeToLive 128
</Plugin>
....

Now run the sample program:

 mvn exec:java -Dexec.mainClass=org.rhq.metrics.netty.collectd.DumpToLog

This will dump all Event instances to the console.

=== Embedding in your Netty 4 code

First add the dependency. For Maven:

[source,xml]
----
<dependency>
  <groupId>org.rhq.metrics.netty</groupId>
  <artifactId>netty-collectd</artifactId>
  <version>0.1-SNAPSHOT</version>
</dependency>
----

Then configure your Netty server :

[source,java]
----
group = new NioEventLoopGroup();
bootstrap = new Bootstrap();
bootstrap.group(group).channel(NioDatagramChannel.class).handler(new ChannelInitializer<Channel>() {
    @Override
    protected void initChannel(Channel channel) throws Exception {
        ChannelPipeline pipeline = channel.pipeline();
        pipeline.addLast(new CollectdPartsDecoder()); // Add CollectdPartsDecoder first
        pipeline.addLast(new CollectdEventsDecoder()); // Then CollectdEventsDecoder
        pipeline.addLast(new MyCollectdEventHandler()); // Consume events in your own handler
    }
}).localAddress(address);
----

Your handler will look like:

[source,java]
----
import static io.netty.channel.ChannelHandler.Sharable;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import org.rhq.metrics.netty.collectd.events.Event;

@Sharable
public class MyCollectdEventHandler extends SimpleChannelInboundHandler<Event> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Event msg) throws Exception {
        // Do whatever you need with the org.rhq.metrics.netty.collectd.events.Event instance
    }
}
----

== Limitations

*types.db*

The decoder is not able to read http://collectd.org/documentation/manpages/types.db.5.shtml[type files, window="_blank"] yet.
Consequently:

* https://github.com/rhq-project/netty-collectd/blob/master/src/main/java/org/rhq/metrics/netty/collectd/values/SampleType.java[Sample types, window="_blank"]
cannot be verified
* it's not possible to give the sample's name

*Notifications*

The decoder does not yet understand
https://collectd.org/wiki/index.php/Notifications_and_thresholds#Notifications[notification messages, window="_blank"].
They are ignored.

*Signed or encrypted traffic*

The decoder does not yet support
https://collectd.org/wiki/index.php/Networking_introduction#Cryptographic_setup[signed or encrypted data, window="_blank"].

== Contributing

Like the idea and want to give a hand? We appreciate any kind of contributions from documentation to bug fixing or
feature enhancement.

Join us in _#rhq.next_ on Freenode +
Twitter: https://twitter.com/RHQ_Project[https://twitter.com/RHQ_Project ,window="_blank"] +
Forum: https://developer.jboss.org/en/rhq/rhq-metrics[https://developer.jboss.org/en/rhq/rhq-metrics, window="_blank"] +
<commit_msg>Snapshots in JBoss.org repo<commit_after>= netty-collectd image:https://secure.travis-ci.org/rhq-project/netty-collectd.svg?branch=master["Build Status", link="https://travis-ci.org/rhq-project/netty-collectd", window="_blank"]
:linkattrs:

A http://netty.io[Netty, window="_blank"] decoder for the https://collectd.org[collectd, window="_blank"] https://collectd.org/wiki/index.php/Binary_protocol[binary protocol, window="_blank"].

For instructions on how to use, refer to the https://github.com/rhq-project/netty-collectd#using[Using] section below.

== About

netty-collectd decodes collectd UDP datagrams. The decoding process results in the creation of
https://github.com/rhq-project/netty-collectd/blob/master/src/main/java/org/rhq/metrics/netty/collectd/events/Event.java[Event, window="_blank"]
object instances.

Each event instance wraps:

* the sender host
(see _Hostname_ in http://collectd.org/documentation/manpages/collectd.conf.5.shtml#global_options[collectd.conf Global Options, window="_blank"])
* a metric timestamp (when it was collected)
* the plugin data (plugin and plugin instance names)
* the type data (type and instance names)
* the values
* the interval (how often this metric is collected)

== Using

The snapshot versions binaries are hosted in the JBoss Snapshots repository.
Read https://developer.jboss.org/wiki/MavenGettingStarted-Users[JBoss.org Maven repository guide] for setup instructions.

Releases will be pushed to Central.

=== Show me something quickly!

https://github.com/rhq-project/netty-collectd/archive/master.zip[Download the source code] from GitHub
or clone this repository.

Then build it:

 mvn clean install

You need to start a collectd process configured to send metrics to a remote peer.
This is the job of the
http://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_network[Network Plugin, window="_blank"].

....
LoadPlugin network

<Plugin network>
 Server "127.0.0.1"
 TimeToLive 128
</Plugin>
....

Now run the sample program:

 mvn exec:java -Dexec.mainClass=org.rhq.metrics.netty.collectd.DumpToLog

This will dump all Event instances to the console.

=== Embedding in your Netty 4 code

First add the dependency. For Maven:

[source,xml]
----
<dependency>
  <groupId>org.rhq.metrics.netty</groupId>
  <artifactId>netty-collectd</artifactId>
  <version>0.1-SNAPSHOT</version>
</dependency>
----

Then configure your Netty server :

[source,java]
----
group = new NioEventLoopGroup();
bootstrap = new Bootstrap();
bootstrap.group(group).channel(NioDatagramChannel.class).handler(new ChannelInitializer<Channel>() {
    @Override
    protected void initChannel(Channel channel) throws Exception {
        ChannelPipeline pipeline = channel.pipeline();
        pipeline.addLast(new CollectdPartsDecoder()); // Add CollectdPartsDecoder first
        pipeline.addLast(new CollectdEventsDecoder()); // Then CollectdEventsDecoder
        pipeline.addLast(new MyCollectdEventHandler()); // Consume events in your own handler
    }
}).localAddress(address);
----

Your handler will look like:

[source,java]
----
import static io.netty.channel.ChannelHandler.Sharable;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import org.rhq.metrics.netty.collectd.events.Event;

@Sharable
public class MyCollectdEventHandler extends SimpleChannelInboundHandler<Event> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Event msg) throws Exception {
        // Do whatever you need with the org.rhq.metrics.netty.collectd.events.Event instance
    }
}
----

== Limitations

*types.db*

The decoder is not able to read http://collectd.org/documentation/manpages/types.db.5.shtml[type files, window="_blank"] yet.
Consequently:

* https://github.com/rhq-project/netty-collectd/blob/master/src/main/java/org/rhq/metrics/netty/collectd/values/SampleType.java[Sample types, window="_blank"]
cannot be verified
* it's not possible to give the sample's name

*Notifications*

The decoder does not yet understand
https://collectd.org/wiki/index.php/Notifications_and_thresholds#Notifications[notification messages, window="_blank"].
They are ignored.

*Signed or encrypted traffic*

The decoder does not yet support
https://collectd.org/wiki/index.php/Networking_introduction#Cryptographic_setup[signed or encrypted data, window="_blank"].

== Contributing

Like the idea and want to give a hand? We appreciate any kind of contributions from documentation to bug fixing or
feature enhancement.

Join us in _#rhq.next_ on Freenode +
Twitter: https://twitter.com/RHQ_Project[https://twitter.com/RHQ_Project ,window="_blank"] +
Forum: https://developer.jboss.org/en/rhq/rhq-metrics[https://developer.jboss.org/en/rhq/rhq-metrics, window="_blank"] +

{'fraction_non_alphanumeric': 0.11544663011931634, 'fraction_numerical': 0.003439750618080189, 'mean_word_length': 4.866330390920555, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 28, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4278127', 'n_tokens_mistral': 2834, 'n_tokens_neox': 2753, 'n_words': 749}