octonet_exporter/README.md

52 lines
2.3 KiB
Markdown

# Octonet Exporter
This is a Java application that exports metrics from a Digital Devices OctopusNET to Prometheus.
## How to run?
### Option 1: Using Maven
This requires an installed Java Development Kit (JDK) version 17 or higher.
Set the OCTONET_IP environment variable to the IP address of your OctopusNET device and run the application using `mvn exec:java`.
#### Option 2: Using the precompiled binary
This requires an installed Java Runtime Environment (JRE) version 17 or higher.
There's a pre-built binary supplied in the download archive. You can use this by setting the OCTONET_IP environment variable to the IP address of your OctopusNET device and then run the application using `java -jar octonet-exporter-1.0-SNAPSHOT-jar-with-dependencies.jar`.
HINT: If you're using a Unix-based system like macOS or Linux, you can manipulate the environment variables non-permanently on the fly by using something like `OCTONET_IP=172.20.20.121 java -jar octonet-exporter-1.0-SNAPSHOT-jar-with-dependencies.jar`
### Option 3 (recommended): Using Docker or Podman
Use the provided Dockerfile to build a container and run this application in Docker or Podman. Don't forget to supply an `-e OCTONET_IP=<your_octonet_ip>` to the container.
For example:
```bash
docker build -t octonet-exporter .
docker run -d -p 9401:9401 -e OCTONET_IP=172.20.20.121 octonet-exporter
```
## How to compile a binary?
To compile a binary, run `mvn clean compile assembly:single` in the project directory. This will create a JAR file in the `target` directory that you can run using `java -jar octonet-exporter-1.0-SNAPSHOT-jar-with-dependencies.jar`.
## Prometheus config
This exporter does not need any special configuration in Prometheus.
```yaml
scrape_configs:
- job_name: "octonet-exporter"
static_configs:
- targets: ["octonet-exporter:9401"]
```
This will completely suffice.
## Getting this running quickly:
1. Run this program in any way you prefer. I recommend using Docker or Podman in order to avoid cluttering your system with dependencies.
2. Configure Prometheus to scrape this exporter. You can use the provided example configuration as a starting point.
3. Configure your Grafana to use Prometheus as a data source. (If you've already have been running Grafana, you have probably already done this.)
4. Create a dashboard in any way you like! :)
Happy DXing,
Fey.