Skip to content

Commit

Permalink
Add nems-info [dht11|dht22]
Browse files Browse the repository at this point in the history
  • Loading branch information
NEMS Linux committed Aug 20, 2020
1 parent 030e104 commit cd281aa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions data/1.6/nagios/plugins/check_dhtxx
Expand Up @@ -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(
Expand Down

0 comments on commit cd281aa

Please sign in to comment.