branch develop updated (e13c42c -> 996699e)
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 e13c42c swap monitoring module added + monitoring isntructions removed from process list if execution failed new 6f723c7 cpu module added new b834acf 15 min load average module added new 996699e shelve: corrected config_mod_activation => activating a module for the 1st time adds an instruction for process_monitoring + hostpage: non activated module line on table is not shown The 3 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 996699e0c14e4e9f2732dfde0d1cb188641eac92 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 3 17:33:26 2015 +0200 shelve: corrected config_mod_activation => activating a module for the 1st time adds an instruction for process_monitoring + hostpage: non activated module line on table is not shown commit b834acf5ca25f73b5391d8f365253cda5559de64 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 3 17:14:11 2015 +0200 15 min load average module added commit 6f723c7080e2b98374036cda9ee7d43e874a88cb Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 3 17:07:25 2015 +0200 cpu module added Summary of changes: app/modules/monitoring_modules/cpu.py | 31 +++++++++++++++++++++++++++++++ app/modules/monitoring_modules/load.py | 25 +++++++++++++++++++++++++ app/modules/storage_modules/shelve_db.py | 8 ++++++++ views/hostpage.html | 4 +++- 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 app/modules/monitoring_modules/cpu.py create mode 100644 app/modules/monitoring_modules/load.py -- 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 6f723c7080e2b98374036cda9ee7d43e874a88cb Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 3 17:07:25 2015 +0200 cpu module added --- app/modules/monitoring_modules/cpu.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/modules/monitoring_modules/cpu.py b/app/modules/monitoring_modules/cpu.py new file mode 100644 index 0000000..61c1b30 --- /dev/null +++ b/app/modules/monitoring_modules/cpu.py @@ -0,0 +1,31 @@ +# -*- coding: utf8 -*- +__author__ = 'aguilbaud' + +compatible_os = ['linux', 'unix'] +block = "hardware" +unit = "%" + + +def check(conn, db, mnce): + """ + Returns the greatest between the user and system CPU charge + """ + cmd = "top -b -n 1" + stdout = conn.exec_command(cmd) + user_cpu_charge = 0.0 + system_cpu_charge = 0.0 + for line in stdout.splitlines(): + fields = line.split() + if not fields == []: + if fields[0] == '%Cpu(s):': + for i in range(len(fields)): + if fields[i] == 'us,': + field_usr = fields[i-1] + field_usr = field_usr.replace(',', '.') + user_cpu_charge = float(field_usr) + elif fields[i] == 'sy,': + field_sys = fields[i-1] + field_sys = field_sys.replace(',', '.') + system_cpu_charge = float(field_sys) + res_cpu = max(user_cpu_charge, system_cpu_charge) + return db.add_check(conn.get_addr_host(), 'cpu', res_cpu) \ No newline at end of file -- 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 b834acf5ca25f73b5391d8f365253cda5559de64 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 3 17:14:11 2015 +0200 15 min load average module added --- app/modules/monitoring_modules/load.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/modules/monitoring_modules/load.py b/app/modules/monitoring_modules/load.py new file mode 100644 index 0000000..29743aa --- /dev/null +++ b/app/modules/monitoring_modules/load.py @@ -0,0 +1,25 @@ +# -*- coding: utf8 -*- +__author__ = 'aguilbaud' + +compatible_os = ['linux', 'unix'] +block = "hardware" +unit = "15 min load average" + + +def check(conn, db, mnce): + """ + Returns the greatest between the user and system CPU charge + """ + cmd = "top -b -n 1" + stdout = conn.exec_command(cmd) + load_avg = 0.0 + for line in stdout.splitlines(): + fields = line.split() + if not fields == []: + if fields[0] == 'top': + for i in range(len(fields)): + if fields[i] == 'average:': + field_load_avg = fields[i+3] + field_load_avg = field_load_avg.replace(',', '.') + load_avg = float(field_load_avg) + return db.add_check(conn.get_addr_host(), 'load', load_avg) \ No newline at end of file -- 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 996699e0c14e4e9f2732dfde0d1cb188641eac92 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 3 17:33:26 2015 +0200 shelve: corrected config_mod_activation => activating a module for the 1st time adds an instruction for process_monitoring + hostpage: non activated module line on table is not shown --- app/modules/storage_modules/shelve_db.py | 8 ++++++++ views/hostpage.html | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 160a48f..e659ad6 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -526,6 +526,14 @@ class shelve_db: # we copy the global configuration of this module on the host configuration self.db["hosts"][addr_host]["conf"]["monitoring"][mod_name] = self.db['global_conf'][mod_name] self.db["hosts"][addr_host]["conf"]["monitoring"][mod_name]['activated'] = args['activated'][mod_name] + # we now add an instruction on the monitoring list + add_instr = {} + add_instr['addr'] = addr_host + add_instr['os'] = json.loads(self.db['hosts'][addr_host]['detected']['nmap'])['os'] + add_instr['mod_name'] = mod_name + add_instr['time'] = datetime.now() + add_instr['freq'] = self.db['hosts'][addr_host]['conf']['monitoring'][mod_name]['check_frequency'] + dict_instr['add'].append(add_instr) elif not self.db["hosts"][addr_host]["conf"]["monitoring"][mod_name]["activated"] == \ args['activated'][mod_name]: # second case, the configuration module have changed diff --git a/views/hostpage.html b/views/hostpage.html index 189dc14..cee03c9 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -20,7 +20,9 @@ </thead> <tbody> - <tr ng-repeat="(itemname, item) in items.monitoring" class={{item.state}}> + <tr ng-repeat="(itemname, item) in items.monitoring" + class={{item.state}} + ng-show="items.activated_monitoring[itemname]"> <td>{{itemname}}</td> <td>{{item.value}}</td> <td>{{item.state}}</td> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm