morphit/ops/systemd/morphit-host-monitor.service

45 lines
1.3 KiB
Desktop File

[Unit]
Description=Morphit host-resource monitor — emits structured alerts to journalctl when disk/mem/swap/CPU thresholds breach
Documentation=https://git.agorise.net/agorise/morphit
After=network-online.target
[Service]
Type=oneshot
User=morphit-host-monitor
Group=morphit-host-monitor
# State dir for swap-thrashing delta tracking (last-vmstat).
ReadWritePaths=/var/lib/morphit-host-monitor
# Optional env file with operator-tuned thresholds. Optional —
# the script has sane defaults. Leading `-` makes it OK if absent.
EnvironmentFile=-/etc/morphit/host-monitor.env
ExecStart=/opt/morphit/ops/scripts/morphit-host-monitor.sh
# ─── Hardening (mirrors indexer/relay posture) ─────────────────
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
NoNewPrivileges=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectKernelLogs=true
ProtectControlGroups=true
ProtectClock=true
RestrictRealtime=true
RestrictSUIDSGID=true
LockPersonality=true
MemoryDenyWriteExecute=true
LimitCORE=0
# Network access not needed for /proc + df reading.
PrivateNetwork=true
RestrictAddressFamilies=AF_UNIX
# Permitted system calls — narrow for this read-only workload.
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources
[Install]
WantedBy=multi-user.target