mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-11-24 22:29:33 +01:00
de-p1st-monitor: add config files
This commit is contained in:
parent
43569d816a
commit
cdb6817c0b
60
assets/de-p1st-monitor/yodaHedgehog.ini
Normal file
60
assets/de-p1st-monitor/yodaHedgehog.ini
Normal file
@ -0,0 +1,60 @@
|
||||
[logging]
|
||||
dir = /var/log/de-p1st-monitor/
|
||||
|
||||
[filesystem.1]
|
||||
mountpoint = /
|
||||
warn_if_above = 0.75
|
||||
[filesystem.2]
|
||||
mountpoint = /boot
|
||||
warn_if_above = 0.75
|
||||
; TODO
|
||||
|
||||
[memory]
|
||||
warn_if_above = 0.85
|
||||
[swap]
|
||||
warn_if_above = 0.85
|
||||
|
||||
[cpu1]
|
||||
warn_if_above = 2.0
|
||||
warn_threshold = 2
|
||||
warn_data_range = 2
|
||||
[cpu5]
|
||||
warn_if_above = 1.5
|
||||
warn_threshold = 2
|
||||
warn_data_range = 2
|
||||
[cpu15]
|
||||
warn_if_above = 1.0
|
||||
warn_threshold = 2
|
||||
warn_data_range = 2
|
||||
|
||||
[temp.1]
|
||||
sensor = coretemp
|
||||
label = Core 0
|
||||
warn_if_above = 60
|
||||
[temp.2]
|
||||
sensor = coretemp
|
||||
label = Core 1
|
||||
warn_if_above = 60
|
||||
[temp.3]
|
||||
sensor = coretemp
|
||||
label = Core 2
|
||||
warn_if_above = 60
|
||||
[temp.4]
|
||||
sensor = coretemp
|
||||
label = Core 3
|
||||
warn_if_above = 60
|
||||
|
||||
[network.1]
|
||||
network_interface = enp3s0
|
||||
|
||||
[drive_temp.1]
|
||||
; HDD drives (WDC WD60EFAX-68S and ST6000DM003-2CY1)
|
||||
; TODO: 39 warn, 45 limit
|
||||
type = drivetemp
|
||||
warn_if_above = 40
|
||||
|
||||
; Note: The SSD (INTEL SSDSC2CW12) does not report its temperature.
|
||||
; See
|
||||
; $ sensors
|
||||
; $ cat /proc/scsi/scsi
|
||||
; $ sudo smartctl -A /dev/sda | grep Temperature_Celsius
|
70
assets/de-p1st-monitor/yodaNas.ini
Normal file
70
assets/de-p1st-monitor/yodaNas.ini
Normal file
@ -0,0 +1,70 @@
|
||||
[logging]
|
||||
dir = /var/log/de-p1st-monitor/
|
||||
|
||||
[filesystem.1]
|
||||
; 256GB2
|
||||
mountpoint = /
|
||||
warn_if_above = 0.75
|
||||
[filesystem.2]
|
||||
; 256GB2
|
||||
mountpoint = /boot
|
||||
warn_if_above = 0.75
|
||||
[filesystem.3]
|
||||
; 12TB1
|
||||
uuid = c385a436-0288-486f-a2b9-c64c2db667e7
|
||||
warn_if_above = 0.66
|
||||
[filesystem.4]
|
||||
; 3TB1, 3TB2 and 4TB1
|
||||
uuid = 1f560eeb-a375-457b-84a6-93d771a5ba5f
|
||||
warn_if_above = 0.85
|
||||
unmounted_ok = true
|
||||
|
||||
[memory]
|
||||
warn_if_above = 0.85
|
||||
[swap]
|
||||
warn_if_above = 0.85
|
||||
|
||||
[cpu1]
|
||||
warn_if_above = 3.0
|
||||
warn_threshold = 2
|
||||
warn_data_range = 2
|
||||
[cpu5]
|
||||
warn_if_above = 2.0
|
||||
warn_threshold = 2
|
||||
warn_data_range = 2
|
||||
[cpu15]
|
||||
warn_if_above = 1.0
|
||||
warn_threshold = 2
|
||||
warn_data_range = 2
|
||||
|
||||
[temp.1]
|
||||
sensor = coretemp
|
||||
label = Package id 0
|
||||
warn_if_above = 60
|
||||
[temp.2]
|
||||
sensor = coretemp
|
||||
label = Core 0
|
||||
warn_if_above = 60
|
||||
[temp.3]
|
||||
sensor = coretemp
|
||||
label = Core 1
|
||||
warn_if_above = 60
|
||||
|
||||
[network.1]
|
||||
network_interface = enp0s31f6
|
||||
|
||||
[drive_temp.1]
|
||||
; NVMe drives
|
||||
; TODO: 49 warn, 55 limit
|
||||
type = nvme
|
||||
warn_if_above = 50
|
||||
[drive_temp.2]
|
||||
; HDD drives
|
||||
; TODO: 39 warn, 45 limit
|
||||
type = drivetemp
|
||||
warn_if_above = 40
|
||||
|
||||
; [sensor_script.1]
|
||||
; cmd = ["digitemp_DS9097", "-q", "-c", "/home/yoda/.digitemprc", "-t", "0"]
|
||||
; name = room-temp
|
||||
; warn_if_above = 32
|
@ -1,3 +1,16 @@
|
||||
# Suspend:
|
||||
# sudo systemctl suspend
|
||||
# Suspend for 60 seconds:
|
||||
# sudo rtcwake -m mem -s 60
|
||||
|
||||
# Power consumption:
|
||||
# 2.4W powered off, with 1 RAM, 1 SSD
|
||||
# 2.6W suspended, with 1 RAM, 1 SSD
|
||||
# 2.6W suspended, with 1 RAM, 1 SSD, 2 HDDs
|
||||
# 18.9W idle, with 1 RAM, 1 SSD, 2 HDDs
|
||||
|
||||
# journalctl -u daily-backup-and-suspend
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
backup-source = "rootNas";
|
||||
@ -5,18 +18,7 @@ let
|
||||
stay-awake-file = "${config.networking.hostName}.stay-awake";
|
||||
in
|
||||
{
|
||||
# Suspend:
|
||||
# sudo systemctl suspend
|
||||
# Suspend for 60 seconds:
|
||||
# sudo rtcwake -m mem -s 60
|
||||
|
||||
# Power consumption:
|
||||
# 2.4W powered off, with 1 RAM, 1 SSD
|
||||
# 2.6W suspended, with 1 RAM, 1 SSD
|
||||
# 2.6W suspended, with 1 RAM, 1 SSD, 2 HDDs
|
||||
# 18.9W idle, with 1 RAM, 1 SSD, 2 HDDs
|
||||
|
||||
# journalctl -u daily-backup-and-suspend
|
||||
yoda.de-p1st-monitor = (builtins.readFile ../../assets/de-p1st-monitor/yodaHedgehog.ini);
|
||||
|
||||
assertions = [{
|
||||
assertion = config.services.openssh.enable;
|
||||
|
@ -1,5 +1,7 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
yoda.de-p1st-monitor = (builtins.readFile ../../assets/de-p1st-monitor/yodaNas.ini);
|
||||
|
||||
# Update and start Jinja-Compose project
|
||||
# during boot and after every 30 minutes.
|
||||
# To view the log, run
|
||||
|
@ -1,5 +1,8 @@
|
||||
{ config, pkgs, ... }:
|
||||
{ lib, config, options, pkgs, modulesPath, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.yoda.de-p1st-monitor;
|
||||
|
||||
my-python-packages = ps: with ps; [
|
||||
# de-p1st-monitor is not (yet) packaged, thus we build it from PyPI
|
||||
(
|
||||
@ -24,41 +27,61 @@ let
|
||||
];
|
||||
in
|
||||
{
|
||||
# Install de.p1st.monitor packages.
|
||||
environment.systemPackages = [
|
||||
(pkgs.python3.withPackages my-python-packages)
|
||||
# Dependency of de.p1st.monitor.
|
||||
pkgs.smartmontools
|
||||
];
|
||||
# Dependency of de.p1st.monitor
|
||||
boot.kernelModules = [ "drivetemp" ];
|
||||
|
||||
# Create de.p1st.monitor timer.
|
||||
systemd.timers."de.p1st.monitor" = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
partOf = [ "de.p1st.monitor.service" ];
|
||||
timerConfig = {
|
||||
OnBootSec = "0m";
|
||||
OnUnitInactiveSec = "3m";
|
||||
|
||||
AccuracySec = "15s";
|
||||
RandomizedDelaySec = "15s";
|
||||
options = {
|
||||
yoda.de-p1st-monitor = mkOption {
|
||||
type = types.str;
|
||||
example = ''
|
||||
[logging]
|
||||
dir = /var/log/de-p1st-monitor/
|
||||
[network.1]
|
||||
network_interface = wlan0
|
||||
'';
|
||||
description = ''
|
||||
Content of /etc/de-p1st-monitor/''${hostname}.ini
|
||||
'';
|
||||
};
|
||||
};
|
||||
systemd.services."de.p1st.monitor" = {
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
PrivateTmp = true;
|
||||
# `smartctl` requires root to access /dev/* devices and read their temperatures.
|
||||
User = "root";
|
||||
Nice = 19;
|
||||
IOSchedulingClass = "idle";
|
||||
ExecStart = "${pkgs.python3.withPackages my-python-packages}/bin/de-p1st-monitor";
|
||||
};
|
||||
path = with pkgs; [
|
||||
# Provides `findmnt` binary.
|
||||
libuuid
|
||||
smartmontools
|
||||
|
||||
config = {
|
||||
# Install de.p1st.monitor packages.
|
||||
environment.systemPackages = [
|
||||
(pkgs.python3.withPackages my-python-packages)
|
||||
# Dependency of de.p1st.monitor.
|
||||
pkgs.smartmontools
|
||||
];
|
||||
# Dependency of de.p1st.monitor
|
||||
boot.kernelModules = [ "drivetemp" ];
|
||||
|
||||
# Create configuration file.
|
||||
environment.etc."de-p1st-monitor/${config.networking.hostName}.ini".text = cfg;
|
||||
|
||||
# Create de.p1st.monitor timer.
|
||||
systemd.timers."de.p1st.monitor" = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
partOf = [ "de.p1st.monitor.service" ];
|
||||
timerConfig = {
|
||||
OnBootSec = "0m";
|
||||
OnUnitInactiveSec = "3m";
|
||||
|
||||
AccuracySec = "15s";
|
||||
RandomizedDelaySec = "15s";
|
||||
};
|
||||
};
|
||||
systemd.services."de.p1st.monitor" = {
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
PrivateTmp = true;
|
||||
# `smartctl` requires root to access /dev/* devices and read their temperatures.
|
||||
User = "root";
|
||||
Nice = 19;
|
||||
IOSchedulingClass = "idle";
|
||||
ExecStart = "${pkgs.python3.withPackages my-python-packages}/bin/de-p1st-monitor";
|
||||
};
|
||||
path = with pkgs; [
|
||||
# Provides `findmnt` binary.
|
||||
libuuid
|
||||
smartmontools
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user