Skip to content
Snippets Groups Projects
Commit 8cad7837 authored by Till Brehm's avatar Till Brehm
Browse files

Merge branch 'stable-3.1' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.1

parents 404c7293 17d53616
No related branches found
No related tags found
No related merge requests found
......@@ -17,12 +17,14 @@
{tmpl_var name='do_not_try_rescue_httpd'}
</div>
</div>
<!--
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='do_not_try_rescue_mongodb_txt'}</label>
<div class="col-sm-9">
{tmpl_var name='do_not_try_rescue_mongodb'}
</div>
</div>
-->
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='do_not_try_rescue_mysql_txt'}</label>
<div class="col-sm-9">
......
......@@ -196,11 +196,12 @@ $items[] = array( 'title' => "Show fail2ban-Log",
'link' => 'monitor/show_data.php?type=fail2ban',
'html_id' => 'fai2ban');
/*
$items[] = array( 'title' => "Show MongoDB-Log",
'target' => 'content',
'link' => 'monitor/show_data.php?type=mongodb',
'html_id' => 'mongodb');
*/
$items[] = array( 'title' => "Show IPTables",
'target' => 'content',
'link' => 'monitor/show_data.php?type=iptables',
......
......@@ -138,6 +138,7 @@ case 'fail2ban':
$description = '';
$add_padding = true;
break;
/*
case 'mongodb':
$template = 'templates/show_data.htm';
$output .= $app->tools_monitor->showMongoDB();
......@@ -145,6 +146,7 @@ case 'mongodb':
$title = $app->lng("monitor_title_mongodb_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
$description = '';
break;
*/
case 'iptables':
$template = 'templates/show_data.htm';
$output .= $app->tools_monitor->showIPTables();
......
......@@ -169,10 +169,11 @@ class page_action extends tform_actions {
/* prepare password for MongoDB */
// TODO: this still doens't work as when only the username changes we have no database_password.
// taking the one from oldData doesn't work as it's encrypted...shit!
/*
$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
$this->dataRecord['server_id'] = 0; // we need this on all servers
*/
parent::onBeforeUpdate();
}
......@@ -206,7 +207,7 @@ class page_action extends tform_actions {
$this->dataRecord['server_id'] = 0; // we need this on all servers
/* prepare password for MongoDB */
$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
// $this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
parent::onBeforeInsert();
}
......
......@@ -370,14 +370,16 @@ class monitor_tools {
$state = 'error'; // because service is down
}
}
/*
$data['mongodbserver'] = -1;
if ($this->_checkTcp('localhost', 27017)) {
$data['mongodbserver'] = 1;
} else {
$data['mongodbserver'] = 0;
*/
//$state = 'error'; // because service is down
/* TODO!!! check if this is a mongodbserver at all, otherwise it will always throw an error state!!! */
}
// }
/*
* Return the Result
......
......@@ -97,7 +97,7 @@ class rescue_core_module {
/*
* rescue MongoDB if needed
*/
$this->_rescueMongoDB();
// $this->_rescueMongoDB();
/*
* rescue mysql if needed (maybe httpd depends on mysql, so try this first!)
......@@ -311,42 +311,43 @@ class rescue_core_module {
$this->_rescueDaemon($daemon);
}
/**
* restarts MongoDB, if needed
*/
private function _rescueMongoDB(){
global $app, $conf;
// private function _rescueMongoDB(){
// global $app, $conf;
/*
* do nothing, if it is not allowed to rescue mysql
*/
if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) == 'y')){
return;
}
// if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_mongodb']) == 'y')){
// return;
// }
/*
* if the service is up and running, or the service is not installed there is nothing to do...
*/
if ($this->_monitoringData[0][0]['data']['mongodbserver'] != 0){
/* Clear the try counter, because we do not have to try to rescue the service */
$this->_rescueData['mongodbserver']['try_counter'] = 0;
return;
}
// if ($this->_monitoringData[0][0]['data']['mongodbserver'] != 0){
// /* Clear the try counter, because we do not have to try to rescue the service */
// $this->_rescueData['mongodbserver']['try_counter'] = 0;
// return;
// }
/*
* OK, the service is installed and down.
* Maybe this is because of a restart of the service by the admin.
* This means, we check the data 1 minute ago
*/
if ((!isset($this->_monitoringData[1][0]['data']['mongodbserver'])) ||
((isset($this->_monitoringData[1][0]['data']['mongodbserver'])) && ($this->_monitoringData[1][0]['data']['mongodbserver'] != 0))){
// if ((!isset($this->_monitoringData[1][0]['data']['mongodbserver'])) ||
// ((isset($this->_monitoringData[1][0]['data']['mongodbserver'])) && ($this->_monitoringData[1][0]['data']['mongodbserver'] != 0))){
/*
* We do NOT have this data or we have this data, but the webserver was not down 1 minute ago.
* This means, it could be, that the admin is restarting the server.
* We wait one more minute...
*/
return;
}
// return;
// }
/*#####
* The service is down and it was down 1 minute ago.
......@@ -354,28 +355,28 @@ class rescue_core_module {
*#####*/
/* Get the try counter */
$tryCount = (!isset($this->_rescueData['mongodbserver']['try_counter']))? 1 : $this->_rescueData['mongodbserver']['try_counter'] + 1;
// $tryCount = (!isset($this->_rescueData['mongodbserver']['try_counter']))? 1 : $this->_rescueData['mongodbserver']['try_counter'] + 1;
/* Set the new try counter */
$this->_rescueData['mongodbserver']['try_counter'] = $tryCount;
// $this->_rescueData['mongodbserver']['try_counter'] = $tryCount;
/* if 5 times will not work, we have to give up... */
if ($tryCount > 5){
$app->log('MongoDB is down! Rescue will not help!', LOGLEVEL_ERROR);
return;
}
// if ($tryCount > 5){
// $app->log('MongoDB is down! Rescue will not help!', LOGLEVEL_ERROR);
// return;
// }
$app->log('MongoDB is down! Try rescue MongoDB (try:' . $tryCount . ')...', LOGLEVEL_WARN);
// $app->log('MongoDB is down! Try rescue MongoDB (try:' . $tryCount . ')...', LOGLEVEL_WARN);
if(is_file($conf['init_scripts'] . '/' . 'mongodb')) {
$daemon = 'mongodb';
} else {
$daemon = 'mongodb';
}
// if(is_file($conf['init_scripts'] . '/' . 'mongodb')) {
// $daemon = 'mongodb';
// } else {
// $daemon = 'mongodb';
// }
$this->_rescueDaemon($daemon);
}
// $this->_rescueDaemon($daemon);
// }
/**
* restarts mysql, if needed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment