Esempio n. 1
0
 public function testParseArgsCommandline()
 {
     $this->testParseIniInflux();
     ob_start();
     \histou\Basic::parsArgs();
     $out1 = ob_get_contents();
     ob_end_clean();
     $this->assertSame("<pre>Hostname is missing!<br>1<br>Hostname is missing!<br></pre>", $out1);
     ob_start();
     \histou\Basic::parsArgs();
     $out2 = ob_get_contents();
     ob_end_clean();
     $this->assertSame("", $out2);
 }
 public function init()
 {
     $_GET['host'] = 'host';
     \histou\Basic::parsIni('histou.ini.example');
     \histou\Basic::parsArgs();
 }
Esempio n. 3
0
 public function init()
 {
     $_GET['host'] = 'host';
     \histou\Basic::parsArgs();
 }
Esempio n. 4
0
@author Philip Griesbacher <*****@*****.**>
@license http://opensource.org/licenses/gpl-license.php GNU Public License
@link https://github.com/Griesbacher/histou
**/
require_once 'histou/bootstrap.php';
set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) {
    // error was suppressed with the @-operator
    if (0 === error_reporting()) {
        return false;
    }
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
});
//Set path to config file and parse it
\histou\Basic::parsIni('histou.ini');
//Parse commandline and get parameter
\histou\Basic::parsArgs();
//Test config
$returnCode = \histou\Basic::testConfig();
if (isset($returnCode) && $returnCode != 0) {
    exit($returnCode);
}
header("access-control-allow-origin: *");
//Disable warnings
//error_reporting(E_ALL ^ E_WARNING);
//error_reporting(0);
ini_set('default_socket_timeout', DEFAULT_SOCKET_TIMEOUT);
$perfData = array('host' => HOST, 'service' => SERVICE);
if (!\histou\Basic::$disablePerfdataLookup) {
    // database load perfdata
    $database = null;
    if (DATABASE_TYPE == INFLUXDB) {