added fleetlock check and modified hostgroup names

This commit is contained in:
Rasmus Thorslund 2025-04-23 15:07:37 +02:00
parent 584c44352f
commit 08f1960dc8
No known key found for this signature in database
GPG key ID: 502D33332E9E305D
3 changed files with 36 additions and 3 deletions

View file

@ -1,19 +1,25 @@
class rut::rut_mon {
nagioscfg::service {'check_rut_pods':
host_name => ['internal-sto4-prod-k8sc-0.rut.sunet.se', 'internal-sto4-prod-k8sc-1.rut.sunet.se', 'internal-sto4-prod-k8sc-2.rut.sunet.se'],
hostgroup_name => 'rut::controller_nrpe',
check_command => 'check_nrpe!check_rut_pods',
description => 'Microk8s cluster health',
}
nagioscfg::service {'check_rut_postgres':
host_name => ['internal-sto4-prod-k8sc-0.rut.sunet.se', 'internal-sto4-prod-k8sc-1.rut.sunet.se', 'internal-sto4-prod-k8sc-2.rut.sunet.se'],
hostgroup_name => 'rut::controller_nrpe',
check_command => 'check_nrpe!check_rut_postgres',
description => 'Postgres cluster health',
}
nagioscfg::service {'check_rut_snapshots':
host_name => ['internal-sto4-prod-monitor-1.rut.sunet.se'],
hostgroup_name => 'sunet::naemon_monitor',
check_command => 'check_nrpe!check_rut_snapshots',
description => 'Backup snapshots in sto4',
}
nagioscfg::service {'check_fleetlock_disabled':
hostgroup_name => 'sunet::fleetlock_client',
check_command => 'check_nrpe!check_fleetlock_disabled',
description => 'Fleetlock',
}
}

View file

@ -0,0 +1,10 @@
class rut::rut_nrpe {
sunet::nagios::nrpe_command {'check_fleetlock_disabled':
command_line => '/usr/lib/nagios/plugins/check_fleetlock_disabled.sh'
}
file { "/usr/lib/nagios/plugins/check_fleetlock_disabled.sh":
ensure => "file",
content => template("rut/check_fleetlock_disabled.sh.erb"),
mode => '0755',
}
}

View file

@ -0,0 +1,17 @@
#!/bin/bash
# This file is managed by Puppet.
# check_file_exists.sh — return WARNING if a file is absent.
set -euo pipefail
trap 'echo "UNKNOWN: script error" >&2; exit 3' ERR
FILE_TO_CHECK=${1:-/etc/run-cosmos-fleetlock-disable}
if [[ -e "$FILE_TO_CHECK" ]]; then
echo "WARNING: '$FILE_TO_CHECK' exists so fleetlock is disabled."
exit 0
else
echo "OK: Fleetlock is not disabled"
exit 1
fi