Esempio n. 1
0
 public function testParseIniElastic()
 {
     $file_contents = file_get_contents('histou.ini.example');
     $file_contents = str_replace('databaseType = "influxdb"', 'databaseType = "elasticsearch"', $file_contents);
     file_put_contents('histou.ini.example.tmp', $file_contents);
     \histou\Basic::parsIni('histou.ini.example.tmp');
     unlink('histou.ini.example.tmp');
     $this->assertSame(DATABASE_TYPE, "elasticsearch");
     $this->assertSame(ELASTICSEARCH_INDEX, "nagflux");
     $this->assertSame(HOSTCHECK_ALIAS, "hostcheck");
     $this->assertSame(\histou\Basic::$phpCommand, "php");
 }
 public function init()
 {
     $_GET['host'] = 'host';
     \histou\Basic::parsIni('histou.ini.example');
     \histou\Basic::parsArgs();
 }
Esempio n. 3
0
 protected function setUp()
 {
     spl_autoload_register('__autoload');
     \histou\Basic::parsIni('histou.ini.example');
 }
Esempio n. 4
0
@category Main_File
@package Default
@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