mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-11-21 22:03:19 +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,10 +1,3 @@
|
|||||||
{ config, pkgs, ... }:
|
|
||||||
let
|
|
||||||
backup-source = "rootNas";
|
|
||||||
# The "stay-awake" file is located at `${backup-source}:${stay-awake-file}`.
|
|
||||||
stay-awake-file = "${config.networking.hostName}.stay-awake";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# Suspend:
|
# Suspend:
|
||||||
# sudo systemctl suspend
|
# sudo systemctl suspend
|
||||||
# Suspend for 60 seconds:
|
# Suspend for 60 seconds:
|
||||||
@ -18,6 +11,15 @@ in
|
|||||||
|
|
||||||
# journalctl -u daily-backup-and-suspend
|
# journalctl -u daily-backup-and-suspend
|
||||||
|
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
let
|
||||||
|
backup-source = "rootNas";
|
||||||
|
# The "stay-awake" file is located at `${backup-source}:${stay-awake-file}`.
|
||||||
|
stay-awake-file = "${config.networking.hostName}.stay-awake";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
yoda.de-p1st-monitor = (builtins.readFile ../../assets/de-p1st-monitor/yodaHedgehog.ini);
|
||||||
|
|
||||||
assertions = [{
|
assertions = [{
|
||||||
assertion = config.services.openssh.enable;
|
assertion = config.services.openssh.enable;
|
||||||
message = "systemd service daily-backup-and-suspend requires SSH.";
|
message = "systemd service daily-backup-and-suspend requires SSH.";
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
|
yoda.de-p1st-monitor = (builtins.readFile ../../assets/de-p1st-monitor/yodaNas.ini);
|
||||||
|
|
||||||
# Update and start Jinja-Compose project
|
# Update and start Jinja-Compose project
|
||||||
# during boot and after every 30 minutes.
|
# during boot and after every 30 minutes.
|
||||||
# To view the log, run
|
# To view the log, run
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{ config, pkgs, ... }:
|
{ lib, config, options, pkgs, modulesPath, ... }:
|
||||||
|
with lib;
|
||||||
let
|
let
|
||||||
|
cfg = config.yoda.de-p1st-monitor;
|
||||||
|
|
||||||
my-python-packages = ps: with ps; [
|
my-python-packages = ps: with ps; [
|
||||||
# de-p1st-monitor is not (yet) packaged, thus we build it from PyPI
|
# de-p1st-monitor is not (yet) packaged, thus we build it from PyPI
|
||||||
(
|
(
|
||||||
@ -24,6 +27,22 @@ let
|
|||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
# Install de.p1st.monitor packages.
|
# Install de.p1st.monitor packages.
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
(pkgs.python3.withPackages my-python-packages)
|
(pkgs.python3.withPackages my-python-packages)
|
||||||
@ -33,6 +52,9 @@ in
|
|||||||
# Dependency of de.p1st.monitor
|
# Dependency of de.p1st.monitor
|
||||||
boot.kernelModules = [ "drivetemp" ];
|
boot.kernelModules = [ "drivetemp" ];
|
||||||
|
|
||||||
|
# Create configuration file.
|
||||||
|
environment.etc."de-p1st-monitor/${config.networking.hostName}.ini".text = cfg;
|
||||||
|
|
||||||
# Create de.p1st.monitor timer.
|
# Create de.p1st.monitor timer.
|
||||||
systemd.timers."de.p1st.monitor" = {
|
systemd.timers."de.p1st.monitor" = {
|
||||||
wantedBy = [ "timers.target" ];
|
wantedBy = [ "timers.target" ];
|
||||||
@ -61,4 +83,5 @@ in
|
|||||||
smartmontools
|
smartmontools
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user