Explorar el Código

check_nt: make UPTIME accept warning/critical levels

Patch originally by Ryan Kelly
Thomas Guyot-Sionnest hace 15 años
padre
commit
6989366b8d
Se han modificado 2 ficheros con 7 adiciones y 1 borrados
  1. 1 0
      THANKS.in
  2. 6 1
      plugins/check_nt.c

+ 1 - 0
THANKS.in

@@ -265,3 +265,4 @@ Dann Frazier
 Stephane Chazelas
 Stephane Chazelas
 Craig Leres
 Craig Leres
 Brian Landers
 Brian Landers
+Ryan Kelly

+ 6 - 1
plugins/check_nt.c

@@ -203,7 +203,12 @@ int main(int argc, char **argv){
 		uphours = (uptime % 86400) / 3600;
 		uphours = (uptime % 86400) / 3600;
 		upminutes = ((uptime % 86400) % 3600) / 60;
 		upminutes = ((uptime % 86400) % 3600) / 60;
 		asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
 		asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
-		return_code=STATE_OK;
+		if (check_critical_value==TRUE && uptime <= critical_value)
+			return_code=STATE_CRITICAL;
+		else if (check_warning_value==TRUE && uptime <= warning_value)
+			return_code=STATE_WARNING;
+		else
+			return_code=STATE_OK;
 		break;
 		break;
 
 
 	case CHECK_USEDDISKSPACE:
 	case CHECK_USEDDISKSPACE: