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>.