Private GIT

Skip to content
Snippets Groups Projects
Select Git revision
  • ea2ec2390a59c086f93bdc5e56396d862622fa89
  • master default protected
  • fix_nzb_cat
  • develop
  • guessit2-minimal
  • ssl_warning
  • UHD-qualities
  • fix_providers8
  • !
  • tvvault
  • provider_alpharatio
  • v5.1.1
  • v5.1
  • v5.0.3
  • v5.0.2
  • v5.0.1
  • v5.0
  • v4.2.1.07
  • v4.2.1.06
  • v4.2.1.05
  • v4.2.1.04
  • v4.2.1.03
  • v4.2.1.02
  • v4.2.1.01
  • v4.2.1.0
  • v4.2.0.6
  • v4.2.0.5
  • v4.2.0.4
  • v4.2.0.3
  • v4.2.0.2
  • v4.2.0.1
31 results

readme.md

Blame
  • centreond 3.84 KiB
    #!/usr/bin/perl
    
    use strict;
    use Getopt::Long;
    use Config::IniFiles;
    use Sys::Hostname;
    use DBI;
    use Module::Util qw(:all);
    use centreon::common::logger;
    use centreon::daemon::crypt;
    use centreon::daemon::processus;
    use centreon::daemon::events qw(emit);
    
    my $configFile = '/etc/centreon/centreon.ini';
    my $keygen = 0;
    GetOptions(
      "config=s" => \$configFile,
      "keygen" => \$keygen
    ) or die("Error in command line arguments.");
    
    if (!-f $configFile) {
        print("The configuration file does not exists.\n");
        exit 2;
    }
    
    my $config = Config::IniFiles->new(
      -file => $configFile,
      -nomultiline => 1
    );
    
    # Generate keyfile if ask
    if ($keygen) {
        centreon::daemon::crypt::generateKeys("/tmp", "central", "test");
        exit 1;
    }
    
    # List of server type
    #
    # central : Run server in Central with database
    # poller : Run server to a poller
    my $serverType = "central";
    if ($config->exists("centreond", "type")) {
        $serverType = $config->val("centreond", "type");
    }
    my $pollername = hostname();
    
    # Initialize log file
    our $logger = centreon::common::logger->new();
    if ($config->exists("centreond", "log_lvl")) {
        $logger->severity($config->val("centreond", "log_lvl"));
    }
    if ($config->exists("centreond", "log_file")) {
        $logger->file_mode($config->val("centreond", "log_file"));
    }
    
    # Load module
    my @modules;
    if ($config->exists("centreond", "module")) {
        @modules = $config->val("centreond", "module");
    }
    
    $logger->writeLogInfo("Initialize daemon");
    foreach my $module (@modules) {
        if (find_installed($module)) {
            $logger->writeLogInfo("Load module : $module");
            eval "use ${module}";
            my $registerFunc = "${module}::register_events";
            ${module}->register_events($serverType);
        }
    }