Skip to content
This repository was archived by the owner on Dec 13, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 34 additions & 27 deletions www/install/steps/process/configFileSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}

// mandatory parameters used by centCore or Gorgone.d in the legacy SSH mode
$patterns = array(
$patterns = [
'/--ADDRESS--/',
'/--DBUSER--/',
'/--DBPASS--/',
Expand All @@ -65,9 +65,9 @@
'/--DBPORT--/',
'/--INSTANCEMODE--/',
'/--CENTREON_VARLIB--/'
);
];

$replacements = array(
$replacements = [
$host,
$parameters['db_user'],
$parameters['db_password'],
Expand All @@ -78,24 +78,6 @@
$parameters['port'],
"central",
$configuration['centreon_varlib']
);

// specific additional mandatory parameters used by Gorgone.d in a full ZMQ mode
// these patterns don't replace the original ones
$gorgonePatterns = [
'/--CENTREON_SPOOL--/',
'/--HTTPSERVERADDRESS--/',
'/--HTTPSERVERPORT--/',
'/--SSLMODE--/',
'/--CENTREON_TRAPDIR--/',
];

$gorgoneReplacements = [
"/var/spool/centreon",
"0.0.0.0",
"8085",
"false",
"/etc/snmp/centreon_traps",
];

$centreonEtcPath = rtrim($configuration['centreon_etc'], '/');
Expand All @@ -116,15 +98,40 @@
$contents = preg_replace($patterns, $replacements, $contents);
file_put_contents($centreonConfPmFile, $contents);

// specific additional mandatory parameters used by Gorgone.d in a full ZMQ mode
array_push(
$patterns,
'/--CENTREON_SPOOL--/',
'/--HTTPSERVERADDRESS--/',
'/--HTTPSERVERPORT--/',
'/--SSLMODE--/',
'/--CENTREON_TRAPDIR--/'
);

array_push(
$replacements,
"/var/spool/centreon",
"0.0.0.0",
"8085",
"false",
"/etc/snmp/centreon_traps"
);

/**
* Database configuration file
*/
$gorgoneDatabaseFile = $centreonEtcPath . '/config.d/10-database.yaml';
$contents = file_get_contents('../../var/databaseTemplate.yaml');
$contents = preg_replace($patterns, $replacements, $contents);
file_put_contents($gorgoneDatabaseFile, $contents);

/**
* gorgoned.yml
* configuration file used by the Gorgone module in a full ZMQ mode
* Gorgone daemon configuration file for a central
*/
$centreonGorgonedConfFile = $centreonEtcPath . '/gorgoned.yml';
$contents = file_get_contents('../../var/configFileGorgoneTemplate');
$gorgoneCoreFileForCentral = $centreonEtcPath . '/config.d/20-gorgoned.yaml';
$contents = file_get_contents('../../var/gorgone/gorgoneCoreTemplate.yaml');
$contents = preg_replace($patterns, $replacements, $contents);
$contents = preg_replace($gorgonePatterns, $gorgoneReplacements, $contents);
file_put_contents($centreonGorgonedConfFile, $contents);
file_put_contents($gorgoneCoreFileForCentral, $contents);

$return['result'] = 0;
echo json_encode($return);
Expand Down
3 changes: 3 additions & 0 deletions www/install/var/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: config.yaml
description: Configuration for Central server
configuration: !include config.d/*.yaml
70 changes: 0 additions & 70 deletions www/install/var/configFileGorgoneTemplate

This file was deleted.

9 changes: 9 additions & 0 deletions www/install/var/databaseTemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
database:
db_centreon:
dsn: "mysql:host=--ADDRESS--:--DBPORT--;dbname=--CONFDB--"
username: "--DBUSER--"
password: "--DBPASS--"
db_centstorage:
dsn: "mysql:host=--ADDRESS--:--DBPORT--;dbname=--STORAGEDB--"
username: "--DBUSER--"
password: "--DBPASS--"
59 changes: 59 additions & 0 deletions www/install/var/gorgone/gorgoneCoreTemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
gorgone:
gorgonecore:
privkey: "--CENTREON_SPOOL--/.gorgone/rsakey.priv.pem"
pubkey: "--CENTREON_SPOOL--/.gorgone/rsakey.pub.pem"

modules:
- name: httpserver
package: "gorgone::modules::core::httpserver::hooks"
enable: true
address: "--HTTPSERVERADDRESS--"
port: "--HTTPSERVERPORT--"
ssl: --SSLMODE--
auth:
enabled: false
allowed_hosts:
enabled: true
subnets:
- 127.0.0.1/32

- name: action
package: "gorgone::modules::core::action::hooks"
enable: true

- name: cron
package: "gorgone::modules::core::cron::hooks"
enable: true
cron: !include cron.d/*.yaml

- name: nodes
package: "gorgone::modules::centreon::nodes::hooks"
enable: true

- name: proxy
package: "gorgone::modules::core::proxy::hooks"
enable: true

- name: legacycmd
package: "gorgone::modules::centreon::legacycmd::hooks"
enable: true
cmd_file: "--CENTREON_VARLIB--/centcore.cmd"
cache_dir: "--CENTREON_CACHEDIR--"
cache_dir_trap: "--CENTREON_TRAPDIR--"
remote_dir: "--CENTREON_VARLIB--/remote-data/"

- name: engine
package: "gorgone::modules::centreon::engine::hooks"
enable: true
command_file: "--CENTREON_VARLIB---engine/rw/centengine.cmd"

- name: broker
package: "gorgone::modules::centreon::broker::hooks"
enable: true
cache_dir: "--CENTREON_CACHEDIR--broker-stats/"
cron:
- id: broker_stats
timespec: "*/2 * * * *"
action: BROKERSTATS
parameters:
timeout: 10