Shorted monitor-bot- to mon-bot-

This commit is contained in:
2025-07-09 03:22:01 +02:00
parent dd1aab70fb
commit ae5f021b8d
82 changed files with 150 additions and 150 deletions

View File

@@ -0,0 +1,10 @@
# mon-bot-disc-space
## Description
Monitors disk-space usage and alerts if any filesystem usage exceeds your defined threshold.
## Features
- Uses `df` to gather current usage.
- Compares against `size_percent_disc_space_warning` threshold.
- Sends failure alerts via `alert-compose`.
- Runs on a configurable systemd timer.

View File

@@ -0,0 +1,15 @@
#!/bin/sh
# @param $1 mimimum free disc space
errors=0
minimum_percent_cleanup_disc_space="$1"
echo "checking disc space use..."
df
for disc_use_percent in $(df --output=pcent | sed 1d)
do
disc_use_percent_number=$(echo "$disc_use_percent" | sed "s/%//")
if [ "$disc_use_percent_number" -gt "$minimum_percent_cleanup_disc_space" ]; then
echo "WARNING: $disc_use_percent_number exceeds the limit of $minimum_percent_cleanup_disc_space%."
errors+=1;
fi
done
exit $errors;

View File

@@ -0,0 +1,5 @@
- name: "reload mon-bot-disc-space.cymais.service"
systemd:
name: mon-bot-disc-space.cymais.service
enabled: yes
daemon_reload: yes

View File

@@ -0,0 +1,24 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Disk-space usage monitor; alerts when usage exceeds threshold."
company: |
Kevin Veen-Birkenbach
Consulting & Coaching Solutions
https://www.veen.world
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
min_ansible_version: "2.9"
platforms:
- name: Archlinux
versions: ["rolling"]
galaxy_tags:
- monitor
- disk
- space
- health
- systemd
repository: "https://s.veen.world/cymais"
documentation: "https://s.veen.world/cymais"
dependencies:
- alert-compose

View File

@@ -0,0 +1,26 @@
- name: "create {{health_disc_space_folder}}"
file:
path: "{{health_disc_space_folder}}"
state: directory
mode: 0755
- name: create mon-bot-disc-space.sh
copy:
src: mon-bot-disc-space.sh
dest: "{{health_disc_space_folder}}mon-bot-disc-space.sh"
- name: create mon-bot-disc-space.cymais.service
template:
src: mon-bot-disc-space.service.j2
dest: /etc/systemd/system/mon-bot-disc-space.cymais.service
notify: reload mon-bot-disc-space.cymais.service
- name: set service_name to the name of the current role
set_fact:
service_name: "{{ role_name }}"
- name: "include role for generic-timer for {{service_name}}"
include_role:
name: generic-timer
vars:
on_calendar: "{{on_calendar_health_disc_space}}"

View File

@@ -0,0 +1,7 @@
[Unit]
Description=checking disc space
OnFailure=alert-compose.cymais@%n.service
[Service]
Type=oneshot
ExecStart=/bin/bash {{health_disc_space_folder}}mon-bot-disc-space.sh {{size_percent_disc_space_warning}}

View File

@@ -0,0 +1 @@
health_disc_space_folder: "{{path_administrator_scripts}}mon-bot-disc-space/"