Closed spardhas closed 1 year ago
@@ -283,18 +283,27 @@ def checkSingleJob(cursor, name, state, kind, time, warning, critical):
cursor.execute(query)
results = cursor.fetchall() # Returns a value
result = len(results)
-
- if result >= int(critical):
+ if(state != 'T'):
+ if result >= int(critical):
checkState["returnCode"] = 2
checkState["returnMessage"] = "CRITICAL - " + str(result) + " Jobs are in the state: "+str(getState(state))- elif result >= int(warning):
+ elif result >= int(warning):
checkState["returnCode"] = 1
checkState["returnMessage"] = "WARNING - " + str(result) + " Jobs are in the state: "+str(getState(state))
+ else:
+ checkState["returnCode"] = 0
+ checkState["returnMessage"] = "OK - " + str(result) + " Jobs are in the state: "+str(getState(state))
else:
+ if result <= int(critical):
+ checkState["returnCode"] = 2
+ checkState["returnMessage"] = "CRITICAL - " + str(result) + " Jobs are in the state: "+str(getState(state))+ elif result <= int(warning):
+ checkState["returnCode"] = 1
+ checkState["returnMessage"] = "WARNING - " + str(result) + " Jobs are in the state: "+str(getState(state))
+ else:
checkState["returnCode"] = 0
checkState["returnMessage"] = "OK - " + str(result) + " Jobs are in the state: "+str(getState(state))
checkState["performanceData"] = str(getState(state))+"=" + str(result) + ";" + str(warning) + ";" + str(critical) +-
return checkState
def checkRunTimeJobs(cursor,name,state,time,warning,critical):
a simple work around that check if the state is "T" and reverse the crit and warn thresholds
We're currently planning a rewrite that will adress this issue.
The refactor will allow for --warning
--critical
Thresholds. This will solve the issues by allowing this:
check_bareos.py -U bareos job --checkJob --warning 5: --critical 3:
Hi,
When check the Completed Job, the warning and critical must be in reverse way.
eg: I have 5 Job. I need a warning if i have less of 5 and a critical when i have less of 3 job is not successfully done.