mirror of
https://codeberg.org/icewind/palantir.git
synced 2026-06-03 10:14:09 +02:00
rename
This commit is contained in:
parent
76da726559
commit
40560f2129
11 changed files with 68 additions and 69 deletions
|
|
@ -43,5 +43,5 @@ jobs:
|
||||||
- run: nix build .#${{ matrix.target }}
|
- run: nix build .#${{ matrix.target }}
|
||||||
- uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
- uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: palantir-${{ matrix.target }}
|
name: sidewindow-${{ matrix.target }}
|
||||||
path: result/bin/palantir${{ matrix.binary-suffix }}
|
path: result/bin/sidewindow${{ matrix.binary-suffix }}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,6 @@ jobs:
|
||||||
uses: https://github.com/svenstaro/upload-release-action@v2
|
uses: https://github.com/svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
file: result/bin/palantir${{ matrix.binary-suffix }}
|
file: result/bin/sidewindow${{ matrix.binary-suffix }}
|
||||||
asset_name: palantir-${{ matrix.target }}${{ matrix.binary-suffix }}
|
asset_name: sidewindow-${{ matrix.target }}${{ matrix.binary-suffix }}
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
|
|
|
||||||
66
Cargo.lock
generated
66
Cargo.lock
generated
|
|
@ -1289,39 +1289,6 @@ version = "3.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
|
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "palantir"
|
|
||||||
version = "1.3.1"
|
|
||||||
dependencies = [
|
|
||||||
"ahash",
|
|
||||||
"bollard",
|
|
||||||
"clap",
|
|
||||||
"color-eyre",
|
|
||||||
"ctrlc",
|
|
||||||
"dotenvy",
|
|
||||||
"futures-util",
|
|
||||||
"hostname 0.4.0",
|
|
||||||
"if-addrs 0.12.0",
|
|
||||||
"libc",
|
|
||||||
"libmdns",
|
|
||||||
"nvml-wrapper",
|
|
||||||
"once_cell",
|
|
||||||
"os-thread-local",
|
|
||||||
"procfs",
|
|
||||||
"regex",
|
|
||||||
"serde",
|
|
||||||
"sysconf",
|
|
||||||
"sysinfo",
|
|
||||||
"thiserror",
|
|
||||||
"tokio",
|
|
||||||
"tracing",
|
|
||||||
"tracing-subscriber",
|
|
||||||
"warp",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
"winreg",
|
|
||||||
"wmi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "percent-encoding"
|
name = "percent-encoding"
|
||||||
version = "2.3.1"
|
version = "2.3.1"
|
||||||
|
|
@ -1617,6 +1584,39 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sidewindow"
|
||||||
|
version = "1.3.1"
|
||||||
|
dependencies = [
|
||||||
|
"ahash",
|
||||||
|
"bollard",
|
||||||
|
"clap",
|
||||||
|
"color-eyre",
|
||||||
|
"ctrlc",
|
||||||
|
"dotenvy",
|
||||||
|
"futures-util",
|
||||||
|
"hostname 0.4.0",
|
||||||
|
"if-addrs 0.12.0",
|
||||||
|
"libc",
|
||||||
|
"libmdns",
|
||||||
|
"nvml-wrapper",
|
||||||
|
"once_cell",
|
||||||
|
"os-thread-local",
|
||||||
|
"procfs",
|
||||||
|
"regex",
|
||||||
|
"serde",
|
||||||
|
"sysconf",
|
||||||
|
"sysinfo",
|
||||||
|
"thiserror",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
|
"warp",
|
||||||
|
"winapi 0.3.9",
|
||||||
|
"winreg",
|
||||||
|
"wmi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "palantir"
|
name = "sidewindow"
|
||||||
version = "1.3.1"
|
version = "1.3.1"
|
||||||
authors = ["Robin Appelman <robin@icewind.nl>"]
|
authors = ["Robin Appelman <robin@icewind.nl>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
|
||||||
24
README.md
24
README.md
|
|
@ -1,4 +1,4 @@
|
||||||
# Palantir
|
# Sidewindow
|
||||||
|
|
||||||
Opinionated system metrics exporter for prometheus
|
Opinionated system metrics exporter for prometheus
|
||||||
|
|
||||||
|
|
@ -14,11 +14,11 @@ Opinionated system metrics exporter for prometheus
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
- Download the binary for your architecture from the
|
- Download the binary for your architecture from the
|
||||||
[releases](https://github.com/icewind1991/palantir/releases/) and place it at
|
[releases](https://codeberg.org/icewind/sidewindow/releases/) and place it at
|
||||||
`/usr/local/bin/palantir`
|
`/usr/local/bin/sidewindow`
|
||||||
- Place the [palantir.service](palantir.service) file in `/etc/systemd/system/`
|
- Place the [sidewindow.service](sidewindow.service) file in `/etc/systemd/system/`
|
||||||
- Create the `palantir` user: `sudo useradd -m palantir`
|
- Create the `sidewindow` user: `sudo useradd -m sidewindow`
|
||||||
- Start enable enable the server: `sudo systemctl enable --now palantir`
|
- Start enable enable the server: `sudo systemctl enable --now sidewindow`
|
||||||
- Metrics will be available at `localhost:5665/metrics`
|
- Metrics will be available at `localhost:5665/metrics`
|
||||||
|
|
||||||
Some stats require additional permissions described below.
|
Some stats require additional permissions described below.
|
||||||
|
|
@ -27,7 +27,7 @@ Some stats require additional permissions described below.
|
||||||
|
|
||||||
In recent kernel versions, precise power monitoring is only accessible to root
|
In recent kernel versions, precise power monitoring is only accessible to root
|
||||||
users to prevent using it as a side-channel attack. In order to get the power
|
users to prevent using it as a side-channel attack. In order to get the power
|
||||||
monitoring output you'll need to give the `palantir` user access to this data
|
monitoring output you'll need to give the `sidewindow` user access to this data
|
||||||
using the following steps.
|
using the following steps.
|
||||||
|
|
||||||
- Create a group using
|
- Create a group using
|
||||||
|
|
@ -52,26 +52,26 @@ using the following steps.
|
||||||
- Add your user to the group
|
- Add your user to the group
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo usermod -a -G powermonitoring palantir
|
sudo usermod -a -G powermonitoring sidewindow
|
||||||
```
|
```
|
||||||
|
|
||||||
- Verify that you can read energy usage
|
- Verify that you can read energy usage
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo su - palantir -c 'cat /sys/class/powercap/intel-rapl:0:0/energy_uj'
|
sudo su - sidewindow -c 'cat /sys/class/powercap/intel-rapl:0:0/energy_uj'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker monitoring permissions
|
## Docker monitoring permissions
|
||||||
|
|
||||||
To enable monitoring of docker containers, add the `palantir` user to the
|
To enable monitoring of docker containers, add the `sidewindow` user to the
|
||||||
`docker` group
|
`docker` group
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo usermod -a -G docker palantir
|
sudo usermod -a -G docker sidewindow
|
||||||
```
|
```
|
||||||
|
|
||||||
## Windows support
|
## Windows support
|
||||||
|
|
||||||
Palantir has limited windows support out of the box, additional sensors can be
|
Sidewindow has limited windows support out of the box, additional sensors can be
|
||||||
enabled by running
|
enabled by running
|
||||||
[LibreHardwareMonitor](https://github.com/LibreHardwareMonitor/LibreHardwareMonitor).
|
[LibreHardwareMonitor](https://github.com/LibreHardwareMonitor/LibreHardwareMonitor).
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
};
|
};
|
||||||
outputs = {mill-scale, ...}:
|
outputs = {mill-scale, ...}:
|
||||||
mill-scale ./. {
|
mill-scale ./. {
|
||||||
packages.palantir = import ./package.nix;
|
packages.sidewindow = import ./package.nix;
|
||||||
|
|
||||||
crossTargets = [
|
crossTargets = [
|
||||||
"x86_64-pc-windows-gnu"
|
"x86_64-pc-windows-gnu"
|
||||||
|
|
@ -30,9 +30,9 @@
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [./module.nix];
|
imports = [./module.nix];
|
||||||
config = lib.mkIf config.services.palantir.enable {
|
config = lib.mkIf config.services.sidewindow.enable {
|
||||||
nixpkgs.overlays = [outputs.overlays.default];
|
nixpkgs.overlays = [outputs.overlays.default];
|
||||||
services.palantir.package = lib.mkDefault pkgs.palantir;
|
services.sidewindow.package = lib.mkDefault pkgs.sidewindow;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
10
module.nix
10
module.nix
|
|
@ -5,10 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.services.palantir;
|
cfg = config.services.sidewindow;
|
||||||
in {
|
in {
|
||||||
options.services.palantir = {
|
options.services.sidewindow = {
|
||||||
enable = mkEnableOption "Enables the palantir service";
|
enable = mkEnableOption "Enables the sidewindow service";
|
||||||
|
|
||||||
port = mkOption rec {
|
port = mkOption rec {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
|
|
@ -73,7 +73,7 @@ in {
|
||||||
|
|
||||||
services.udev.packages = [cfg.package];
|
services.udev.packages = [cfg.package];
|
||||||
|
|
||||||
systemd.services."palantir" = {
|
systemd.services."sidewindow" = {
|
||||||
wantedBy = ["multi-user.target"];
|
wantedBy = ["multi-user.target"];
|
||||||
after = ["systemd-networkd-wait-online.service"];
|
after = ["systemd-networkd-wait-online.service"];
|
||||||
path = lib.optional cfg.zfs pkgs.zfs;
|
path = lib.optional cfg.zfs pkgs.zfs;
|
||||||
|
|
@ -93,7 +93,7 @@ in {
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
ExecStart = "${cfg.package}/bin/palantir";
|
ExecStart = "${cfg.package}/bin/sidewindow";
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
PrivateTmp = true;
|
PrivateTmp = true;
|
||||||
ProtectSystem = "strict";
|
ProtectSystem = "strict";
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
final: prev: {
|
final: prev: {
|
||||||
palantir = final.callPackage ./package.nix {};
|
sidewindow = final.callPackage ./package.nix {};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
stdenv,
|
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
coreutils,
|
coreutils,
|
||||||
lib,
|
lib,
|
||||||
|
|
@ -9,8 +8,8 @@
|
||||||
src = sourceByRegex ./. ["Cargo.*" "(src|benches)(/.*)?"];
|
src = sourceByRegex ./. ["Cargo.*" "(src|benches)(/.*)?"];
|
||||||
version = (fromTOML (readFile ./Cargo.toml)).package.version;
|
version = (fromTOML (readFile ./Cargo.toml)).package.version;
|
||||||
in
|
in
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage {
|
||||||
pname = "palantir";
|
pname = "sidewindow";
|
||||||
|
|
||||||
inherit src version;
|
inherit src version;
|
||||||
|
|
||||||
|
|
@ -22,7 +21,7 @@ in
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
mkdir -p $out/lib/udev/rules.d/
|
mkdir -p $out/lib/udev/rules.d/
|
||||||
echo 'SUBSYSTEM=="powercap", ACTION=="add", RUN+="${coreutils}/bin/chgrp -R powermonitoring /sys%p", RUN+="${coreutils}/bin/chmod -R g=u /sys%p"' >> $out/lib/udev/rules.d/51-palantir.rules
|
echo 'SUBSYSTEM=="powercap", ACTION=="add", RUN+="${coreutils}/bin/chgrp -R powermonitoring /sys%p", RUN+="${coreutils}/bin/chmod -R g=u /sys%p"' >> $out/lib/udev/rules.d/51-sidewindow.rules
|
||||||
echo 'SUBSYSTEM=="powercap", ACTION=="change", ENV{TRIGGER}!="none", RUN+="${coreutils}/bin/chgrp -R powermonitoring /sys%p", RUN+="${coreutils}/bin/chmod -R g=u /sys%p"' >> $out/lib/udev/rules.d/51-palantir.rules
|
echo 'SUBSYSTEM=="powercap", ACTION=="change", ENV{TRIGGER}!="none", RUN+="${coreutils}/bin/chgrp -R powermonitoring /sys%p", RUN+="${coreutils}/bin/chmod -R g=u /sys%p"' >> $out/lib/udev/rules.d/51-sidewindow.rules
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description = palantir
|
Description = sidewindow
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=palantir
|
User=sidewindow
|
||||||
Environment=PORT=5665
|
Environment=PORT=5665
|
||||||
ExecStart=/usr/local/bin/palantir
|
ExecStart=/usr/local/bin/sidewindow
|
||||||
PrivateTmp=true
|
PrivateTmp=true
|
||||||
ProtectSystem=full
|
ProtectSystem=full
|
||||||
ProtectHome=true
|
ProtectHome=true
|
||||||
|
|
@ -4,8 +4,8 @@ use color_eyre::{Report, Result};
|
||||||
use futures_util::pin_mut;
|
use futures_util::pin_mut;
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
use libmdns::Responder;
|
use libmdns::Responder;
|
||||||
use palantir::docker::{get_docker, stat, Container};
|
use sidewindow::docker::{get_docker, stat, Container};
|
||||||
use palantir::{get_metrics, Sensors};
|
use sidewindow::{get_metrics, Sensors};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio::runtime::Handle;
|
use tokio::runtime::Handle;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue