Skip to content
This repository was archived by the owner on Nov 16, 2022. It is now read-only.
Open
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
2 changes: 1 addition & 1 deletion features/bootstrap/CentreonAwieContext.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
** Copyright 2018 Centreon
** Copyright 2018-2019 Centreon
**
** All rights reserved.
*/
Expand Down
60 changes: 30 additions & 30 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#!/bin/bash
#
# Copyright 2005-2018 CENTREON

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copyright 2005-2018 CENTREON
# Copyright 2005-2019 CENTREON

# Centreon is developped by : Julien Mathis and Romain Le Merlus under
# Centreon is developed by : Julien Mathis and Romain Le Merlus under
# GPL Licence 2.0.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation ; either version 2 of the License.
#
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <http://www.gnu.org/licenses>.
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
#
# Linking this program statically or dynamically with other modules is making a
# combined work based on this program. Thus, the terms and conditions of the GNU
# General Public License cover the whole combination.
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
#
# As a special exception, the copyright holders of this program give CENTREON
# permission to link this program with independent modules to produce an executable,
# regardless of the license terms of these independent modules, and to copy and
# distribute the resulting executable under terms of CENTREON choice, provided that
# CENTREON also meet, for each linked independent module, the terms and conditions
# of the license of that module. An independent module is a module which is not
# derived from this program. If you modify this program, you may extend this
# exception to your version of the program, but you are not obliged to do so. If you
# do not wish to do so, delete this exception statement from your version.
#
#
# For more information : contact@centreon.com
#
#

# Define module information
RNAME="Centreon Web Import/Export"
Expand Down Expand Up @@ -79,7 +79,7 @@ function usage() {

### Main

# define where is a centreon source
# define where is a centreon source
BASE_DIR=$(dirname $0)
## set directory
BASE_DIR=$( cd $BASE_DIR; pwd )
Expand All @@ -103,7 +103,7 @@ export line
LOG_DIR="$BASE_DIR/log"
LOG_FILE="$PWD/install.log"

## Valid if you are root
## Valid if you are root
USERID=`id -u`
if [ "$USERID" != "0" ]; then
echo -e "You must exec with root user"
Expand All @@ -121,11 +121,11 @@ do
silent_install="1"
user_conf="${OPTARG%/}"
;;
\?|h) usage ;
exit 0
\?|h) usage ;
exit 0
;;
* ) usage ;
exit 1
* ) usage ;
exit 1
;;
esac
done
Expand All @@ -136,7 +136,7 @@ if [ "$_tmp_install_opts" -eq 0 ] ; then
fi

#Export variable for all programs
export silent_install CENTREON_CONF
export silent_install CENTREON_CONF

## init LOG_FILE
# backup old log file...
Expand All @@ -163,11 +163,11 @@ binary_fail="0"
# For the moment, I check if all binary exists in path.
# After, I must look a solution to use complet path by binary
for binary in $BINARIES; do
if [ ! -e ${binary} ] ; then
if [ ! -e ${binary} ] ; then
pathfind "$binary"
if [ "$?" -eq 0 ] ; then
echo_success "${binary}" "$ok"
else
else
echo_failure "${binary}" "$fail"
log "ERR" "\$binary not found in \$PATH"
binary_fail=1
Expand Down
46 changes: 23 additions & 23 deletions libinstall/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SETCOLOR_NORMAL="\\033[0;39m"
## @Globals LOG_FILE
#----
function echo_info() {
echo -e "${1}${MOVE_TO_COL}${SETCOLOR_INFO}${2}${SETCOLOR_NORMAL}"
echo -e "${1}${MOVE_TO_COL}${SETCOLOR_INFO}${2}${SETCOLOR_NORMAL}"
echo -e "$1 : $2" >> $LOG_FILE
}

Expand All @@ -46,7 +46,7 @@ function echo_info() {
## @Globals LOG_FILE
#----
function echo_success() {
echo -e "${1}${MOVE_TO_COL}${SETCOLOR_SUCCESS}${2}${SETCOLOR_NORMAL}"
echo -e "${1}${MOVE_TO_COL}${SETCOLOR_SUCCESS}${2}${SETCOLOR_NORMAL}"
echo -e "$1 : $2" >> $LOG_FILE
}

Expand Down Expand Up @@ -113,7 +113,7 @@ function log() {
function define_specific_binary_vars() {
local vars_bin="GREP CAT SED CHMOD CHOWN RM MKDIR CP MV"
local var_bin_tolower=""
for var_bin in $vars_bin ;
for var_bin in $vars_bin ;
do
if [ -z $(eval echo \$$var_bin) ] ; then
var_bin_tolower="$(echo $var_bin | tr [:upper:] [:lower:])"
Expand Down Expand Up @@ -192,9 +192,9 @@ function yes_no_default() {
read res
[ -z "$res" ] && res="$default"
done
if [ "$res" = "$yes" ] ; then
if [ "$res" = "$yes" ] ; then
return 0
else
else
return 1
fi
}
Expand Down Expand Up @@ -285,7 +285,7 @@ function get_spaces_modulo_forge_url() {
function print_footer() {
forge_url_spaces=`get_spaces_modulo_forge_url;`
spaces_x=`echo $forge_url_spaces | cut -d":" -f1`

echo -e "################################################################################"
echo -e "# #"
echo -e "# Go to the URL : http://your-server/centreon/ to finish the setup #"
Expand All @@ -307,14 +307,14 @@ function get_centreon_parameters() {

WEB_USER=`${CAT} $CENTREON_CONF/$FILE_CONF | ${GREP} "WEB_USER" | cut -d '=' -f2`;
WEB_GROUP=`${CAT} $CENTREON_CONF/$FILE_CONF | ${GREP} "WEB_GROUP" | cut -d '=' -f2`;

MONITORINGENGINE_BINARY=`${CAT} $CENTREON_CONF/$FILE_CONF | ${GREP} "MONITORINGENGINE_BINARY" | cut -d '=' -f2`;
PLUGIN_DIR=`${CAT} $CENTREON_CONF/$FILE_CONF | ${GREP} "PLUGIN_DIR" | cut -d '=' -f2`;
MONITORINGENGINE_USER=`${CAT} $CENTREON_CONF/$FILE_CONF | ${GREP} "MONITORINGENGINE_USER" | cut -d '=' -f2`;
CENTREON_GROUP=`${CAT} $CENTREON_CONF/$FILE_CONF | ${GREP} "CENTREON_GROUP" | cut -d '=' -f2`;

PLUGIN_DIR=`${CAT} $CENTREON_CONF/$CENTPLUGINS_FILE_CONF | ${GREP} "PLUGIN_DIR" | cut -d '=' -f2`

RESULT=0
# check centreon parameters
if [ "$CENTREON_DIR" != "" ] ; then
Expand Down Expand Up @@ -355,8 +355,8 @@ function get_centreon_parameters() {
fi


#if [ "$RESULT" -eq 10 ]; then
if [ "$RESULT" -eq 9 ]; then
#if [ "$RESULT" -eq 10 ]; then
if [ "$RESULT" -eq 9 ]; then
return 1;
else
return 0;
Expand Down Expand Up @@ -423,24 +423,24 @@ function install_module_web() {
${CHMOD} -R 755 $TEMP_D/* >> $LOG_FILE 2>> $LOG_FILE
if [ "$?" -eq 0 ] ; then
echo_success "Setting right" "$ok"
else
else
echo_failure "Setting right" "$fail"
exit 1
fi

RESULT=0
${CHOWN} -R $WEB_USER.$WEB_GROUP $TEMP_D/* >> $LOG_FILE 2>> $LOG_FILE
if [ "$?" -eq 0 ] ; then
RESULT=`expr $RESULT + 1`
fi

if [ "$RESULT" -eq 1 ] ; then
echo_success "Setting owner/group" "$ok"
else
else
echo_failure "Setting owner/group" "$fail"
exit 1
fi

RESULT=0
find $TEMP_D -type f -exec ${SED} -i -e 's|@CENTREON_ETC@|'$CENTREON_CONF'|g' \{\} \; 2>> $LOG_FILE
if [ "$?" -eq 0 ] ; then
Expand All @@ -449,11 +449,11 @@ function install_module_web() {

if [ "$RESULT" -eq 1 ] ; then
echo_success "Changing macro" "$ok"
else
else
echo_failure "Changing macro" "$fail"
exit 1
fi

if [ ! -d $INSTALL_DIR_MODULE ] ; then
RESULT=0
${MKDIR} $INSTALL_DIR_MODULE >> $LOG_FILE 2>> $LOG_FILE
Expand All @@ -468,19 +468,19 @@ function install_module_web() {
if [ "$?" -eq 0 ] ; then
RESULT=`expr $RESULT + 1`
fi

if [ "$RESULT" -eq 3 ] ; then
echo_success "Create module directory" "$ok"
else
else
echo_failure "Create module directory" "$fail"
exit 1
fi
fi

${CP} -Rf --preserve $TEMP_D/* $INSTALL_DIR_MODULE >> $LOG_FILE 2>> $LOG_FILE
if [ "$?" -eq 0 ] ; then
echo_success "Copying module" "$ok"
else
else
echo_failure "Copying module" "$fail"
exit 1
fi
Expand All @@ -494,11 +494,11 @@ function install_module_end() {
${RM} -Rf $TEMP_D $TEMP >> $LOG_FILE 2>> $LOG_FILE
if [ "$?" -eq 0 ] ; then
echo_success "Delete temp install directory" "$ok"
else
else
echo_failure "Delete temp install directory" "$fail"
exit 1
fi

echo ""
echo "$line"
echo -e "\tEnd of $RNAME installation"
Expand Down
2 changes: 1 addition & 1 deletion www/modules/centreon-awie/centreon-awie.conf.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2018 Centreon
* Copyright 2018-2019 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
6 changes: 2 additions & 4 deletions www/modules/centreon-awie/class/ClapiObject.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2018 Centreon
* Copyright 2018-2019 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,7 +63,7 @@ private function connectToClapi()

/**
* Export
*
*
* @param $withoutClose disable using of PHP exit function (default: false)
* @return mixed
*/
Expand All @@ -83,6 +83,4 @@ public function import($fileName)
$import = $this->clapiConnector->import($fileName);
return $import;
}


}
11 changes: 4 additions & 7 deletions www/modules/centreon-awie/class/Export.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2018 Centreon
* Copyright 2018-2019 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,7 +39,7 @@ public function __construct($clapiConnector, $dependencyInjector)
$this->tmpName = 'centreon-clapi-export-' . time();
$this->tmpFile = '/tmp/' . $this->tmpName . '.txt';
}

/**
* @param $type
* @return array
Expand Down Expand Up @@ -93,10 +93,7 @@ private function generateInstance($value)
$result = $this->generateObject('ENGINECFG');
$cmdScript['result'] .= $result['result'];
$cmdScript['error'] .= $result['error'];


} elseif (!empty($value['INSTANCE_filter'])) {

$query = 'SELECT `id` FROM `nagios_server` WHERE `name` = "' . $value['INSTANCE_filter'] . '"';
$res = $this->db->query($query);
$pollerId = null;
Expand All @@ -109,7 +106,7 @@ private function generateInstance($value)
$result = $this->generateObject('INSTANCE', $filter);
$cmdScript['result'] = $result['result'];
$cmdScript['error'] = $result['error'];

// check is missed pollerId
if ($pollerId === null) {
return $cmdScript;
Expand Down Expand Up @@ -175,7 +172,7 @@ public function generateGroup($object, $value)
}
}
}

/**
* @param $object
* @param string $filter
Expand Down
2 changes: 1 addition & 1 deletion www/modules/centreon-awie/class/ZipAndDownload.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2018 Centreon
* Copyright 2018-2019 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion www/modules/centreon-awie/core/formExporter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2018 Centreon
* Copyright 2018-2019 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion www/modules/centreon-awie/core/formImporter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2018 Centreon
* Copyright 2018-2019 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion www/modules/centreon-awie/core/generateExport.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2018 Centreon
* Copyright 2018-2019 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion www/modules/centreon-awie/core/js/Export.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Centreon
* Copyright 2018-2019 Centreon
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading