branch develop updated (9af4a08 -> ce0339e)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository mum. See http://git.chorem.org/mum.git from 9af4a08 surcharge des modules de monitoring new e90937d champ 'global_conf' maintenant présent dans la bdd. le contenu est initialisé au lancement de l'appli selon les modules chargés new ce0339e global_conf: affichage des modules par block et changement de conf possible The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit ce0339efd7a35d377b6d1c2df1c279d2c1ae9e7d Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 2 10:24:21 2015 +0200 global_conf: affichage des modules par block et changement de conf possible commit e90937d482b0f16f55e538c52eddc1dd8dcaaf1a Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Apr 1 16:00:43 2015 +0200 champ 'global_conf' maintenant présent dans la bdd. le contenu est initialisé au lancement de l'appli selon les modules chargés Summary of changes: app/modules/monitoring_modules/ping.py | 4 +- app/modules/storage_modules/shelve_db.py | 204 +++++++++++++++---------------- app/mum.py | 1 + app/process_monitoring.py | 8 +- static/js/controllers/groupCtrl.js | 4 +- static/js/controllers/hostPageCtrl.js | 10 +- static/js/controllers/settingsCtrl.js | 106 +++++++++++++++- views/index.html | 1 + views/settings.html | 200 ++++++++++-------------------- 9 files changed, 286 insertions(+), 252 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit e90937d482b0f16f55e538c52eddc1dd8dcaaf1a Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed Apr 1 16:00:43 2015 +0200 champ 'global_conf' maintenant présent dans la bdd. le contenu est initialisé au lancement de l'appli selon les modules chargés --- app/modules/monitoring_modules/ping.py | 4 +- app/modules/storage_modules/shelve_db.py | 167 +++++++++++-------------------- app/mum.py | 1 + 3 files changed, 62 insertions(+), 110 deletions(-) diff --git a/app/modules/monitoring_modules/ping.py b/app/modules/monitoring_modules/ping.py index 6fbea01..053310f 100644 --- a/app/modules/monitoring_modules/ping.py +++ b/app/modules/monitoring_modules/ping.py @@ -3,8 +3,8 @@ __author__ = 'aguilbaud' import pexpect -compatible_os = [] -block = "" +compatible_os = ["all"] +block = "network" unit = "bool" diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 42aac7a..710abbf 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -32,6 +32,7 @@ class shelve_db: self.db["hosts"] = {} self.db["users"] = {} self.db["groups"] = {} + self.db["global_conf"] = {} except: print "Database initilalization error" else: @@ -44,6 +45,59 @@ class shelve_db: self.db.close() self.db = None + def init_global_conf(self, loaded_mod_moni): + """ + This method is executed once at each launch of the application (see ModuleLoader constructor). + It creates an entrey on db['global_conf'] for each loaded monitoring module. + If an entry exists for a non loaded module, it will be removed. + :param loaded_mod_moni: a dictionary containing : + { + mod_name: + { + 'class_name': string, => the name of the class to instanciate + 'compatible_os': [string1, string2, ...], => a list containing the compatibles os + 'unit': string, => the unit type of return ('%', 'bool' or other) + 'block': string, => the monitoring block of the module + 'external': bool => indicates if this modules comes from external directory + } + } + """ + self.open_db() + try: + for mod in loaded_mod_moni: + if mod not in self.db['global_conf']: # adding a entry for every module loaded for the first time + mod_conf = {} + mod_conf['block'] = loaded_mod_moni[mod]['block'] + mod_conf['activated'] = mod == 'ping' # we want the ping module to be activated by default + mod_conf['check_frequency'] = 60 + """ + mod_conf['nb_minute'] = 30 + mod_conf['nb_hour'] = 12 + mod_conf['nb_day'] = 15 + mod_conf['nb_week'] = 2 + mod_conf['nb_month'] = 6 + mod_conf['nb_year'] = None + """ + unit = loaded_mod_moni[mod]['unit'] + mod_conf['unit'] = unit + if unit == '%': + mod_conf['minor_limit'] = 95 + mod_conf['major_limit'] = 100 + elif unit == 'bool': + mod_conf['minor_limit'] = True + mod_conf['major_limit'] = False + else: + mod_conf['minor_limit'] = 8 + mod_conf['major_limit'] = 10 + self.db['global_conf'][mod] = mod_conf + for mod in self.db['global_conf']: # removing entries of modules that are non loaded anymore + if mod not in loaded_mod_moni: + del self.db['global_conf'][mod] + except Exception: + print traceback.format_exc() + finally: + self.close_db() + def add_host(self, addr_host, nmap_res, list_mod_conn, dict_mod_info): """ Called by the nmap_detection module. @@ -68,9 +122,11 @@ class shelve_db: self.db["hosts"][addr_host]["conf"] = {} nmap_res_data = json.loads(nmap_res) self.db["hosts"][addr_host]["conf"]["connections"] = self.init_conn(nmap_res_data, list_mod_conn) - self.db["hosts"][addr_host]["conf"]["monitoring"] = self.generate_global_conf(dict_mod_info, - addr_host, - nmap_res_data['os']) + os_host = nmap_res_data['os'] + self.db["hosts"][addr_host]["conf"]["monitoring"] = {} + for mod in dict_mod_info: + if os_host in dict_mod_info[mod]['compatible_os'] or 'all' in dict_mod_info[mod]['compatible_os']: + self.db["hosts"][addr_host]["conf"]["monitoring"][mod] = self.db['global_conf'][mod] self.db["hosts"][addr_host]["conf"]["groups"] = ["all"] # Every host is in group "all" self.db["hosts"][addr_host]["conf"]["subscribers"] = {} # Add current user automatically ? self.db["hosts"][addr_host]["conf"]["custom_info"] = "" @@ -110,111 +166,6 @@ class shelve_db: dict_conn[port["portname"]][param] = None return dict_conn - def generate_global_conf(self, dict_mod_info, addr_host, os_host): - """ - Configures automatically the monitoring for a host for each of the monitoring modules avaliable, in - function of the unit of the result of the monitoring module. - By default, only the ping monitoring is activated, while the connection is not configured and tje os not - detected - :param dict_mod_info: dictionary containing informations about all notification modules, in the form: - { - mod_name: - { - 'class_name': string, => the name of the class to instanciate - 'compatible_os': [string1, string2, ...], => a list containing the compatibles os - 'unit': string, => the unit type of return ('%', 'bool' or other) - 'block': string, => the monitoring block of the module - 'external': bool => indicates if this modules comes from external directory - } - } - :return a list containing the default parameters for each monitoring module (at least ping) - """ - res = {} - # creating the configuration for all modules compatibles - if not self.db["hosts"][addr_host]["conf"]["connections"] == {} and not os_host == 'unknown': - for mod in dict_mod_info: - if os_host in dict_mod_info[mod]['compatible_os']: - mod_conf = {} - mod_conf['block'] = dict_mod_info[mod]['block'] - mod_conf['activated'] = False - mod_conf['check_frequency'] = 60 - mod_conf['nb_minute'] = 30 - mod_conf['nb_hour'] = 12 - mod_conf['nb_day'] = 15 - mod_conf['nb_week'] = 2 - mod_conf['nb_month'] = 6 - mod_conf['nb_year'] = None - unit = dict_mod_info[mod]['unit'] - mod_conf['unit'] = unit - if unit == '%': - mod_conf['minor_limit'] = 80 - mod_conf['major_limit'] = 95 - elif unit == 'bool': - mod_conf['minor_limit'] = True - mod_conf['major_limit'] = False - else: - mod_conf['minor_limit'] = 8 - mod_conf['major_limit'] = 10 - res[mod] = mod_conf - # configure for ping monitoring in any case - ping_conf = {} - ping_conf['block'] = 'network' - ping_conf['activated'] = True - ping_conf['check_frequency'] = 60 - ping_conf['nb_minute'] = 30 - ping_conf['nb_hour'] = 12 - ping_conf['nb_day'] = 15 - ping_conf['nb_week'] = 2 - ping_conf['nb_month'] = 6 - ping_conf['nb_year'] = None - ping_conf['unit'] = 'bool' - ping_conf['minor_limit'] = False - ping_conf['major_limit'] = True - res['ping'] = ping_conf - return res - - def generate_unique_conf(self, dict_mod_info, addr_host, mod_name, activated): - """ - Configures automatically the monitoring for a host for each of the monitoring modules avaliable, in - function of the unit of the result of the monitoring module. - By default, only the ping monitoring is activated, while the connection is not configured and tje os not - detected - :param dict_mod_info: dictionary containing informations about all notification modules, in the form: - { - mod_name: - { - 'class_name': string, => the name of the class to instanciate - 'compatible_os': [string1, string2, ...], => a list containing the compatibles os - 'unit': string, => the unit type of return ('%', 'bool' or other) - 'block': string, => the monitoring block of the module - 'external': bool => indicates if this modules comes from external directory - } - } - :return a list containing the default parameters for each monitoring module (at least ping) - """ - mod_conf = {} - mod_conf['block'] = dict_mod_info[mod_name]['block'] - mod_conf['activated'] = activated - mod_conf['check_frequency'] = 60 - mod_conf['nb_minute'] = 30 - mod_conf['nb_hour'] = 12 - mod_conf['nb_day'] = 15 - mod_conf['nb_week'] = 2 - mod_conf['nb_month'] = 6 - mod_conf['nb_year'] = None - unit = dict_mod_info[mod_name]['unit'] - mod_conf['unit'] = unit - if unit == '%': - mod_conf['minor_limit'] = 95 - mod_conf['major_limit'] = 100 - elif unit == 'bool': - mod_conf['minor_limit'] = True - mod_conf['major_limit'] = False - else: - mod_conf['minor_limit'] = 8 - mod_conf['major_limit'] = 10 - self.db["hosts"][addr_host]["conf"]["monitoring"][mod_name] = mod_conf - def get_conn_param(self, args): """ Returns the connection parameters of an host. diff --git a/app/mum.py b/app/mum.py index eaf1e25..fee7382 100755 --- a/app/mum.py +++ b/app/mum.py @@ -224,6 +224,7 @@ if __name__ == '__main__': ml.load_all_connection_modules() ml.load_all_detection_modules() ml.load_all_notification_modules() + ml.get_db().init_global_conf(ml.get_monitoring_modules_list()) wsc = WebSocketContainer(ml.get_db()) #dict_notif = ml.db.add_check('127.0.0.1', "ping", False) #ml.run_notification_modules(dict_notif) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit ce0339efd7a35d377b6d1c2df1c279d2c1ae9e7d Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 2 10:24:21 2015 +0200 global_conf: affichage des modules par block et changement de conf possible --- app/modules/storage_modules/shelve_db.py | 43 ++++++- app/process_monitoring.py | 8 +- static/js/controllers/groupCtrl.js | 4 +- static/js/controllers/hostPageCtrl.js | 10 +- static/js/controllers/settingsCtrl.js | 106 +++++++++++++++- views/index.html | 1 + views/settings.html | 200 +++++++++++-------------------- 7 files changed, 227 insertions(+), 145 deletions(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 710abbf..a6c465a 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -47,7 +47,7 @@ class shelve_db: def init_global_conf(self, loaded_mod_moni): """ - This method is executed once at each launch of the application (see ModuleLoader constructor). + This method is executed once at each launch of the application. It creates an entrey on db['global_conf'] for each loaded monitoring module. If an entry exists for a non loaded module, it will be removed. :param loaded_mod_moni: a dictionary containing : @@ -84,8 +84,8 @@ class shelve_db: mod_conf['minor_limit'] = 95 mod_conf['major_limit'] = 100 elif unit == 'bool': - mod_conf['minor_limit'] = True - mod_conf['major_limit'] = False + mod_conf['minor_limit'] = False + mod_conf['major_limit'] = True else: mod_conf['minor_limit'] = 8 mod_conf['major_limit'] = 10 @@ -98,6 +98,43 @@ class shelve_db: finally: self.close_db() + def get_global_settings(self, args): + """ + Asked from the global settings configuration page. + :param args: null (for dynamic call) + :return: the content of db['global_conf'] + """ + res = {} + self.open_db() + try: + res = self.db['global_conf'] + except Exception: + print traceback.format_exc() + finally: + self.close_db() + return res + + def set_global_settings(self, args): + """ + Asked from the global settings configuration page. Updates the default configuration of a monitoring module. + :param args: A dictionnary containing : + { + 'mod_name': str, + 'minor_limit': val, + 'major_limit': val, + 'freq': int + } + """ + self.open_db() + try: + self.db['global_conf'][args['mod_name']]['minor_limit'] = args['minor_limit'] + self.db['global_conf'][args['mod_name']]['major_limit'] = args['major_limit'] + self.db['global_conf'][args['mod_name']]['check_frequency'] = args['freq'] + except Exception: + print traceback.format_exc() + finally: + self.close_db() + def add_host(self, addr_host, nmap_res, list_mod_conn, dict_mod_info): """ Called by the nmap_detection module. diff --git a/app/process_monitoring.py b/app/process_monitoring.py index bfe6076..42faa61 100644 --- a/app/process_monitoring.py +++ b/app/process_monitoring.py @@ -81,14 +81,20 @@ def add_to_waiting_list(dict_mod): def remove_to_waiting_list(addr_host, modname): global waiting_list - for i in range(len(waiting_list)): + i = 0 + while i < len(waiting_list): + print 'size: ' + str(len(waiting_list)) + print 'i: ' + str(i) if waiting_list[i]['addr'] == addr_host: if modname is None: # it was asked to remove all entries of this host waiting_list.pop(i) + i -= 1 elif waiting_list[i]['mod_name'] == modname: # we remove only the necessary module from the list waiting_list.pop(i) + i -= 1 + i += 1 def update_mod_on_waiting_list(new_conf): diff --git a/static/js/controllers/groupCtrl.js b/static/js/controllers/groupCtrl.js index eae2023..fb2e031 100644 --- a/static/js/controllers/groupCtrl.js +++ b/static/js/controllers/groupCtrl.js @@ -66,7 +66,7 @@ mumApp.controller('groupCtrl', function($scope, $rootScope, $filter, $route, $ro } } } - } + }; $scope.checkAll = function(bool){ $scope.selectedAll = bool; @@ -93,7 +93,7 @@ mumApp.controller('groupCtrl', function($scope, $rootScope, $filter, $route, $ro $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'remove_host_list_to_group','args': args}})); $route.reload(); - } + }; $scope.open_modal_group = function () { var modalInstance = $modal.open({ diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 809517b..7f1a9eb 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -40,7 +40,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar args['addr_host'] = $scope.addr_host; args['new_os_name'] = $scope.model.new_os; $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'update_os_name', 'args': args}})); - } + }; $scope.$on("resCall", function (event, args) { if(args.func == 'update_os_name'){ @@ -75,7 +75,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar $scope.launch_detection = function(){ $rootScope.$broadcast("sendViaWs", JSON.stringify({"LAUNCH_FULL_DETECTION": $scope.addr_host})); - } + }; // receiving the host informations $scope.$on("hostInfos", function (event, args) { @@ -109,7 +109,7 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar var args = {}; args['addr_host'] = $scope.addr_host; $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'remove_host', 'args': args}})); - } + }; // creation of modals $scope.open_modal_conf = function (mod_name) { @@ -291,7 +291,7 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI } }*/ return res; - } + }; $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_conn_param','args': {'addr_host': $scope.conn_args['addr_host']}}})); @@ -316,7 +316,7 @@ mumApp.controller('ModalConnInstanceCtrl', function ($scope, $rootScope, $modalI args['addr_host'] = $scope.conn_args["addr_host"]; args['conn_mod_name'] = connModName; $rootScope.$broadcast("sendViaWs", JSON.stringify({"TEST_CONN": args})); - } + }; $scope.ok = function () { var args = {}; diff --git a/static/js/controllers/settingsCtrl.js b/static/js/controllers/settingsCtrl.js index f548909..6e06a8f 100644 --- a/static/js/controllers/settingsCtrl.js +++ b/static/js/controllers/settingsCtrl.js @@ -1,3 +1,107 @@ -mumApp.controller('settingsCtrl', function($scope, $rootScope) { +mumApp.controller('settingsCtrl', function($scope, $rootScope, $modal) { + $scope.settings = {}; // { mod_name: {'check_frequency': 60, 'minor_limit': True, 'activated': False, 'major_limit': False, 'block': 'software', 'unit': 'bool'}} + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'get_global_settings','args': null}})); + + $scope.$on("resCall", function (event, args) { + if(args.func == 'get_global_settings'){ + $scope.$apply(function(){ + $scope.settings = args.res; + }); + } + }); + + $scope.all_blocks = function(){ + var res = []; + for(mod in $scope.settings){ + if(res.indexOf($scope.settings[mod]['block']) < 0){ // if the block is not in the res tab + res[res.length] = $scope.settings[mod].block; + } + } + return res; + }; + + $scope.all_mod_by_block = function(block){ + var res = {}; + for(mod in $scope.settings){ + if($scope.settings[mod]['block'] == block){ + res[mod] = $scope.settings[mod]; + } + } + return res; + }; + + $scope.open_modal_global_conf = function (mod_name) { + var modalInstance = $modal.open({ + templateUrl: 'modal_global_conf_label.html', + controller: 'ModalGlobalConfInstanceCtrl', + resolve: { + global_conf_args: function(){ + return {'conf_mod': $scope.settings[mod_name], 'mod_name': mod_name}; + } + } + }); + }; +}); + +mumApp.controller('ModalGlobalConfInstanceCtrl', function ($scope, $rootScope, $modalInstance, $route, global_conf_args) { + $scope.global_conf_args = global_conf_args; /* { 'mod_name': str, + 'conf_mod': {'check_frequency': 60, 'minor_limit': True, 'activated': False, 'major_limit': False, 'block': 'software', 'unit': 'bool'}} + } + */ + // init fields + $scope.freq_days = Math.floor(global_conf_args.conf_mod.check_frequency / 86400); + $scope.freq_hours = Math.floor((global_conf_args.conf_mod.check_frequency - $scope.freq_days * 86400) / 3600); + $scope.freq_minutes = Math.floor((global_conf_args.conf_mod.check_frequency - ($scope.freq_days * 86400) - ($scope.freq_hours * 3600)) / 60) + + $scope.minor_limit_percent = 0; + $scope.major_limit_percent = 0; + + $scope.minor_limit_unit = 0; + $scope.major_limit_unit = 0; + + $scope.limit_bool = 'minor'; + + if($scope.global_conf_args.conf_mod.unit == 'bool'){ + if($scope.global_conf_args.conf_mod.major_limit){ + $scope.limit_bool = 'major'; + } + } + else if($scope.global_conf_args.conf_mod.unit == '%'){ + $scope.minor_limit_percent = $scope.global_conf_args.conf_mod.minor_limit; + $scope.major_limit_percent = $scope.global_conf_args.conf_mod.major_limit; + } + else{ + $scope.minor_limit_unit = $scope.global_conf_args.conf_mod.minor_limit; + $scope.major_limit_unit = $scope.global_conf_args.conf_mod.major_limit; + } + + // after validation + $scope.ok = function () { + var args = {}; + args.mod_name = $scope.global_conf_args.mod_name; + args.freq = 86400 * $scope.freq_days + 3600 * $scope.freq_hours + 60 * $scope.freq_minutes; + if($scope.global_conf_args.conf_mod.unit == 'bool'){ + args.minor_limit = ($scope.limit_bool == 'minor'); + args.major_limit = ($scope.limit_bool == 'major'); + } + else if($scope.global_conf_args.conf_mod.unit == '%'){ + args.minor_limit = $scope.minor_limit_percent; + args.major_limit = $scope.major_limit_percent; + } + else{ + args.minor_limit = $scope.minor_limit_unit; + args.major_limit = $scope.major_limit_unit; + } + + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'set_global_settings','args': args}})); + + $modalInstance.close(); + + $route.reload(); + }; + + $scope.cancel = function () { + $modalInstance.close(); + }; }); \ No newline at end of file diff --git a/views/index.html b/views/index.html index 13335ff..d6d5448 100644 --- a/views/index.html +++ b/views/index.html @@ -34,6 +34,7 @@ <script src="static/js/controllers/notificationsCtrl.js"></script> <script src="static/js/controllers/profileCtrl.js"></script> <script src="static/js/controllers/scanCtrl.js"></script> + <script src="static/js/controllers/settingsCtrl.js"></script> <script src="static/js/controllers/usersCtrl.js"></script> diff --git a/views/settings.html b/views/settings.html index bfcd86a..d910116 100644 --- a/views/settings.html +++ b/views/settings.html @@ -1,145 +1,79 @@ <div class="col-md-offset-2 main"> <h1 class="page-header">Configure the default settings</h1> - <!--<h2 class="sub-header">They will be applied on each new host you will add.</h2>--> - <form> - <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> - <div class="panel panel-default"> - <div class="panel-heading" role="tab" id="headingOne"> - <h4 class="panel-title"> - <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="false" aria-controls="collapseOne"> - Hardware - </a> - </h4> - </div> - <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne"> - <div class="panel-body"> - <h3>CPU</h3> - <div class="row"> - <div class="col-xs-2"> - <label for="cpu_freq">Frequency check</label> - <input type="text" class="form-control" id="cpu_freq" placeholder="d:hh:mm"> - </div> - <div class="col-xs-4"> - <label for="cpu_val1">Minor notification at {{cpu_warn}}% of charge</label> - <input type="range" name="cpu_warn" min="0" max="99" id="cpu_val1" ng-model="cpu_warn"> - </div> - <div class="col-xs-4"> - <label for="cpu_val2">Major notification at {{cpu_danger}}% of charge</label> - <input type="range" name="cpu_danger" min="{{cpu_warn}}" max="100" id="cpu_val2" ng-model="cpu_danger"> - </div> - </div> - <h3>Drive</h3> - <div class="row"> - <div class="col-xs-2"> - <label for="drive_freq">Frequency check</label> - <input type="text" class="form-control" id="drive_freq" placeholder="d:hh:mm"> - </div> - <div class="col-xs-4"> - <label for="drive_val1">Minor notification at {{drive_warn}}% of charge</label> - <input type="range" name="cpu_warn" min="0" max="99" id="drive_val1" ng-model="drive_warn"> - </div> - <div class="col-xs-4"> - <label for="drive_val2">Major notification at {{drive_danger}}% of charge</label> - <input type="range" name="drive_danger" min="{{drive_warn}}" max="100" id="drive_val2" ng-model="drive_danger"> - </div> - </div> - </div> - </div> - </div> - <div class="panel panel-default"> - <div class="panel-heading" role="tab" id="headingTwo"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo"> - Network - </a> - </h4> - </div> - <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo"> - <div class="panel-body"> - <h3>HTTP</h3> - <div class="row"> - <div class="col-xs-2"> - <label for="http_freq">Frequency check</label> - <input type="text" class="form-control" id="http_freq" placeholder="d:hh:mm"> - </div> - <div class="col-xs-3"> - <label for="http_crit_1">If down, send a </label> - <div class="radio"> - <label> - <input type="radio" name="http_crit" id="http_crit_1" value="warning" checked> - minor notification - </label> - </div> - <div class="radio"> - <label> - <input type="radio" name="http_crit" id="http_crit_2" value="danger"> - major notification - </label> - </div> - </div> - </div> + {{settings}} + <accordion close-others="false"> + <accordion-group heading="{{block}}" ng-repeat="block in all_blocks()"> + <div class="row" ng-repeat="(modname, mod) in settings" + ng-show="mod.block == block"> + <a ng-click="open_modal_global_conf(modname)">{{modname}}</a> + </div> + </accordion-group> + </accordion> + </div> - <h3>SMTP</h3> - <div class="row"> - <div class="col-xs-2"> - <label for="smtp_freq">Frequency check</label> - <input type="text" class="form-control" id="smtp_freq" placeholder="d:hh:mm"> - </div> - <div class="col-xs-3"> - <label for="smtp_crit_1">If down, send a </label> - <div class="radio"> - <label> - <input type="radio" name="smtp_crit" id="smtp_crit_1" value="warning" checked> - minor notification - </label> - </div> - <div class="radio"> - <label> - <input type="radio" name="smtp_crit" id="smtp_crit_2" value="danger"> - major notification - </label> - </div> - </div> - </div> + <script type="text/ng-template" id="modal_global_conf_label.html"> + <div class="modal-header"> + <h3 class="modal-title">Configure {{global_conf_args.mod_name}}</h3> + </div> + <div class="modal-body"> + <form> + <div class="form-group"> + <p>The parameters here will be automatically applied for each host you will add in the future.</p> + <label for="freq">Frequency check: each</label> + <div class="row" id="freq"> + <div class="col-xs-2"> + <input type="number" min="0" class="form-control" + ng-model="freq_days"> days + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="23" class="form-control" + ng-model="freq_hours"> hours + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="59" class="form-control" + ng-model="freq_minutes"> minutes </div> - - </div> - </div> - - <div class="panel panel-default"> - <div class="panel-heading" role="tab" id="headingThree"> - <h4 class="panel-title"> - <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="true" aria-controls="collapseThree"> - Software - </a> - </h4> + <div ng-show="global_conf_args.conf_mod.unit == '%'"> + <label for="minor_%">Minor notification at {{minor_limit_percent}}% of charge</label> + <input type="range" min="0" max="99" id="minor_%" + ng-model="minor_limit_percent"> + <label for="major_%">Major notification at {{major_limit_percent}}% of charge</label> + <input type="range" min="{{minor_limit_percent}}" max="100" id="major_%" + ng-model="major_limit_percent"> </div> - <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree"> - <div class="panel-body"> - <h3>Packages updated</h3> - <div class="row"> - <div class="col-xs-2"> - <label for="pack_freq">Frequency check</label> - <input type="text" class="form-control" id="pack_freq" placeholder="d:hh:mm"> - </div> - <div class="col-xs-4"> - <label for="min_pack">Minor notif at (non updated)</label> - <input type="number" class="form-control" id="min_pack" min="0" placeholder="5"> - </div> - <div class="col-xs-4"> - <label for="maj_pack">Major notif at (non updated)</label> - <input type="number" class="form-control" id="maj_pack" min="0" placeholder="20"> - </div> - </div> + <div ng-show="global_conf_args.conf_mod.unit == 'bool'"> + <label for="minor_bool">If down, send a </label> + <div class="radio"> + <label> + <input type="radio" id="minor_bool" value="minor" ng-model="limit_bool"> + minor notification + </label> + </div> + <div class="radio"> + <label> + <input type="radio" id="major_bool" value="major" ng-model="limit_bool"> + major notification + </label> </div> </div> + <div ng-show="global_conf_args.conf_mod.unit != '%' && global_conf_args.conf_mod.unit != 'bool'"> + <label for="minor_unit">Minor notif at {{minor_limit_unit}}</label> + <input type="number" class="form-control" id="minor_unit" min="0" + ng-model="minor_limit_unit"> + <label for="maj_pack">Major notif at {{major_limit_unit}}</label> + <input type="number" class="form-control" id="maj_pack" min="0" + ng-model="major_limit_unit"> + </div> </div> - </div> - <button type="button" class="btn btn-default">Discard changes</button> - <button type="button" class="btn btn-primary">Save changes</button> - </form> + </form> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-default" data-dismiss="modal" + ng-click="cancel()">Close</button> + <button type="button" class="btn btn-primary" ng-click="ok()">Save changes</button> + </div> - </div> \ No newline at end of file + </script> \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm