Skip to content
Permalink
Browse files

Add exit codes to check_temper

  • Loading branch information...
NEMS Linux
NEMS Linux committed Jul 31, 2019
1 parent 25a6a20 commit ca2e8057ad62edec6590d18d3f04384e03d4f813
Showing with 7 additions and 1 deletion.
  1. +7 −1 data/1.5/nagios/plugins/check_temper
@@ -3,10 +3,11 @@
/*
check_temper - Version 1.0
check_temper - Version 1.1
Written by Robbie Ferguson for NEMS Linux
-----
1.0 - July 29, 2019 - Initial release
1.1 - July 31, 2019 - Add exit codes
*/
@@ -27,14 +28,19 @@
if ($data['temperature'] < $data['crit_low']) {
echo 'CRITICAL - ' . round($data['temperature'],1) . '°C / ' . round(($data['temperature'] * 1.8 + 32),1) . '°F (LOW)';
exit(2);
} elseif ($data['temperature'] < $data['warn_low']) {
echo 'WARNING - ' . round($data['temperature'],1) . '°C / ' . round(($data['temperature'] * 1.8 + 32),1) . '°F (LOW)';
exit(1);
} elseif ($data['temperature'] > $data['crit_high']) {
echo 'CRITICAL - ' . round($data['temperature'],1) . '°C / ' . round(($data['temperature'] * 1.8 + 32),1) . '°F (HIGH)';
exit(2);
} elseif ($data['temperature'] > $data['warn_high']) {
echo 'WARNING - ' . round($data['temperature'],1) . '°C / ' . round(($data['temperature'] * 1.8 + 32),1) . '°F (HIGH)';
exit(1);
} else {
echo 'OK - ' . round($data['temperature'],1) . '°C / ' . round(($data['temperature'] * 1.8 + 32),1) . '°F';
exit(0);
}
?>

0 comments on commit ca2e805

Please sign in to comment.
You can’t perform that action at this time.