#!/usr/bin/php /dev/null"; exec ($cmd, $out_arr, $err); if ($err == 0 && check_error($out_arr, "status is success", 0) == 0) { // success echo "OK: Puppet agent is active on [$host]" . "\n"; exit(0); } else { // Fail echo "WARN: Puppet agent is down on [$host]" . "\n"; exit(1); } /* check error function */ function check_error ($output, $pattern, $ret) { $ret1=($ret+1)%2; for ($i=0; $i\n"; } ?>