Skip to content

Commit d803c03

Browse files
author
Till Brehm
committed
Merge branch 'nagios-implementation' into 'master'
Nagios implementation Adds compatibility to include nagios or check_mk (nagios add on) data in ispc's monitoring-module. URL must containg /check_mk for cmk-detection to work. This makes OMD (current official cmk setup method) fully compatible. Further oldschool manual CMK-Setups are also working as long as you keep the default /check_mk (if you did not you can add an alias or simply build the correct autologin url on your own and leave login data blank) Further a requirement is that your URL is HTTPS and using the same domain! E.g. ISPC is on panel.example.com you can have monitoring on moni.example.com but not moni.otherdomain.org. This is a browser limitation to iframes. For Check_MK you have to use Cookie Based authentication. This is default since OMD is out... If you did not change yet, blame yourself :) Workaround: manually add Basic Auth data to the URL. I really mean not to support this. Btw: I also plan on building a nagios plugin or some other way to check ISPC's health using Nagios but I need much more time for this so probably this will come as a request for 3.2 then. See merge request !434
2 parents e1a552a + 3daf08e commit d803c03

File tree

15 files changed

+231
-10
lines changed

15 files changed

+231
-10
lines changed

docs/autoinstall_samples/autoinstall.conf_sample.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,14 @@
4949
$autoupdate['ispconfig_port'] = '8080'; // default: 8080
5050
$autoupdate['create_new_ispconfig_ssl_cert'] = 'no'; // no (default), yes
5151
$autoupdate['reconfigure_crontab'] = 'yes'; // yes (default), no
52+
53+
/* These are for service-detection (defaulting to old behaviour where alle changes were automatically accepted) */
54+
$autoupdate['svc_detect_change_mail_server'] = 'yes'; // yes (default), no
55+
$autoupdate['svc_detect_change_web_server'] = 'yes'; // yes (default), no
56+
$autoupdate['svc_detect_change_dns_server'] = 'yes'; // yes (default), no
57+
$autoupdate['svc_detect_change_xmpp_server'] = 'yes'; // yes (default), no
58+
$autoupdate['svc_detect_change_firewall_server'] = 'yes'; // yes (default), no
59+
$autoupdate['svc_detect_change_vserver_server'] = 'yes'; // yes (default), no
60+
$autoupdate['svc_detect_change_db_server'] = 'yes'; // yes (default), no
61+
5262
?>

docs/autoinstall_samples/autoinstall.ini.sample

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,13 @@ reconfigure_permissions_in_master_database=no
4747
reconfigure_services=yes
4848
ispconfig_port=8080
4949
create_new_ispconfig_ssl_cert=no
50-
reconfigure_crontab=yes
50+
reconfigure_crontab=yes
51+
52+
; These are for service-detection (defaulting to old behaviour where alle changes were automatically accepted)
53+
svc_detect_change_mail_server=yes
54+
svc_detect_change_web_server=yes
55+
svc_detect_change_dns_server=yes
56+
svc_detect_change_xmpp_server=yes
57+
svc_detect_change_firewall_server=yes
58+
svc_detect_change_vserver_server=yes
59+
svc_detect_change_db_server=yes

install/lib/update.lib.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,4 +418,22 @@ function setDefaultServers(){
418418

419419
}
420420

421+
422+
423+
/** Checks if a detected service differs from db setup and asks the user what to do
424+
* @param $servicename string the name of the Database-Field in "servers" for this service
425+
* @param $detected_value boolean The result of service detection
426+
*/
427+
function check_service_config_state($servicename, $detected_value) {
428+
global $current_svc_config, $inst, $conf;
429+
430+
if ($current_svc_config[$servicename] == 1) $current_state = 1;
431+
else $current_state = 0;
432+
433+
if ($detected_value != $current_state) {
434+
if ($inst->simple_query('Service \''.$servicename.'\' '.($detected_value ? 'has been' : 'has not been').' detected ('.($current_state ? 'strongly recommended, currently enabled' : 'currently disabled').') do you want to '.($detected_value ? 'enable and configure' : 'disable').' it? ', array('yes', 'no'), ($current_state ? 'yes' : 'no'), 'svc_detect_change_'.$servicename) == 'yes') return $detected_value;
435+
else return $current_state;
436+
} else return $current_state;
437+
}
438+
421439
?>

install/update.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,18 @@
304304
//** Detect the installed applications
305305
$inst->find_installed_apps();
306306

307-
$conf['services']['mail'] = $conf['postfix']['installed'];
308-
if ($conf['powerdns']['installed'] || $conf['bind']['installed'] || $conf['mydns']['installed']) $conf['services']['dns'] = true;
309-
if ($conf['apache']['installed'] || $conf['nginx']['installed']) $conf['services']['web'] = true;
310-
$conf['services']['xmpp'] = $conf['xmpp']['installed'];;
311-
if ($conf['ufw']['installed'] || $conf['firewall']['installed']) $conf['services']['firewall'] = true;
312-
$conf['services']['vserver'] = $conf['services']['vserver'];
307+
//** Check for current service config state and compare to our results
308+
if ($conf['mysql']['master_slave_setup'] == 'y') $current_svc_config = $inst->dbmaster->queryOneRecord("SELECT mail_server,web_server,dns_server,xmpp_server,firewall_server,vserver_server,db_server FROM ?? WHERE server_id=?", $conf['mysql']['master_database'] . '.server', $conf['server_id']);
309+
else $current_svc_config = $inst->db->queryOneRecord("SELECT mail_server,web_server,dns_server,xmpp_server,firewall_server,vserver_server,db_server FROM ?? WHERE server_id=?", $conf["mysql"]["database"] . '.server', $conf['server_id']);
310+
$conf['postfix']['installed'] = check_service_config_state('mail_server', $conf['postfix']['installed']);
311+
$conf['services']['dns'] = check_service_config_state('dns_server', ($conf['powerdns']['installed'] || $conf['bind']['installed'] || $conf['mydns']['installed']));
312+
$conf['services']['web'] = check_service_config_state('web_server', ($conf['apache']['installed'] || $conf['nginx']['installed']));
313+
$conf['services']['xmpp'] = check_service_config_state('xmpp_server', $conf['xmpp']['installed']);
314+
$conf['services']['firewall'] = check_service_config_state('firewall_server', ($conf['ufw']['installed'] || $conf['firewall']['installed']));
315+
$conf['services']['vserver'] = check_service_config_state('vserver_server', $conf['services']['vserver']);
316+
//** vv is this intended??? If you want to check adapt the lines above... vv
313317
$conf['services']['db'] = true;
318+
unset($current_svc_config);
314319

315320

316321
//** Shall the services be reconfigured during update

interface/lib/classes/remoting.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
class remoting {
3838

3939
//* remote session timeout in seconds
40-
private $session_timeout = 600;
40+
private $session_timeout = 1800;
4141

4242
public $oldDataRecord;
4343
public $dataRecord;

interface/web/admin/form/server_config.tform.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,34 @@
357357
'width' => '40',
358358
'maxlength' => '255'
359359
),
360+
'nagios_url' => array(
361+
'datatype' => 'VARCHAR',
362+
'formtype' => 'TEXT',
363+
'default' => '',
364+
'validators' => array ( 0 => array ( 'type' => 'REGEX',
365+
'regex' => '/(^$)|(^((?:http|https)(?::\\/{2}[\\w]+)(?:[\\/|\\.]?)(?:[^\\s"]*))$)/',
366+
'errmsg'=> 'nagios_url_error_regex'),
367+
),
368+
'value' => '',
369+
'width' => '40',
370+
'maxlength' => '255'
371+
),
372+
'nagios_user' => array(
373+
'datatype' => 'VARCHAR',
374+
'formtype' => 'TEXT',
375+
'default' => '',
376+
'value' => '',
377+
'width' => '40',
378+
'maxlength' => '255'
379+
),
380+
'nagios_password' => array(
381+
'datatype' => 'VARCHAR',
382+
'formtype' => 'TEXT',
383+
'default' => '',
384+
'value' => '',
385+
'width' => '40',
386+
'maxlength' => '255'
387+
),
360388
'monitor_system_updates' => array(
361389
'datatype' => 'VARCHAR',
362390
'formtype' => 'CHECKBOX',

interface/web/admin/lib/lang/de_server_config.lng

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ $wb['munin_user_txt'] = 'Munin-Benutzer';
198198
$wb['munin_password_txt'] = 'Munin-Passwort';
199199
$wb['munin_url_error_regex'] = 'Ungültige Munin-URL';
200200
$wb['munin_url_note_txt'] = 'Platzhalter:';
201+
$wb['nagios_url_txt'] = 'Nagios/Check_MK-URL';
202+
$wb['nagios_user_txt'] = 'Nagios/Check_MK-Benutzer';
203+
$wb['nagios_password_txt'] = 'Nagios/Check_MK-Passwort';
204+
$wb['nagios_url_error_regex'] = 'Ungültige Nagios/Check_MK-URL';
205+
$wb['nagios_url_note_txt'] = 'Check_MK wird automatisch erkannt. Platzhalter:';
201206
$wb['backup_dir_is_mount_txt'] = 'Backupverzeichnis ist ein eigener Mount?';
202207
$wb['backup_dir_mount_cmd_txt'] = 'Mount-Befehl, falls Backupverzeichnis nicht gemountet';
203208
$wb['backup_delete_txt'] = 'Backups loeschen wenn eine Domain / Webseite geloescht wird';

interface/web/admin/lib/lang/en_server_config.lng

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ $wb['munin_user_txt'] = 'Munin User';
199199
$wb['munin_password_txt'] = 'Munin Password';
200200
$wb['munin_url_error_regex'] = 'Invalid Munin URL';
201201
$wb['munin_url_note_txt'] = 'Placeholder:';
202+
$wb['nagios_url_txt'] = 'Nagios/Check_MK URL';
203+
$wb['nagios_user_txt'] = 'Nagios/Check_MK User';
204+
$wb['nagios_password_txt'] = 'Nagios/Check_MK Password';
205+
$wb['nagios_url_error_regex'] = 'Invalid Nagios/Check_MK URL';
206+
$wb['nagios_url_note_txt'] = 'Check_MK is being autodetected. Placeholder:';
202207
$wb["v6_prefix_txt"] = 'IPv6 Prefix';
203208
$wb["vhost_rewrite_v6_txt"] = 'Rewrite IPv6 on Mirror';
204209
$wb["v6_prefix_length"] = 'Prefix too long according to defined IPv6 ';

interface/web/admin/templates/server_config_server_edit.htm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ <h1><tmpl_var name="list_head_txt"></h1>
9696
<label for="munin_password" class="col-sm-3 control-label">{tmpl_var name='munin_password_txt'}</label>
9797
<div class="col-sm-9"><input type="text" name="munin_password" id="munin_password" value="{tmpl_var name='munin_password'}" class="form-control" /></div></div>
9898
<div class="form-group">
99+
<label for="nagios_url" class="col-sm-3 control-label">{tmpl_var name='nagios_url_txt'}</label>
100+
<div class="col-sm-6"><input type="text" name="nagios_url" id="nagios_url" value="{tmpl_var name='nagios_url'}" class="form-control" />&nbsp;{tmpl_var name='nagios_url_note_txt'} <a href="javascript:void(0);" class="addPlaceholder">[SERVERNAME]</a></div>
101+
</div>
102+
<div class="form-group">
103+
<label for="nagios_user" class="col-sm-3 control-label">{tmpl_var name='nagios_user_txt'}</label>
104+
<div class="col-sm-9"><input type="text" name="nagios_user" id="nagios_user" value="{tmpl_var name='nagios_user'}" class="form-control" /></div></div>
105+
<div class="form-group">
106+
<label for="nagios_password" class="col-sm-3 control-label">{tmpl_var name='nagios_password_txt'}</label>
107+
<div class="col-sm-9"><input type="text" name="nagios_password" id="nagios_password" value="{tmpl_var name='nagios_password'}" class="form-control" /></div></div>
108+
<div class="form-group">
99109
<label class="col-sm-3 control-label">{tmpl_var name='monitor_system_updates_txt'}</label>
100110
<div class="col-sm-9">
101111
{tmpl_var name='monitor_system_updates'}

interface/web/monitor/lib/lang/de.lng

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ $wb['no_permissions_to_view_monit_txt'] = 'Sie haben nicht die Berechtigung, auf
155155
$wb['Show Munin'] = 'Munin anzeigen';
156156
$wb['no_munin_url_defined_txt'] = 'Keine Munin-URL definiert.';
157157
$wb['no_permissions_to_view_munin_txt'] = 'Sie haben nicht die Berechtigung, auf Munin zuzugreifen.';
158+
$wb['Show Nagios/Check_MK'] = 'Nagios/Check_MK anzeigen';
159+
$wb['no_nagios_url_defined_txt'] = 'Keine Nagios-URL definiert.';
160+
$wb['no_permissions_to_view_nagios_txt'] = 'Sie haben nicht die Berechtigung, auf Nagios bzw. Check_MK zuzugreifen.';
161+
$wb['go_to_nagios_txt'] = 'Diese Anzeige in einem eigenen Fenster öffnen';
158162
$wb['no_data_database_size_txt'] = 'Derzeit stehen keine Daten über die Speicherverbrauch der Datenbanken zur Verfügung. Bitte später erneut Ãrüfen..';
159163
$wb['monitor_database_name_txt'] = 'Database';
160164
$wb['monitor_database_size_txt'] = 'Size';

0 commit comments

Comments
 (0)