Compare commits

..

No commits in common. "fd8a67c23c3c5c4c09ad2c6df324c351f2e1974f" and "e004a1002eb43568b3a23d4943598d8d044f1693" have entirely different histories.

View File

@ -13,12 +13,8 @@ if(php_sapi_name() == 'cli' || $_SERVER["REQUEST_URI"] == '/metrics') {
if (isset($submetric['command'])) { if (isset($submetric['command'])) {
$output = null; $output = null;
$retval = null; $retval = null;
try {
exec($submetric['command'], $output, $retval); exec($submetric['command'], $output, $retval);
$output = implode("\n", $output); $output = implode("\n", $output);
} catch (Exception $e) {
$output = '';
}
} elseif (isset($submetric['http'])) { } elseif (isset($submetric['http'])) {
$client = new GuzzleHttp\Client(); $client = new GuzzleHttp\Client();
@ -47,17 +43,9 @@ if(php_sapi_name() == 'cli' || $_SERVER["REQUEST_URI"] == '/metrics') {
} }
if (isset($submetric['http']['data']) && $submetric['http']['data'] == 'responsebody') { if (isset($submetric['http']['data']) && $submetric['http']['data'] == 'responsebody') {
if ($hasresponse) {
$output = $res->getBody()->getContents(); $output = $res->getBody()->getContents();
} else {
$output = '';
}
} elseif ((isset($submetric['http']['statuscode'])) && (isset($submetric['http']['data']) && $submetric['http']['data'] == 'hasresponse')) { } elseif ((isset($submetric['http']['statuscode'])) && (isset($submetric['http']['data']) && $submetric['http']['data'] == 'hasresponse')) {
if ($hasresponse) { $output = (int)in_array($res->getStatusCode(), $submetric['http']['statuscode']);
$output = $output = (int)in_array($res->getStatusCode(), $submetric['http']['statuscode']);;
} else {
$output = 0;
}
} elseif (isset($submetric['http']['data']) && $submetric['http']['data'] == 'hasresponse') { } elseif (isset($submetric['http']['data']) && $submetric['http']['data'] == 'hasresponse') {
$output = (int)$hasresponse; $output = (int)$hasresponse;
} }