ajout sondes processus jitsi

This commit is contained in:
David 2022-12-19 10:43:57 +01:00
parent 737edcb7c5
commit 46d6abb75e
3 changed files with 10 additions and 32 deletions

View File

@ -1,32 +0,0 @@
#!/usr/bin/env python3
import datetime, itertools, os, re
now = datetime.datetime.now(datetime.timezone.utc)
max_backup_delay = datetime.timedelta(1, 7200)
def get_name(match):
return match.group('name')
def check_backup(filename):
with open(filename) as f:
logs = f.read()
mixed_statuses = list(re.finditer(r'(?P<status>Succeeded|Failed) (?P<name>\w+) backup at (?P<date>\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\+\d\d:\d\d)$', logs, re.MULTILINE))
for name, statuses in itertools.groupby(sorted(mixed_statuses, key=get_name), key=get_name):
last = sorted(statuses, key=lambda x: x.group('date'))[-1]
print('{name}: {status} at {date}'.format(**last.groupdict()))
last_date = datetime.datetime.fromisoformat(last.group('date'))
last_status = last.group('status')
if last_status != 'Succeeded' or now - last_date > max_backup_delay:
failure.append(name)
failure = []
try:
check_backup ("/var/log/borgmatic.log")
except Exception:
check_backup ("/var/log/borgmatic.log.1")
if failure:
exit (1)
else:
exit (0)

5
monitoring/check_jitsi_jicofo Executable file
View File

@ -0,0 +1,5 @@
#! /bin/sh
retStr=`/usr/lib/nagios/plugins/check_procs -a jicofo`
retCode=${?}
echo "${retStr}"
exit ${retCode}

View File

@ -0,0 +1,5 @@
#! /bin/sh
retStr=`/usr/lib/nagios/plugins/check_procs -a jvb`
retCode=${?}
echo "${retStr}"
exit ${retCode}