[collectd] Write a plugin in Rust
nbabcock19 at hotmail.com
Mon Jan 29 18:56:32 CET 2018
I found Python, Java, and Perl plugins to be too heavyweight for a minimal installation, yet found I was writing too much code with C, so I decided to write a library for easily creating Collectd plugins in Rust: https://github.com/nickbabcock/collectd-rust-plugin
- No unnecessary allocations when submitting / receiving values, logging
- Register multiple plugin instances
- Automatic deserialization of plugin configs
- Deployment: compile against collectd version and scp to server
- Referenced Rust libraries are statically linked
In the repo plugins directory, I show a few examples of what a plugin looks like, including a Load plugin and a minimal WriteGraphite plugin.
My original impetus for this was that I wanted to monitor a subset of docker instances by name and, as far I know, no current system monitoring tool does this (cgroup is close but far from perfect).
Couple of downsides to note:
- Resulting plugins are larger than C plugins. The largest C plugin (amqp.so at 71KB) is smaller than the smallest Rust plugin (200KB with all debugging symbols stripped). This size difference is exasperated when additional Rust libraries are referenced, but it's still manageable (the docker plugin uses 10 (large) Rust projects and is 1MB stripped)
- This is not an official collectd project, so the only supported versions are the ones I test on (5.4, 5.5, 5.7, 5.8).
Anyways, I just wanted to drop a line here to make people aware of another alternative to submitting values to collectd. I've been using this library with great success for the past couple months and was curious if there were any thoughts or suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the collectd