Change VSPC plugin to work a bit better with certain attribute changes.

This commit is contained in:
Marsell Kukuljevic 2026-05-28 11:30:14 +02:00
parent 1235b37acd
commit ba3b406407
3 changed files with 21 additions and 24 deletions

View File

@ -196,6 +196,9 @@ def process(mAgents, bAgents, jobs, managed):
if failureMessage: if failureMessage:
# We use 2.2 here to give wiggle room for jobs to complete if # We use 2.2 here to give wiggle room for jobs to complete if
# they take longer than expected. # they take longer than expected.
#
# NB: we assume here that lastEndTime was set if there's a
# failureMessage.
results[host].append({ results[host].append({
"status": CRIT if daysSinceLastRun > 2.2 else WARN, "status": CRIT if daysSinceLastRun > 2.2 else WARN,
"message": f"Backup agent {bAgentId} job {jobId} failed {daysSinceLastRun:.1f} days ago: {failureMessage}" "message": f"Backup agent {bAgentId} job {jobId} failed {daysSinceLastRun:.1f} days ago: {failureMessage}"
@ -209,30 +212,24 @@ def process(mAgents, bAgents, jobs, managed):
}) })
continue continue
if not daysSinceLastRun: if daysSinceLastRun is not None:
results[host].append({ # We use 1.2 & 2.2 here to give wiggle room for jobs to complete if
"status": OK, # they take longer than expected.
"message": f"Backup agent {bAgentId} is healthy; no backups yet." if daysSinceLastRun > 2.2:
}) results[host].append({
continue "status": CRIT,
"message": f"Backup agent {bAgentId} job {jobId} is late! Last backup ran {daysSinceLastRun:.1f} days ago."
# We use 1.2 & 2.2 here to give wiggle room for jobs to complete if })
# they take longer than expected. elif daysSinceLastRun > 1.2:
if daysSinceLastRun > 2.2: results[host].append({
results[host].append({ "status": WARN,
"status": CRIT, "message": f"Backup agent {bAgentId} job {jobId} is late! Last backup ran {daysSinceLastRun:.1f} days ago."
"message": f"Backup agent {bAgentId} job {jobId} is late! Last backup ran {daysSinceLastRun:.1f} days ago." })
}) else:
elif daysSinceLastRun > 1.2: results[host].append({
results[host].append({ "status": OK,
"status": WARN, "message": f"Backup agent {bAgentId} job {jobId} is healthy; last backup ran {daysSinceLastRun:.1f} days ago."
"message": f"Backup agent {bAgentId} job {jobId} is late! Last backup ran {daysSinceLastRun:.1f} days ago." })
})
else:
results[host].append({
"status": OK,
"message": f"Backup agent {bAgentId} job {jobId} is healthy; last backup ran {daysSinceLastRun:.1f} days ago."
})
if not mEntry: if not mEntry:
continue continue

Binary file not shown.