branch develop updated (f1739b9 -> b6d01a5)
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 f1739b9 stat page : stats are calculated after mod selection (hided if stat is NaN) new 0c0b88c dict values are archived, stats are counted and can be view on charts new 2623b9f nmap tcp scan param on all ports + nmap scan on existing host will replace only nmap data and reconfigure activated modules by this new detection new d8c113e configuration of archiving new b6d01a5 version added on database + updated readme The 4 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 b6d01a5c4157cae171d16c915cc4b75f86d5829f Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed May 6 11:44:31 2015 +0200 version added on database + updated readme commit d8c113e2dffaca50db0241fdd7a38fd086f42146 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed May 6 11:16:38 2015 +0200 configuration of archiving commit 2623b9f5cf6f99f902a86cc55bba7c4e34dd059c Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed May 6 10:35:05 2015 +0200 nmap tcp scan param on all ports + nmap scan on existing host will replace only nmap data and reconfigure activated modules by this new detection commit 0c0b88c12859ac5e09201dc9927ae07399cc428b Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue May 5 18:00:59 2015 +0200 dict values are archived, stats are counted and can be view on charts Summary of changes: README | 14 ++-- app/module_loader.py | 3 + app/modules/nmap_detection.py | 1 + app/modules/storage_modules/shelve_db.py | 132 +++++++++++++++++++------------ static/js/controllers/hostPageCtrl.js | 24 ++++++ static/js/controllers/scanCtrl.js | 13 ++- static/js/controllers/settingsCtrl.js | 14 ++++ static/js/controllers/statsCtrl.js | 66 +++++++++++----- static/js/mumApp.js | 4 + views/hostpage.html | 31 +++++++- views/settings.html | 27 +++++++ views/stats.html | 27 ++----- 12 files changed, 255 insertions(+), 101 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 0c0b88c12859ac5e09201dc9927ae07399cc428b Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Tue May 5 18:00:59 2015 +0200 dict values are archived, stats are counted and can be view on charts --- app/modules/storage_modules/shelve_db.py | 45 +++++++++++++--------- static/js/controllers/statsCtrl.js | 66 +++++++++++++++++++++++--------- views/stats.html | 27 +++---------- 3 files changed, 78 insertions(+), 60 deletions(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index aadd744..164600a 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -835,14 +835,6 @@ class shelve_db: # creating the monitoring structure for this module if not exists self.db['hosts'][addr_host]["monitoring"][mod_name] = {} self.db['hosts'][addr_host]['stats'][mod_name] = {} - self.db['hosts'][addr_host]['stats'][mod_name]['nb_check'] = 0 - self.db['hosts'][addr_host]['stats'][mod_name]['delta'] = 0 - self.db['hosts'][addr_host]['stats'][mod_name]['mean'] = 0 - self.db['hosts'][addr_host]['stats'][mod_name]['M2'] = 0 - self.db['hosts'][addr_host]['stats'][mod_name]['lin_reg'] = 0 - self.db['hosts'][addr_host]['stats'][mod_name]['min'] = maxint - self.db['hosts'][addr_host]['stats'][mod_name]['max'] = 0 - self.db['hosts'][addr_host]['stats'][mod_name]['total'] = 0 self.db['hosts'][addr_host]['archive'][mod_name] = {} if isinstance(val, type({})): # if dictionary @@ -936,19 +928,34 @@ class shelve_db: val = 1 else: val = 0 - if not isinstance(val, type({})): - stats['nb_check'] += 1 - stats['total'] += val - if stats['min'] > val: - stats['min'] = val - if stats['max'] < val: - stats['max'] = val + if isinstance(val, type({})): + tab_iter = val.keys() + else: + tab_iter = [''] + val = {'': val} + for key in tab_iter: + if key not in stats: + stats[key] = {} + stats[key]['nb_check'] = 0 + stats[key]['delta'] = 0 + stats[key]['mean'] = 0 + stats[key]['M2'] = 0 + stats[key]['lin_reg'] = 0 + stats[key]['min'] = maxint + stats[key]['max'] = 0 + stats[key]['total'] = 0 + stats[key]['nb_check'] += 1 + stats[key]['total'] += val[key] + if stats[key]['min'] > val[key]: + stats[key]['min'] = val[key] + if stats[key]['max'] < val[key]: + stats[key]['max'] = val[key] # Compute linear regression - stats['lin_reg'] += val * stats['nb_check'] + stats[key]['lin_reg'] += val[key] * stats[key]['nb_check'] # Compute variance - stats['delta'] = val - stats['mean'] - stats['mean'] += stats['delta'] / stats['nb_check'] - stats['M2'] += stats['delta'] * (val - stats['mean']) + stats[key]['delta'] = val[key] - stats[key]['mean'] + stats[key]['mean'] += stats[key]['delta'] / stats[key]['nb_check'] + stats[key]['M2'] += stats[key]['delta'] * (val[key] - stats[key]['mean']) return stats @staticmethod diff --git a/static/js/controllers/statsCtrl.js b/static/js/controllers/statsCtrl.js index 2bc98f1..5219ecf 100644 --- a/static/js/controllers/statsCtrl.js +++ b/static/js/controllers/statsCtrl.js @@ -4,10 +4,12 @@ mumApp.controller('statsCtrl', function($scope, $rootScope, $timeout, DataHosts) $scope.host_list.push(DataHosts.Items[i]['addr']) } $scope.mod_list = []; + $scope.subpart_list = []; //selection $scope.selected_host = ''; $scope.selected_mod = ''; + $scope.selected_subpart = ''; $scope.selected_period = ''; //data @@ -38,47 +40,73 @@ mumApp.controller('statsCtrl', function($scope, $rootScope, $timeout, DataHosts) } }); + $scope.update_subpart_list = function(){ + $scope.subpart_list = []; + for(subpart in $scope.stats[$scope.selected_mod]){ + $scope.subpart_list.push(subpart); + } + $scope.selected_subpart = ''; + if($scope.subpart_list.length == 1 && $scope.subpart_list[0] == ''){ + $scope.update_stats(); + } + }; + $scope.update_stats = function(){ $scope.selected_period = ''; update_mean(); update_standard_derivation(); update_slope_of_linear_regression(); - } + }; $scope.refresh_chart_data = function(){ $scope.config.title = $scope.selected_host; - $scope.data.series = [$scope.selected_mod]; $scope.data.data = []; - for(var i = 0; i<$scope.archive[$scope.selected_mod][$scope.selected_period].length; i++){ - $scope.data.data.push({'x': i, - 'y': [$scope.archive[$scope.selected_mod][$scope.selected_period][i].value], - 'tooltip': $scope.archive[$scope.selected_mod][$scope.selected_period][i].value + " @ " + - $scope.archive[$scope.selected_mod][$scope.selected_period][i].date.split('.')[0] - } - ) + if(typeof($scope.archive[$scope.selected_mod][$scope.selected_period][0].value) == "object"){ + $scope.data.series = [$scope.selected_mod + ' on ' + $scope.selected_subpart]; + for(var i = 0; i<$scope.archive[$scope.selected_mod][$scope.selected_period].length; i++){ + if($scope.archive[$scope.selected_mod][$scope.selected_period][i].value.hasOwnProperty($scope.selected_subpart)){ + $scope.data.data.push({'x': i, + 'y': [$scope.archive[$scope.selected_mod][$scope.selected_period][i].value[$scope.selected_subpart]], + 'tooltip': $scope.archive[$scope.selected_mod][$scope.selected_period][i].value[$scope.selected_subpart] + " @ " + + $scope.archive[$scope.selected_mod][$scope.selected_period][i].date.split('.')[0] + } + ) + } + } + } + else{ + $scope.data.series = [$scope.selected_mod]; + for(var i = 0; i<$scope.archive[$scope.selected_mod][$scope.selected_period].length; i++){ + $scope.data.data.push({'x': i, + 'y': [$scope.archive[$scope.selected_mod][$scope.selected_period][i].value], + 'tooltip': $scope.archive[$scope.selected_mod][$scope.selected_period][i].value + " @ " + + $scope.archive[$scope.selected_mod][$scope.selected_period][i].date.split('.')[0] + } + ) + } } }; $scope.value_is_NaN = function(value){ return value !== value; - } + }; var update_mean = function(){ - $scope.mean_value = $scope.stats[$scope.selected_mod].total / $scope.stats[$scope.selected_mod].nb_check; - } + $scope.mean_value = $scope.stats[$scope.selected_mod][$scope.selected_subpart].total / $scope.stats[$scope.selected_mod][$scope.selected_subpart].nb_check; + }; var update_standard_derivation = function(){ - var variance = $scope.stats[$scope.selected_mod].M2 / Math.max(1, $scope.stats[$scope.selected_mod].nb_check + 1); + var variance = $scope.stats[$scope.selected_mod][$scope.selected_subpart].M2 / Math.max(1, $scope.stats[$scope.selected_mod][$scope.selected_subpart].nb_check + 1); $scope.standard_derivation = Math.sqrt(variance); - } + }; var update_slope_of_linear_regression = function(){ - var mX = ($scope.stats[$scope.selected_mod].nb_check + 1) / 2; - var mY = $scope.stats[$scope.selected_mod].total / $scope.stats[$scope.selected_mod].nb_check; - var mX2 = ($scope.stats[$scope.selected_mod].nb_check + 1) * (2 * $scope.stats[$scope.selected_mod].nb_check + 1) / 6; - var mXY = $scope.stats[$scope.selected_mod].lin_reg / $scope.stats[$scope.selected_mod].nb_check; + var mX = ($scope.stats[$scope.selected_mod][$scope.selected_subpart].nb_check + 1) / 2; + var mY = $scope.stats[$scope.selected_mod][$scope.selected_subpart].total / $scope.stats[$scope.selected_mod][$scope.selected_subpart].nb_check; + var mX2 = ($scope.stats[$scope.selected_mod][$scope.selected_subpart].nb_check + 1) * (2 * $scope.stats[$scope.selected_mod][$scope.selected_subpart].nb_check + 1) / 6; + var mXY = $scope.stats[$scope.selected_mod][$scope.selected_subpart].lin_reg / $scope.stats[$scope.selected_mod][$scope.selected_subpart].nb_check; $scope.slope_lr = (mXY - mX * mY) / (mX2 - mX * mX); - } + }; $scope.config = { title: '', diff --git a/views/stats.html b/views/stats.html index 3dd01bb..d816bb1 100644 --- a/views/stats.html +++ b/views/stats.html @@ -16,6 +16,11 @@ <select ng-model="selected_mod" ng-options="mod for mod in mod_list" ng-show="selected_host != ''" + ng-change="update_subpart_list()"> + </select> + <select ng-model="selected_subpart" + ng-options="subpart for subpart in subpart_list" + ng-show="selected_mod != ''" ng-change="update_stats()"> </select> <select ng-model="selected_period" @@ -50,26 +55,4 @@ data-ac-config="config" class="chart"> </div> - <!--<div class="row placeholders"> - <div class="col-xs-6 col-sm-3 placeholder"> - <img src="data/index.svg" class="img-responsive" alt="Generic placeholder thumbnail"> - <h4>Label</h4> - <span class="text-muted">Something else</span> - </div> - <div class="col-xs-6 col-sm-3 placeholder"> - <img src="data/index.svg" class="img-responsive" alt="Generic placeholder thumbnail"> - <h4>Label</h4> - <span class="text-muted">Something else</span> - </div> - <div class="col-xs-6 col-sm-3 placeholder"> - <img src="data/index.svg" class="img-responsive" alt="Generic placeholder thumbnail"> - <h4>Label</h4> - <span class="text-muted">Something else</span> - </div> - <div class="col-xs-6 col-sm-3 placeholder"> - <img src="data/index.svg" class="img-responsive" alt="Generic placeholder thumbnail"> - <h4>Label</h4> - <span class="text-muted">Something else</span> - </div> - </div>--> </div> -- 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 2623b9f5cf6f99f902a86cc55bba7c4e34dd059c Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed May 6 10:35:05 2015 +0200 nmap tcp scan param on all ports + nmap scan on existing host will replace only nmap data and reconfigure activated modules by this new detection --- README | 2 +- app/module_loader.py | 3 ++ app/modules/nmap_detection.py | 1 + app/modules/storage_modules/shelve_db.py | 67 ++++++++++++++++++-------------- static/js/controllers/hostPageCtrl.js | 4 ++ static/js/controllers/scanCtrl.js | 13 +++++-- static/js/mumApp.js | 4 ++ views/hostpage.html | 5 ++- 8 files changed, 65 insertions(+), 34 deletions(-) diff --git a/README b/README index 7821db3..6e134ba 100644 --- a/README +++ b/README @@ -40,7 +40,7 @@ all avaliable arguments, type : The service will be avaliable by default on 0.0.0.0:1337 -We recommand to parameter the default settings for each modules before adding any hosts. +We recommand to parameter the default settings for each modules before scanning any host. The default parameters that will be applied are : - minor limit at 90% and major limit at 98% for each "%" values - major limit if down for boolean values diff --git a/app/module_loader.py b/app/module_loader.py index dc59d3a..02140a7 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -103,6 +103,9 @@ class ModuleLoader: else: # the parameter is not an IP range, so we considere it as an hostname. ip_range = nmap_mod_instance.launch_detection_with_hostname(param) + for ip in json.loads(ip_range): + #remonving all monitoring instructions for this ip, if rescan + process_monitoring.remove_to_waiting_list(ip, None) return ip_range except modules.HostNotFoundException.HostNotFoundException as hnfe: print hnfe.__str__() diff --git a/app/modules/nmap_detection.py b/app/modules/nmap_detection.py index 85991b4..8a00109 100644 --- a/app/modules/nmap_detection.py +++ b/app/modules/nmap_detection.py @@ -149,6 +149,7 @@ class nmap_detection: #dict_host['date'] = host.getAttribute('endtime') #dict_host['state'] = status.getAttribute('state') dict_host['os'] = 'unknown' # par defaut + dict_host['hostname'] = '' hostnames_elem = host.getElementsByTagName('hostnames')[0] hostnames = hostnames_elem.getElementsByTagName('hostname') diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 164600a..50315ad 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -213,35 +213,44 @@ class shelve_db: self.open_db() addr_host = str(addr_host) # Shelve doesn't support Unicode try: - # Add the nmap detection - self.db["hosts"][addr_host] = {} - self.db["hosts"][addr_host]["detected"] = {} - self.db["hosts"][addr_host]["detected"]["nmap"] = nmap_res - # Preconfiguration - self.db["hosts"][addr_host]["conf"] = {} - nmap_res_data = json.loads(nmap_res) - self.db["hosts"][addr_host]['detected']['nmap'] = json.dumps(nmap_res_data) - self.db["hosts"][addr_host]["conf"]["connections"] = self.init_conn(nmap_res_data, conn_infos) - 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']['idling'] = {} # For reactivation after an idle state - self.db['hosts'][addr_host]['conf']['idling']['modules'] = [] - self.db['hosts'][addr_host]['conf']['idling']['status'] = "" - self.db["hosts"][addr_host]["conf"]["groups"] = ["all"] # Every host is in group "all" - self.db["hosts"][addr_host]["conf"]["subscribers"] = {} - self.db["hosts"][addr_host]["conf"]["custom_info"] = "" - self.db["hosts"][addr_host]["conf"]["interventions"] = [] - # Create structure for monitoring data - self.db["hosts"][addr_host]["monitoring"] = {} - # Create structure for global status of host - self.db["hosts"][addr_host]["status"] = {} - self.db["hosts"][addr_host]["status"]["state"] = "" - # Create structure for archiving data - self.db["hosts"][addr_host]["archive"] = {} - self.db["hosts"][addr_host]["stats"] = {} + if addr_host in self.db['hosts']: + # it's rescan, we update only nmap related results + self.db["hosts"][addr_host]["detected"]["nmap"] = nmap_res + nmap_res_data = json.loads(nmap_res) + self.db["hosts"][addr_host]["conf"]["connections"] = self.init_conn(nmap_res_data, conn_infos) + os_host = nmap_res_data['os'] + 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] + else: + # Add the nmap detection + self.db["hosts"][addr_host] = {} + self.db["hosts"][addr_host]["detected"] = {} + # Preconfiguration + self.db["hosts"][addr_host]["conf"] = {} + nmap_res_data = json.loads(nmap_res) + self.db["hosts"][addr_host]['detected']['nmap'] = nmap_res + self.db["hosts"][addr_host]["conf"]["connections"] = self.init_conn(nmap_res_data, conn_infos) + 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']['idling'] = {} # For reactivation after an idle state + self.db['hosts'][addr_host]['conf']['idling']['modules'] = [] + self.db['hosts'][addr_host]['conf']['idling']['status'] = "" + self.db["hosts"][addr_host]["conf"]["groups"] = ["all"] # Every host is in group "all" + self.db["hosts"][addr_host]["conf"]["subscribers"] = {} + self.db["hosts"][addr_host]["conf"]["custom_info"] = "" + self.db["hosts"][addr_host]["conf"]["interventions"] = [] + # Create structure for monitoring data + self.db["hosts"][addr_host]["monitoring"] = {} + # Create structure for global status of host + self.db["hosts"][addr_host]["status"] = {} + self.db["hosts"][addr_host]["status"]["state"] = "" + # Create structure for archiving data + self.db["hosts"][addr_host]["archive"] = {} + self.db["hosts"][addr_host]["stats"] = {} except Exception: print traceback.format_exc() finally: diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index bb51ed3..a4e0c31 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -52,6 +52,10 @@ mumApp.controller('hostPageCtrl', function($scope, $rootScope, $route, $routePar $scope.selectedAll = false; + $scope.rescan = function(){ + $location.path('/scan/' + $scope.addr_host); + } + $scope.update_nmap_attribute = function(attribute, new_value){ var args = {}; args['attribute'] = attribute; diff --git a/static/js/controllers/scanCtrl.js b/static/js/controllers/scanCtrl.js index d30ae6d..d31609a 100644 --- a/static/js/controllers/scanCtrl.js +++ b/static/js/controllers/scanCtrl.js @@ -1,6 +1,13 @@ -mumApp.controller('scanCtrl', function($scope, $rootScope) { +mumApp.controller('scanCtrl', function($scope, $rootScope, $routeParams) { // Concerning the scan form - $scope.ip_range = "" // la plage d'ip entree dans le champ + + if($routeParams.param == null){ + $scope.ip_range = ""; // la plage d'ip entree dans le champ + } + else{ + $scope.ip_range = $routeParams.param; + } + $scope.state = ""; // l'etat general du scan en cours $scope.ip_scanned = {}; @@ -8,7 +15,7 @@ mumApp.controller('scanCtrl', function($scope, $rootScope) { $scope.show_opt = false; - $scope.nmap_options = "-sU -sS -p U:161,T:1-8080,61209 -A -Pn"; + $scope.nmap_options = "-sU -sS -p U:161,T:1-65535 -A -Pn"; $scope.$on("success", function (event, args) { $scope.state = "Success!"; diff --git a/static/js/mumApp.js b/static/js/mumApp.js index 91e22dd..0e9c994 100644 --- a/static/js/mumApp.js +++ b/static/js/mumApp.js @@ -38,6 +38,10 @@ mumApp.config(function($routeProvider){ templateUrl : 'scan.html', controller : 'scanCtrl' }) + .when('/scan/:param/',{ + templateUrl : 'scan.html', + controller : 'scanCtrl' + }) .when('/settings/',{ templateUrl : 'settings.html', controller : 'settingsCtrl' diff --git a/views/hostpage.html b/views/hostpage.html index 6bfcd42..04b5a7a 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -56,7 +56,8 @@ ng-click="check(itemname)">Check now</button></td> </tr> <tr ng-repeat-end - ng-repeat="(valname, val) in item.value" + ng-repeat="(valname, val) in item.value | + orderBy:val" collapse="collapsed[itemname]"> <td>{{valname}}</td> <td>{{val}} {{get_unit(itemname)}}</td> @@ -65,6 +66,8 @@ </table> <accordion close-others="false"> <accordion-group heading="Essential configuration (nmap detection)"> + <button type="button" class="btn btn-primary btn-xs" + ng-click="rescan()">Scan again</button> <table class="table table-bordered table-hover"> <tr ng-repeat="(key, val) in items.detected.nmap"> <td>{{key}}</td> -- 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 d8c113e2dffaca50db0241fdd7a38fd086f42146 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed May 6 11:16:38 2015 +0200 configuration of archiving --- app/modules/storage_modules/shelve_db.py | 19 +++++++++++++++++-- static/js/controllers/hostPageCtrl.js | 20 ++++++++++++++++++++ static/js/controllers/settingsCtrl.js | 14 ++++++++++++++ views/hostpage.html | 27 +++++++++++++++++++++++++++ views/settings.html | 27 +++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 2 deletions(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 50315ad..c073e08 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -156,6 +156,11 @@ class shelve_db: 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'] + for period in ['min', 'hour', 'day', 'week', 'month', 'year']: + if args['nb_' + period] == '': + self.db['global_conf'][args['mod_name']]['nb_' + period] = None + else: + self.db['global_conf'][args['mod_name']]['nb_' + period] = args['nb_' + period] except Exception: print traceback.format_exc() finally: @@ -717,6 +722,8 @@ class shelve_db: res['minor_limit'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['minor_limit'] res['major_limit'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['major_limit'] res['freq'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['check_frequency'] + for period in ['min', 'hour', 'day', 'week', 'month', 'year']: + res['nb_' + period] = self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['nb_' + period] except Exception: print traceback.format_exc() finally: @@ -742,6 +749,11 @@ class shelve_db: self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['minor_limit'] = args['minor_limit'] self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['major_limit'] = args['major_limit'] self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['check_frequency'] = args['freq'] + for period in ['min', 'hour', 'day', 'week', 'month', 'year']: + if args['nb_' + period] == '': + self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['nb_' + period] = None + else: + self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['nb_' + period] = args['nb_' + period] except Exception: print traceback.format_exc() finally: @@ -991,8 +1003,11 @@ class shelve_db: dict_archive[period].append(dict_check) if period == 'year' and time_diff.days >= 365: dict_archive[period].append(dict_check) - if conf_mod['nb_' + period] is not None and len(dict_archive[period]) > conf_mod['nb_' + period]: - dict_archive[period].pop(0) + if conf_mod['nb_' + period] is not None: + size_arch = len(dict_archive[period]) + while size_arch > conf_mod['nb_' + period]: + dict_archive[period].pop(0) + size_arch -= 1 return dict_archive def create_notif_structure(self, addr_host, moni_mod, status): diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index a4e0c31..78e7e85 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -301,6 +301,13 @@ mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalI $scope.limit_bool = 'minor'; + $scope.arch_min = 0; + $scope.arch_hour = 0; + $scope.arch_day = 0; + $scope.arch_week = 0; + $scope.arch_month = 0; + $scope.arch_year = 0; + // when the actual conf of the module is received $scope.$on("resCall", function (event, args) { if(args.func == 'get_conf_mod'){ @@ -323,6 +330,12 @@ mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalI $scope.minor_limit_unit = args.res.minor_limit; $scope.major_limit_unit = args.res.major_limit; } + $scope.arch_min = args.res.nb_min; + $scope.arch_hour = args.res.nb_hour; + $scope.arch_day = args.res.nb_day; + $scope.arch_week = args.res.nb_week; + $scope.arch_month = args.res.nb_month; + $scope.arch_year = args.res.nb_year; }, 0); } }); @@ -345,6 +358,13 @@ mumApp.controller('ModalConfInstanceCtrl', function ($scope, $rootScope, $modalI args.minor_limit = $scope.minor_limit_unit; args.major_limit = $scope.major_limit_unit; } + args.nb_min = $scope.arch_min; + args.nb_hour = $scope.arch_hour; + args.nb_day = $scope.arch_day; + args.nb_week = $scope.arch_week; + args.nb_month = $scope.arch_month; + args.nb_year = $scope.arch_year; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"SET_CONF_MOD": args})); $modalInstance.close(); diff --git a/static/js/controllers/settingsCtrl.js b/static/js/controllers/settingsCtrl.js index 3c5fdb2..2838b2b 100644 --- a/static/js/controllers/settingsCtrl.js +++ b/static/js/controllers/settingsCtrl.js @@ -62,6 +62,13 @@ mumApp.controller('ModalGlobalConfInstanceCtrl', function ($scope, $rootScope, $ $scope.limit_bool = 'minor'; + $scope.arch_min = global_conf_args.conf_mod.nb_min; + $scope.arch_hour = global_conf_args.conf_mod.nb_hour; + $scope.arch_day = global_conf_args.conf_mod.nb_day; + $scope.arch_week = global_conf_args.conf_mod.nb_week; + $scope.arch_month = global_conf_args.conf_mod.nb_month; + $scope.arch_year = global_conf_args.conf_mod.nb_year; + if($scope.global_conf_args.conf_mod.unit == 'bool'){ if($scope.global_conf_args.conf_mod.major_limit){ $scope.limit_bool = 'major'; @@ -94,6 +101,13 @@ mumApp.controller('ModalGlobalConfInstanceCtrl', function ($scope, $rootScope, $ args.major_limit = $scope.major_limit_unit; } + args.nb_min = $scope.arch_min; + args.nb_hour = $scope.arch_hour; + args.nb_day = $scope.arch_day; + args.nb_week = $scope.arch_week; + args.nb_month = $scope.arch_month; + args.nb_year = $scope.arch_year; + $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'set_global_settings','args': args}})); $modalInstance.close(); diff --git a/views/hostpage.html b/views/hostpage.html index 04b5a7a..3dd625d 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -156,6 +156,33 @@ <div class="modal-body"> <form> <div class="form-group"> + <label for="arch">Archives to keep (in check numbers). Keep empty for no limit.</label> + <div class="row" id="arch"> + <div class="col-xs-2"> + <input type="number" min="0" max="59" class="form-control" + ng-model="arch_min"> minute + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="59" class="form-control" + ng-model="arch_hour"> hour + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="23" class="form-control" + ng-model="arch_day"> day + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="7" class="form-control" + ng-model="arch_week"> week + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="31" class="form-control" + ng-model="arch_month"> month + </div> + <div class="col-xs-2"> + <input type="number" min="0" class="form-control" + ng-model="arch_year"> year + </div> + </div> <label for="freq">Frequency check: each</label> <div class="row" id="freq"> <div class="col-xs-2"> diff --git a/views/settings.html b/views/settings.html index a0c06b7..42cb1ec 100644 --- a/views/settings.html +++ b/views/settings.html @@ -19,6 +19,33 @@ <div class="modal-body"> <form> <div class="form-group"> + <label for="arch">Archives to keep (in check numbers). Keep empty for no limit.</label> + <div class="row" id="arch"> + <div class="col-xs-2"> + <input type="number" min="0" max="59" class="form-control" + ng-model="arch_min"> minute + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="59" class="form-control" + ng-model="arch_hour"> hour + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="23" class="form-control" + ng-model="arch_day"> day + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="7" class="form-control" + ng-model="arch_week"> week + </div> + <div class="col-xs-2"> + <input type="number" min="0" max="31" class="form-control" + ng-model="arch_month"> month + </div> + <div class="col-xs-2"> + <input type="number" min="0" class="form-control" + ng-model="arch_year"> year + </div> + </div> <label for="freq">Frequency check: each</label> <div class="row" id="freq"> <div class="col-xs-2"> -- 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 b6d01a5c4157cae171d16c915cc4b75f86d5829f Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Wed May 6 11:44:31 2015 +0200 version added on database + updated readme --- README | 14 ++++++++------ app/modules/storage_modules/shelve_db.py | 1 + views/hostpage.html | 5 ++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README b/README index 6e134ba..62e7019 100644 --- a/README +++ b/README @@ -31,8 +31,8 @@ Copy the mum.conf file to create a local configuration file. Edit this local configuration file. To get informations about each field, type : ./run.sh -h -Launch the server : -./run.sh location_of_local_conf_file +Launch the server (you need root access for UDP scan with nmap): +sudo ./run.sh location_of_local_conf_file You can also overwrite a filed of the configuration file by adding "--field value" arguments on the command line. To get all avaliable arguments, type : @@ -40,7 +40,7 @@ all avaliable arguments, type : The service will be avaliable by default on 0.0.0.0:1337 -We recommand to parameter the default settings for each modules before scanning any host. +We recommand to set the default settings for each modules before scanning any machine. The default parameters that will be applied are : - minor limit at 90% and major limit at 98% for each "%" values - major limit if down for boolean values @@ -57,8 +57,10 @@ bower install ./install.sh -edit local configuration file by following the latest model +Edit local configuration file by following the latest model (mum.conf) -remove database +Remove database -Launch the server again: ./run.sh location_of_local_conf_file \ No newline at end of file +Launch the server again: sudo ./run.sh location_of_local_conf_file + +Don't forget to set the default settings before scanning machines ! \ No newline at end of file diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index c073e08..6dfbe32 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -39,6 +39,7 @@ class shelve_db: self.db["groups"] = {} self.db["global_conf"] = {} self.db["tasks"] = [] + self.db["version"] = "0.1" except: print "Database initilalization error" self.db.close() diff --git a/views/hostpage.html b/views/hostpage.html index 3dd625d..724db7b 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -56,9 +56,8 @@ ng-click="check(itemname)">Check now</button></td> </tr> <tr ng-repeat-end - ng-repeat="(valname, val) in item.value | - orderBy:val" - collapse="collapsed[itemname]"> + ng-repeat="(valname, val) in item.value" + collapse="collapsed[itemname]"> <td>{{valname}}</td> <td>{{val}} {{get_unit(itemname)}}</td> </tr> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm