Skip to content

Commit

Permalink
* Remove sudo call for check and optimize centreon engine configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilien Bersoult committed Nov 27, 2014
1 parent 57b4400 commit a6dd914
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/perl/centreon/script/centcore.pm
Expand Up @@ -819,7 +819,7 @@ sub testConfig($) {
my $data = $self->getServerConfig($id);
my $port = checkSSHPort($data->{ssh_port});
my $distantconnexion = $data->{ns_ip_address};
$cmd = "$self->{ssh} -p ".$port." $distantconnexion $self->{sudo} ".$data->{nagios_bin}." -v $cfg_dir/nagios.cfg";
$cmd = "$self->{ssh} -p ".$port." $distantconnexion ".$data->{nagios_bin}." -v $cfg_dir/nagios.cfg";
($lerror, $stdout) = centreon::common::misc::backtick(command => $cmd,
logger => $self->{logger},
timeout => 60
Expand Down
6 changes: 0 additions & 6 deletions libinstall/functions
Expand Up @@ -1299,12 +1299,6 @@ function prepare_sudo_config() {
# Monitoring engine force-reload
CENTREON ALL = NOPASSWD: $MONITORINGENGINE_INIT_SCRIPT* force-reload
CENTREON ALL = NOPASSWD: $MONITORINGENGINE_INIT_SCRIPT force-reload
# Monitoring engine test config
CENTREON ALL = NOPASSWD: $MONITORINGENGINE_BINARY* -v *
CENTREON ALL = NOPASSWD: $MONITORINGENGINE_BINARY -v *
# Monitoring engine test for optim config
CENTREON ALL = NOPASSWD: $MONITORINGENGINE_BINARY* -s *
CENTREON ALL = NOPASSWD: $MONITORINGENGINE_BINARY -s *
# Snmptrapd Restart
CENTREON ALL = NOPASSWD: $INIT_D/snmptrapd restart
# Centreontrapd restart
Expand Down
Expand Up @@ -58,7 +58,7 @@ function printDebug($xml, $tabs)
}
}
foreach ($tab_server as $host) {
$stdout = shell_exec("sudo ".$nagios_bin["nagios_bin"] . " -v ".$nagiosCFGPath.$host["id"]."/nagiosCFG.DEBUG 2>&1");
$stdout = shell_exec($nagios_bin["nagios_bin"] . " -v ".$nagiosCFGPath.$host["id"]."/nagiosCFG.DEBUG 2>&1");
$stdout = htmlentities($stdout);
$msg_debug[$host['id']] = str_replace ("\n", "<br />", $stdout);
$msg_debug[$host['id']] = str_replace ("Warning:", "<font color='orange'>Warning</font>", $msg_debug[$host['id']]);
Expand Down
Expand Up @@ -111,7 +111,7 @@
$DBRESULT_Servers = $pearDB->query("SELECT `id` FROM `nagios_server` WHERE `ns_activate` = '1' ORDER BY `name`");
while ($tab = $DBRESULT_Servers->fetchRow()){
if (isset($ret["host"]) && ($ret["host"] == 0 || $ret["host"] == $tab['id'])){
$stdout = shell_exec("sudo ".$nagios_bin["nagios_bin"] . " -s ".$nagiosCFGPath.$tab['id']."/nagiosCFG.DEBUG");
$stdout = shell_exec($nagios_bin["nagios_bin"] . " -s ".$nagiosCFGPath.$tab['id']."/nagiosCFG.DEBUG");
$stdout = htmlentities($stdout, ENT_QUOTES, "UTF-8");
$msg_optimize[$tab['id']] = str_replace ("\n", "<br />", $stdout);
$cpt++;
Expand All @@ -137,4 +137,4 @@
$tpl->assign('form', $renderer->toArray());
$tpl->assign('o', $o);
$tpl->display("formOptimizeFiles.ihtml");
?>
?>

0 comments on commit a6dd914

Please sign in to comment.