Add weekly support to VSPC.
This commit is contained in:
parent
c9c2130ea6
commit
80c4c33939
@ -220,7 +220,24 @@ def process(mAgents, bAgents, jobs, restores):
|
||||
})
|
||||
continue
|
||||
|
||||
if sched != "Daily":
|
||||
warnDays = 0
|
||||
critDays = 0
|
||||
if sched == "Daily":
|
||||
# We use 1.2 & 2.2 here to give wiggle room for jobs to complete if
|
||||
# they take longer than expected.
|
||||
warnDays = 1.2
|
||||
critDays = 2.2
|
||||
elif sched == "Weekly":
|
||||
# Ditto, but for a week
|
||||
warnDays = 7.2
|
||||
critDays = 8.2
|
||||
elif sched == "NotScheduled":
|
||||
results[host].append({
|
||||
"status": WARN,
|
||||
"message": f"Backup agent {bAgentId} job {jobId} is not scheduled."
|
||||
})
|
||||
continue
|
||||
else:
|
||||
results[host].append({
|
||||
"status": WARN,
|
||||
"message": f"Backup agent {bAgentId} job {jobId} has scheduleType unknown to CheckMK plugin: {sched}."
|
||||
@ -228,14 +245,12 @@ def process(mAgents, bAgents, jobs, restores):
|
||||
continue
|
||||
|
||||
if daysSinceLastRun is not None:
|
||||
# We use 1.2 & 2.2 here to give wiggle room for jobs to complete if
|
||||
# they take longer than expected.
|
||||
if daysSinceLastRun > 2.2:
|
||||
if daysSinceLastRun > critDays:
|
||||
results[host].append({
|
||||
"status": CRIT,
|
||||
"message": f"Backup agent {bAgentId} job {jobId} is late! Last backup ran {daysSinceLastRun:.1f} days ago."
|
||||
})
|
||||
elif daysSinceLastRun > 1.2:
|
||||
elif daysSinceLastRun > warnDays:
|
||||
results[host].append({
|
||||
"status": WARN,
|
||||
"message": f"Backup agent {bAgentId} job {jobId} is late! Last backup ran {daysSinceLastRun:.1f} days ago."
|
||||
@ -254,12 +269,12 @@ def process(mAgents, bAgents, jobs, restores):
|
||||
timeSinceLastSuccess = datetime.now(timezone.utc) - datetime.fromisoformat(lastRestorePoint)
|
||||
daysSinceLastSuccess = timeSinceLastSuccess.seconds / SECONDS_PER_DAY
|
||||
|
||||
if daysSinceLastSuccess > 2.2:
|
||||
if daysSinceLastSuccess > critDays:
|
||||
results[host].append({
|
||||
"status": CRIT,
|
||||
"message": f"Job {jobId} last SUCCESSFULLY ran {daysSinceLastSuccess:.1f} days ago!"
|
||||
})
|
||||
elif daysSinceLastSuccess > 1.2:
|
||||
elif daysSinceLastSuccess > warnDays:
|
||||
results[host].append({
|
||||
"status": WARN,
|
||||
"message": f"Job {jobId} last SUCCESSFULLY ran {daysSinceLastSuccess:.1f} days ago!"
|
||||
|
||||
Binary file not shown.
BIN
vspc_backup_checks/2.3/vspc_backup_checks-0.4.0.mkp
Executable file
BIN
vspc_backup_checks/2.3/vspc_backup_checks-0.4.0.mkp
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user