Esempio n. 1
0
 public function testParseIniInflux()
 {
     \histou\Basic::parsIni('histou.ini.example');
     $this->assertSame(\histou\Basic::$phpCommand, "php");
     $this->assertSame(INFLUXDB_DB, "nagflux");
     $this->assertSame(DATABASE_TYPE, "influxdb");
     $this->assertSame(\histou\Basic::parsIni('foo'), "Configuration not found");
     $this->assertSame(0, \histou\Basic::testConfig());
 }
Esempio n. 2
0
@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) {
        $database = new \histou\database\Influxdb(URL);
    } elseif (DATABASE_TYPE == ELASTICSEARCH) {