i2pd-exporter/readme.md

112 lines
1.8 KiB
Markdown
Raw Normal View History

2024-05-20 00:47:07 +02:00
# I2PD exporter
A basic prometheus exporter that exports miscellaneous data using the i2pcontrol protocol such as peers, data sent & received and so on...
2024-05-21 21:28:19 +02:00
![](panel.png)
## How to use (Nix)
1. Import to your flake
```nix
{
description = "A simple NixOS flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
i2pd-exporter = {
2024-05-21 04:50:46 +02:00
url = "git+https://git.4o1x5.dev/4o1x5/i2pd-exporter";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self
, nixpkgs
, i2pd-exporter
, ...
}:
let
system = "x86_64-linux";
in
{
nixosConfigurations.server = nixpkgs.lib.nixosSystem
{
inherit system;
modules = [
./configuration.nix
i2pd-exporter.nixosModules.default
];
};
};
}
```
2. Enable I2PControl for I2PD
```nix
{pkgs, ...}:{
services.i2pd = {
enable = true;
proto.i2pControl = {
enable = true;
port = 7659;
name = "i2pcontrol";
address = "127.0.0.1";
};
};
}
```
3. Enable the exporter
```nix
2024-05-21 06:21:11 +02:00
{pkgs, config, ...}:{
services.prometheus.exporters.i2pd = {
enable = true;
port = 3321;
openFirewall = true;
2024-05-21 06:21:11 +02:00
routerAddress = "https://127.0.0.1:${toString config.services.i2pd.proto.i2pControl.port}";
routerPassword = "itoopie";
};
}
```
4. Scrape via prometheus
```nix
{ pkgs, config, ... }: {
services.prometheus = {
enable = true;
scrapeConfigs = [
{
job_name = "i2p";
scrape_interval = "5s";
static_configs = [
{
targets = [ "localhost:${toString config.services.prometheus.exporters.i2pd.port}" ];
labels = { alias = "i2pd.server.local"; };
}
];
}
];
}
}
```
5. Import the grafana dashboard
2024-05-21 06:21:11 +02:00
**todo**
# Docker
```bash
docker compose up -d
```