Server Administration

A script uses an if/else-if chain that checks disk usage of at least 80% for a warning before checking at least 95% for a critical alert. What change ensures that 97% usage produces the critical alert?

Show the answer

Correct answerB. Check the critical condition before the warning condition

AWhy not this: An else after the warning branch handles usage below 80%, not usage already matched by the warning.

BWhy this is right: Checking the critical threshold first routes 97% usage to the critical branch.

CWhy not this: Storing a threshold separately does not change which branch matches first.

DWhy not this: Repeating a branch later does not prevent the initial warning condition from matching first.

An if/else-if chain executes the first matching branch, so the more restrictive critical condition must come first. An unconditional else would run only when the warning condition is false, which does not fix the handling of 97% usage.