readme and install script
This commit is contained in:
commit
facf699c22
33
README.md
Normal file
33
README.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# steamos prometheus
|
||||||
|
|
||||||
|
Heavily inspired by [Xe's guide to getting tailscale running](https://tailscale.com/blog/steam-deck/), this script installs prometheus' `node_exporter` onto a Steam Deck in a way that _should_ survive system updates.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Make sure you have `sudo` access when in desktop mode by [setting a password for your `deck` user](https://gitlab.com/popsulfr/steam-deck-tricks#easy-ssh-access-to-the-steam-deck).
|
||||||
|
|
||||||
|
Copy `./install.sh` onto your Deck, either over SSH or by copying it from a browser, then run `sudo bash ./install.sh`.
|
||||||
|
|
||||||
|
If this is the first time you've installed a system extension, run `sudo systemd-sysext merge`.
|
||||||
|
If you've already done something like the Tailscale install mentioned above, just `sudo systemd-sysext refresh`.
|
||||||
|
|
||||||
|
To make sure that system extensions are loaded after reboot, run
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo systemctl enable systemd-sysext
|
||||||
|
sudo systemctl start systemd-sysext
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you should be able to just
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo systemctl enable prometheus-node-exporter
|
||||||
|
sudo systemctl start prometheus-node-exporter
|
||||||
|
```
|
||||||
|
|
||||||
|
Installing a collector for the metrics now available on `:9100` is left as an exercise for the reader, but I figure if you're devoted to tracking system metrics enough to try and install prometheus on your Steam Deck you've probably already got a setup for that.
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
* <https://tailscale.com/blog/steam-deck/>
|
||||||
|
* <https://blogs.igalia.com/berto/2022/09/13/adding-software-to-the-steam-deck-with-systemd-sysext/>
|
42
install.sh
Normal file
42
install.sh
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
dir="$(mktemp -d)"
|
||||||
|
pushd .
|
||||||
|
cd "${dir}"
|
||||||
|
|
||||||
|
BINARY=$(curl https://api.github.com/repos/prometheus/node_exporter/releases/latest | jq -r '.assets[] | select(.name | contains("linux-amd64")) | .browser_download_url')
|
||||||
|
curl -L $BINARY -o node-exporter.tgz
|
||||||
|
|
||||||
|
mkdir -p prometheus/usr/{bin,lib/{systemd/system,extension-release.d}}
|
||||||
|
tar xzf node-exporter.tgz
|
||||||
|
|
||||||
|
cp -vrf node_exporter-*/node_exporter prometheus/usr/bin/node_exporter
|
||||||
|
cat > prometheus/usr/lib/systemd/system/prometheus-node-exporter.service <<- EOM
|
||||||
|
[Unit]
|
||||||
|
Description=Prometheus exporter for machine metrics
|
||||||
|
Requires=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Restart=on-failure
|
||||||
|
ExecStart=/usr/bin/node_exporter
|
||||||
|
ExecReload=/bin/kill -HUP \$MAINPID
|
||||||
|
NoNewPrivileges=true
|
||||||
|
ProtectHome=read-only
|
||||||
|
ProtectSystem=strict
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOM
|
||||||
|
|
||||||
|
source /etc/os-release
|
||||||
|
echo -e "SYSEXT_LEVEL=1.0\nID=steamos\nVERSION_ID=${VERSION_ID}" >> prometheus/usr/lib/extension-release.d/extension-release.prometheus-node-exporter
|
||||||
|
|
||||||
|
mkdir -p /var/lib/extensions
|
||||||
|
rm -rf /var/lib/extensions/prometheus-node-exporter
|
||||||
|
cp -vrf prometheus /var/lib/extensions/prometheus-node-exporter
|
||||||
|
|
||||||
|
popd
|
||||||
|
rm -rf "${dir}"
|
Loading…
Reference in New Issue
Block a user