From cd281aa6b270becec28c65b8fc421a09365229f7 Mon Sep 17 00:00:00 2001 From: NEMS Linux Date: Thu, 20 Aug 2020 16:55:38 -0400 Subject: [PATCH] Add nems-info [dht11|dht22] --- data/1.6/nagios/plugins/check_dhtxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/data/1.6/nagios/plugins/check_dhtxx b/data/1.6/nagios/plugins/check_dhtxx index 205c2b6..f1edd81 100755 --- a/data/1.6/nagios/plugins/check_dhtxx +++ b/data/1.6/nagios/plugins/check_dhtxx @@ -6,13 +6,17 @@ check_dhtxx - Version 1.0 Written by Robbie Ferguson for NEMS Linux ----- - 1.0 - August 19, 2020 - Initial release + 1.0 - August 20, 2020 - Initial release */ - $dht = json_decode(shell_exec('/usr/local/share/nems/nems-scripts/dhtxx 11')); + $dht = json_decode(shell_exec('/usr/local/bin/nems-info dht11 > /dev/null 2>&1')); + if (!isset($dht->c)) { + echo 'UNKNOWN - DHT Sensor disconnected or not present.'; + exit(3); + } if ($dht->c == 1 && $dht->h == 1) { - $dht = json_decode(shell_exec('/usr/local/share/nems/nems-scripts/dhtxx 22')); + $dht = json_decode(shell_exec('/usr/local/bin/nems-info dht22 > /dev/null 2>&1')); } $json = json_encode(array(