| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
63c399c052
|
add debian packaging and update readme | 2 years ago |
|
|
b4ec9f3e21
|
update cargo metadata | 2 years ago |
|
|
a55ac8a04e
|
renamed README.md | 2 years ago |
|
|
672c855129
|
add MIT license | 2 years ago |
| @ -0,0 +1,21 @@ | |||||
| MIT License | |||||
| Copyright (c) 2023 n0m1s | |||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | |||||
| of this software and associated documentation files (the "Software"), to deal | |||||
| in the Software without restriction, including without limitation the rights | |||||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||||
| copies of the Software, and to permit persons to whom the Software is | |||||
| furnished to do so, subject to the following conditions: | |||||
| The above copyright notice and this permission notice shall be included in all | |||||
| copies or substantial portions of the Software. | |||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||||
| SOFTWARE. | |||||
| @ -0,0 +1,58 @@ | |||||
| # mqtt2statsd | |||||
| mqtt2statsd is a service that translates numeric MQTT messages into statsd gauge metrics. | |||||
| ## Installing and running | |||||
| Currently, only supported on debian-based distributions. | |||||
| For other distributions, see the "Building" section below. | |||||
| Download the provided `.deb` file, and install it using `apt`: | |||||
| ```bash | |||||
| $ sudo apt install ./mqtt2statsd_0.1.0_amd64.deb | |||||
| ``` | |||||
| Configure the MQTT and StasD server, as well as the topics to subscribe to in the | |||||
| configuration file `/etc/mqtt2statsd/config.toml`. | |||||
| Once configured, enable and start the systemd service: | |||||
| ```bash | |||||
| $ sudo systemctl enable mqtt2statsd.service | |||||
| $ sudo systemctl start mqtt2statsd.service | |||||
| ``` | |||||
| ## Configuration | |||||
| mqtt2statsd is configured via a toml configuration file. | |||||
| Check [example.toml](./example.toml) for an example configuration. | |||||
| ## Building | |||||
| To build the package, you need the following dependencies (shown here for Ubuntu, actual package names may vary slightly) | |||||
| ```bash | |||||
| $ sudo apt install \ | |||||
| libssl-dev \ | |||||
| pkg-config \ | |||||
| cmake \ | |||||
| gcc | |||||
| ``` | |||||
| Then, install the latest version of rust with `rustup` ([documentation here](https://rustup.rs/)). | |||||
| If building the debian package, install `cargo-deb` with: | |||||
| ```bash | |||||
| $ cargo install cargo-deb | |||||
| ``` | |||||
| Clone the repository, and build the package: | |||||
| ```bash | |||||
| $ git clone https://git.homnomnom.fr/nomis/mqtt2statsd.git | |||||
| $ cd mqtt2statsd | |||||
| $ cargo build --release | |||||
| $ cargo deb # optional, if building deb package | |||||
| ``` | |||||
| You can now run the mqtt2statsd: | |||||
| ```bash | |||||
| $ ./target/release/mqtt2statsd ./example.toml | |||||
| ``` | |||||
| @ -0,0 +1,20 @@ | |||||
| # How to subscribe to the MQTT server | |||||
| [mqtt] | |||||
| hostname = "localhost" | |||||
| #port = 1883 # optional, default: 1883 | |||||
| #timeout = 60 # in seconds, optional, default: 60 | |||||
| # Which Statsd server to send data to | |||||
| [statsd] | |||||
| hostname = "localhost" | |||||
| #port = 8125 # optional, default: 8125 | |||||
| #prefix = "mqtt.stats" # optional, default: "mqtt.stats" | |||||
| # List of topics to subscribe to, and corresponding stat | |||||
| #[[topics]] | |||||
| #mqtt = "$SYS/broker/messages/publish/sent" | |||||
| #statsd = "publish_message_sent" | |||||
| # | |||||
| #[[topics]] | |||||
| #mqtt = "$SYS/broker/clients/connected" | |||||
| #statsd = "connected_clients" | |||||
| @ -0,0 +1,8 @@ | |||||
| [Unit] | |||||
| Description=MQTT to StatsD bridge | |||||
| [Service] | |||||
| ExecStart=/usr/bin/mqtt2statsd /etc/mqtt2statsd/config.toml | |||||
| [Install] | |||||
| WantedBy=multi-user.target | |||||
| @ -1,19 +0,0 @@ | |||||
| # mqtt2statsd | |||||
| mqtt2statsd is a service that translates numeric MQTT messages into statsd gauge metrics. | |||||
| ## Dependencies | |||||
| Ubuntu: | |||||
| ``` | |||||
| $ sudo apt install \ | |||||
| libssl-dev \ | |||||
| pkg-config \ | |||||
| cmake \ | |||||
| gcc | |||||
| ``` | |||||
| ## Configuration | |||||
| mqtt2statsd is configured via a toml configuration file. | |||||
| Check [example.toml](./example.toml) for an example configuration. | |||||