Logo Search packages:      
Sourcecode: nagvis version File versions  Download package

GlobalMainCfg::GlobalMainCfg ( configFile  )  [inherited]

Class Constructor

Parameters:
String $configFile String with path to config file
Author:
Lars Michelsen <lars@vertical-visions.de>

Definition at line 17 of file GlobalMainCfg.php.

References GlobalMainCfg::getBasePath(), GlobalMainCfg::getValue(), GlobalMainCfg::readConfig(), and GlobalMainCfg::setPathsByBase().

                                          {
            if (DEBUG&&DEBUGLEVEL&1) debug('Start method GlobalMainCfg::GlobalMainCfg('.$configFile.')');
            $this->config = Array();
            $this->runtimeConfig = Array();
            
            $this->validConfig = Array(
                  'global' => Array(
                        'language' => Array('must' => 1,
                              'editable' => 1,
                              'default' => 'english',
                              'match' => MATCH_STRING_NO_SPACE),
                        'displayheader' => Array('must' => 1,
                                    'editable' => 1,
                                    'default' => '1',
                                    'match' => MATCH_BOOLEAN),
                        'refreshtime' => Array('must' => 1,
                                    'editable' => 1,
                                    'default' => '60',
                                    'match' => MATCH_INTEGER)),
                  'defaults' => Array(
                        'backend' => Array('must' => 0,
                              'editable' => 0,
                              'default' => 'ndomy_1',
                              'match' => MATCH_STRING_NO_SPACE),
                        'usegdlibs' => Array('must' => 1,
                              'editable' => 1,
                              'default' => '1',
                              'match' => MATCH_BOOLEAN),
                        'icons' => Array('must' => 1,
                              'editable' => 1,
                              'default' => 'std_medium',
                              'match' => MATCH_STRING_NO_SPACE),
                        'backgroundcolor' => Array('must' => 0,
                              'editable' => 1,
                              'default' => '#fff',
                              'match' => MATCH_COLOR),
                        'recognizeservices' => Array('must' => 0,
                              'editable' => 1,
                              'default' => 1,
                              'match' => MATCH_BOOLEAN),
                        'onlyhardstates' => Array('must' => 0,
                              'editable' => 1,
                              'default' => 0,
                              'match' => MATCH_BOOLEAN),
                        'headertemplate' => Array('must' => 0,
                              'editable' => 1,
                              'default' => 'default',
                              'match' => MATCH_STRING_NO_SPACE),
                        'hovertemplate' => Array('must' => 0,
                              'editable' => 1,
                              'default' => 'default',
                              'match' => MATCH_STRING_NO_SPACE),
                        'hoverdelay' => Array('must' => 0,
                              'editable' => 1,
                              'default' => '0',
                              'match' => MATCH_INTEGER),
                        'showinlists' => Array('must' => 0,
                              'editable' => 1,
                              'default' => 1,
                              'match' => MATCH_BOOLEAN),
                        'urltarget' => Array('must' => 0,
                              'editable' => 1,
                              'default' => '_self',
                              'match' => MATCH_STRING_NO_SPACE)),
                  'wui' => Array(
                              'autoupdatefreq' => Array('must' => 0,
                                    'editable' => 1,
                                    'default' => '25',
                                    'match' => MATCH_INTEGER),
                              'maplocktime' => Array('must' => 0,
                                    'editable' => 1,
                                    'default' => '350',
                                    'match' => MATCH_INTEGER),
                              'allowedforconfig' => Array(
                                    'must' => 0,
                                    'editable' => 1,
                                    'default' => Array('EVERYONE'),
                                    'match' => MATCH_STRING)),
                  'paths' => Array(
                        'base' => Array('must' => 1,
                              'editable' => 1,
                              'default' => '',
                              'match' => MATCH_STRING_PATH),
                        'cfg' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '',
                              'match' => MATCH_STRING_PATH),
                        'icon' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '',
                              'match' => MATCH_STRING_PATH),
                        'shape' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '',
                              'match' => MATCH_STRING_PATH),
                        'language' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '',
                              'match' => MATCH_STRING_PATH),
                        'map' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '',
                              'match' => MATCH_STRING_PATH),
                        'mapcfg' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '',
                              'match' => MATCH_STRING_PATH),
                        'hovertemplate' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '',
                              'type' => 'string'),
                        'headertemplate' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '',
                              'match' => MATCH_STRING_PATH),
                        'htmlbase' => Array('must' => 1,
                              'editable' => 1,
                              'default' => '/nagios/nagvis',
                              'match' => MATCH_STRING_PATH),
                        'htmlcgi' => Array('must' => 1,
                              'editable' => 1,
                              'default' => '/nagios/cgi-bin',
                              'match' => MATCH_STRING_PATH),
                        'htmlimages' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '/nagios/nagvis/nagvis/images/',
                              'match' => MATCH_STRING_PATH),
                        'htmlhovertemplates' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '/nagios/nagvis/nagvis/etc/templates/hover/',
                              'match' => MATCH_STRING_PATH),
                        'htmlheadertemplates' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '/nagios/nagvis/nagvis/etc/templates/header/',
                              'match' => MATCH_STRING_PATH),                  
                        'htmlhovertemplateimages' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '/nagios/nagvis/nagvis/images/templates/hover/',
                              'match' => MATCH_STRING_PATH),
                        'htmlheadertemplateimages' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '/nagios/nagvis/nagvis/images/templates/header/',
                              'match' => MATCH_STRING_PATH),
                        'htmlicon' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '/nagios/nagvis/nagvis/images/iconsets/',
                              'match' => MATCH_STRING_PATH),
                        'htmlshape' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '/nagios/nagvis/nagvis/images/shape/',
                              'match' => MATCH_STRING_PATH),
                        'htmlmap' => Array('must' => 0,
                              'editable' => 0,
                              'default' => '/nagios/nagvis/nagvis/images/maps/',
                              'match' => MATCH_STRING_PATH)),
                  'backend' => Array(
                        'backendtype' => Array('must' => 1,
                              'editable' => 0,
                              'default' => 'ndomy',
                              'match' => MATCH_STRING_NO_SPACE),
                        'backendid' => Array('must' => 1,
                              'editable' => 0,
                              'default' => 'ndomy_1',
                              'match' => MATCH_STRING_NO_SPACE),
                        'htmlcgi' => Array('must' => 0,
                              'editable' => 1,
                              'default' => '',
                              'match' => MATCH_STRING_PATH),
                        'options' => Array(
                              'ndomy' => Array('dbhost' => Array('must' => 1,
                                          'editable' => 1,
                                          'default' => 'localhost',
                                          'match' => MATCH_STRING_NO_SPACE),
                                    'dbport' => Array('must' => 0,
                                          'editable' => 1,
                                          'default' => '3306',
                                          'match' => MATCH_INTEGER),
                                    'dbname' => Array('must' => 1,
                                          'editable' => 1,
                                          'default' => 'nagios',
                                          'match' => MATCH_STRING_NO_SPACE),
                                    'dbuser' => Array('must' => 1,
                                          'editable' => 1,
                                          'default' => 'root',
                                          'match' => MATCH_STRING_NO_SPACE),
                                    'dbpass' => Array('must' => 0,
                                          'editable' => 1,
                                          'default' => 'root',
                                          'match' => MATCH_STRING_EMPTY),
                                    'dbprefix' => Array('must' => 0,
                                          'editable' => 1,
                                          'default' => 'nagios_',
                                          'match' => MATCH_STRING_NO_SPACE),
                                    'dbinstancename' => Array('must' => 0,
                                          'editable' => 1,
                                          'default' => 'default',
                                          'match' => MATCH_STRING_NO_SPACE),
                                    'maxtimewithoutupdate' => Array('must' => 0,
                                          'editable' => 1,
                                          'default' => '180',
                                          'match' => MATCH_INTEGER)),
                              'html' => Array(
                                    'backendid' => Array('must' => 1,
                                          'editable' => 0,
                                          'default' => 'html_1',
                                          'match' => MATCH_STRING_NO_SPACE),
                                    'cgiuser' => Array('must' => 1,
                                          'editable' => 1,
                                          'default' => 'nagiosadmin',
                                          'match' => MATCH_STRING_NO_SPACE),
                                    'cgi' => Array('must' => 1,
                                          'editable' => 1,
                                          'default' => '/usr/local/nagios/sbin/',
                                          'match' => MATCH_STRING_PATH)))),
                  'rotation' => Array('rotationid' => Array('must' => 1,
                        'editable' => 1,
                        'default' => 'demo',
                        'match' =>MATCH_STRING_NO_SPACE),
                  'maps' => Array('must' => 1,
                        'editable' => 1,
                        'default' => 'demo,demo2',
                        'match' => MATCH_STRING_NO_SPACE),
                  'interval' => Array('must' => 0,
                        'editable' => 1,
                        'default' => '',
                        'match' => MATCH_INTEGER)),
                  'internal' => Array('version' => Array('must' => 1,
                        'editable' => 0,
                        'default' => CONST_VERSION,
                        'locked' => 1,
                        'match' => MATCH_STRING_NO_SPACE),
                  'title' => Array('must' => 1,
                        'editable' => 0,
                        'default' => 'NagVis ' . CONST_VERSION,
                        'locked' => 1,
                        'match' => MATCH_STRING)));
            
            // Try to get the base path via $_SERVER['SCRIPT_FILENAME']
            $this->validConfig['paths']['base']['default'] = $this->getBasePath();
            $this->setPathsByBase($this->getValue('paths','base'),$this->getValue('paths','htmlbase'));
                  
            // Read Main Config file
            $this->configFile = $configFile;
            $this->readConfig(1);
            
            // want to reduce the paths in the NagVis config, but don't want to hardcode the paths relative from the bases
            $this->setPathsByBase($this->getValue('paths','base'),$this->getValue('paths','htmlbase'));
            
            // set default value
            $this->validConfig['rotation']['interval']['default'] = $this->getValue('global','refreshtime');
            $this->validConfig['backend']['htmlcgi']['default'] = $this->getValue('paths','htmlcgi');
            
            if (DEBUG&&DEBUGLEVEL&1) debug('End method GlobalMainCfg::GlobalMainCfg()');
      }


Generated by  Doxygen 1.6.0   Back to index