Skip to content

Commit

Permalink
check if maxTimeSinceRebootTimestamp is set
Browse files Browse the repository at this point in the history
  • Loading branch information
david-d-h committed Sep 27, 2023
1 parent 184733b commit 60a6b9d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Checks/UptimeCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public function run(): Result

$timestamp = $this->getSystemUptime();

if (! isset($this->maxTimeSinceRebootTimestamp)) {
throw new \Exception('The max time since reboot was not set.');
}

if ($this->maxTimeSinceRebootTimestamp > $timestamp) {
return $result->failed("Last reboot was at [{$timestamp}], the maximum uptime for this server was set to [{$this->maxTimeSinceRebootTimestamp}]");
}
Expand Down

0 comments on commit 60a6b9d

Please sign in to comment.