branch develop updated (dec3951 -> ea4e8af)
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 dec3951 exception raised on snmp conn on more cases new d76290e ordonnée du graphe des archives new 6702492 removed glances new ea4e8af added argument for log level + added postinst file + updated debian files 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 ea4e8af3064f7d31abd0ab3e7e71fbd12f142d87 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Jun 25 19:02:06 2015 +0200 added argument for log level + added postinst file + updated debian files commit 6702492fbf2c9ce6f3bd75b69060166d9820485d Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Jun 25 16:17:06 2015 +0200 removed glances commit d76290eb7b5015c78878b4776325d91f1d915075 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Jun 25 16:14:12 2015 +0200 ordonnée du graphe des archives Summary of changes: app/modules/connection_modules/glances.py | 37 --------------------------- app/modules/monitoring_modules/cpu_glances.py | 31 ---------------------- app/modules/notification_modules/sms_notif.py | 8 +++--- app/mum.py | 4 ++- install.sh => debian/postinst | 8 +++--- debian/rules | 20 ++++++++------- mum-daemon.sh | 2 +- mum.conf | 3 ++- mum.sh | 5 +++- static/js/controllers/hostPageCtrl.js | 4 +-- views/hostpage.html | 1 + 11 files changed, 33 insertions(+), 90 deletions(-) delete mode 100644 app/modules/connection_modules/glances.py delete mode 100644 app/modules/monitoring_modules/cpu_glances.py copy install.sh => debian/postinst (89%) mode change 100755 => 100644 -- 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 d76290eb7b5015c78878b4776325d91f1d915075 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Jun 25 16:14:12 2015 +0200 ordonnée du graphe des archives --- app/modules/notification_modules/sms_notif.py | 8 ++++---- static/js/controllers/hostPageCtrl.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/modules/notification_modules/sms_notif.py b/app/modules/notification_modules/sms_notif.py index b9f33ee..c758e60 100644 --- a/app/modules/notification_modules/sms_notif.py +++ b/app/modules/notification_modules/sms_notif.py @@ -29,10 +29,10 @@ class SMS: except IOError, e: if hasattr(e,'code'): if e.code == 400: - self.logger.warning('sms_notif code 400: One of the url parameters is missing.') + self.logger.error('sms_notif ' + self.user_data['sms_url'] + ' code 400: One of the url parameters is missing.') if e.code == 402: - self.logger.warning('sms_notif code 402: Too many SMS have been sent in short time.') + self.logger.error('sms_notif ' + self.user_data['sms_url'] + ' code 402: Too many SMS have been sent in short time.') if e.code == 403: - self.logger.warning('sms_notif code 403: The service is not activated or wrong login/key.') + self.logger.error('sms_notif ' + self.user_data['sms_url'] + ' code 403: The service is not activated or wrong login/key.') if e.code == 500: - self.logger.warning('sms_notif code 500: Server error. Please try again later.') \ No newline at end of file + self.logger.error('sms_notif ' + self.user_data['sms_url'] + ' code 500: Server error. Please try again later.') \ No newline at end of file diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index c7c3da5..5ace7f3 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -787,7 +787,7 @@ mumApp.controller('ModalStatsCtrl', function ($scope, $rootScope, $modalInstance for (var i = 0, l=archive_list.length ; i<l ; i++) { var current_arch = archive_list[i]; if (current_arch.value.hasOwnProperty($scope.selected_subpart)) { - $scope.data.data.push({'x': l - (i+l), + $scope.data.data.push({'x': ((l-i) - (l-i)*2) + 1, 'y': [current_arch.value[$scope.selected_subpart]], 'tooltip': current_arch.value[$scope.selected_subpart] + " @ " + current_arch.date.split('.')[0] @@ -802,7 +802,7 @@ mumApp.controller('ModalStatsCtrl', function ($scope, $rootScope, $modalInstance var archive_list = $scope.archive[$scope.selected_mod][$scope.selected_period] for (var i = 0, l=archive_list.length ; i<l ; i++) { var current_arch = archive_list[i]; - $scope.data.data.push({'x': l - (i+l), + $scope.data.data.push({'x': ((l-i) - (l-i)*2) + 1, 'y': [current_arch.value], 'tooltip': current_arch.value + " @ " + current_arch.date.split('.')[0] -- 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 6702492fbf2c9ce6f3bd75b69060166d9820485d Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Jun 25 16:17:06 2015 +0200 removed glances --- app/modules/connection_modules/glances.py | 37 --------------------------- app/modules/monitoring_modules/cpu_glances.py | 31 ---------------------- 2 files changed, 68 deletions(-) diff --git a/app/modules/connection_modules/glances.py b/app/modules/connection_modules/glances.py deleted file mode 100644 index 03def10..0000000 --- a/app/modules/connection_modules/glances.py +++ /dev/null @@ -1,37 +0,0 @@ -import xmlrpclib - - -def get_class_name(): - return "GlancesConnect" - - -class GlancesConnect: - def __init__(self, addr_host, params, key_loc, cnfe): - self.parameters = {"port": "int"} - self.name = get_class_name() - self.addr_host = addr_host - self.known_port = 61209 - self.CommandNotFoundException = cnfe - if params is not None: - self.glances_server = xmlrpclib.ServerProxy('http://' + addr_host + ':' + str(params['port'])) - - - def get_name(self): - return self.name - - def get_addr_host(self): - # Called by monitoring modules - return self.addr_host - - def get_parameters(self): - return self.parameters - - def get_known_port(self): - return self.known_port - - def exec_command(self, cmd): - out = getattr(self.glances_server, cmd)() - return out - - def disconnect(self): - self.glances_server = None \ No newline at end of file diff --git a/app/modules/monitoring_modules/cpu_glances.py b/app/modules/monitoring_modules/cpu_glances.py deleted file mode 100644 index df3de74..0000000 --- a/app/modules/monitoring_modules/cpu_glances.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf8 -*- -__author__ = 'aguilbaud' - -import json - -compatible_os = ['linux', 'freebsd', 'osx', 'windows'] -block = "hardware" -part = "CPU" -name = "CPU Glances" -unit = "%" -connection = "glances" - - -def check(conn, mnce, subparts): - """ - Returns the greatest between the user and system CPU charge - """ - cmd = "getCpu" - out = conn.exec_command(cmd) # '{"softirq": 0.0, "iowait": 0.1, "system": 1.1, "guest": 0.0, "idle": 96.4, - # "user": 2.3, "guest_nice": 0.0, "irq": 0.0, "steal": 0.0, "nice": 0.0}' - dict_res = json.loads(out) - try: - user_cpu_charge = dict_res["system"] - system_cpu_charge = dict_res["user"] - except KeyError: - exception_inst = getattr(mnce, "ModuleNotCompatibleException")( - part, conn.get_addr_host() - ) - raise exception_inst - res_cpu = max(user_cpu_charge, system_cpu_charge) - return 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 ea4e8af3064f7d31abd0ab3e7e71fbd12f142d87 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Jun 25 19:02:06 2015 +0200 added argument for log level + added postinst file + updated debian files --- app/mum.py | 4 +++- debian/postinst | 37 +++++++++++++++++++++++++++++++++++++ debian/rules | 20 +++++++++++--------- mum-daemon.sh | 2 +- mum.conf | 3 ++- mum.sh | 5 ++++- views/hostpage.html | 1 + 7 files changed, 59 insertions(+), 13 deletions(-) diff --git a/app/mum.py b/app/mum.py index 91a9f06..a44a48c 100755 --- a/app/mum.py +++ b/app/mum.py @@ -98,7 +98,8 @@ def do_upload(): def create_logger(dict_conf): logger = logging.getLogger("mum_log") - logger.setLevel(logging.DEBUG) + level = getattr(logging, dict_conf["log_level"]) + logger.setLevel(level) formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s') file_handler = RotatingFileHandler(dict_conf['log_location'], 'a', 1000000, 1) file_handler.setLevel(logging.DEBUG) @@ -130,6 +131,7 @@ if __name__ == '__main__': parser.add_argument("--smtp_server", help="name of the SMTP server to send e-mail notifications") parser.add_argument("--smtp_port", help="port number of the SMTP server") parser.add_argument("--smtp_address", help="e-mail address of the sender for e-mail notifications") + parser.add_argument("--log_level", help="set the log level : DEBUG, INFO, WARNING, ERROR") args = parser.parse_args() # creating the default conf structure from the configuration file diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..6e2020f --- /dev/null +++ b/debian/postinst @@ -0,0 +1,37 @@ +#!/bin/bash + +cd /usr/lib/mum + +venv/bin/python --version >/dev/null 2>&1 || virtualenv venv +./in-venv.sh pip install -r requirements.txt + +# changing bottle templates in order to make it compatible with angularJS +sed -i 's/{{/[[/g' venv/bin/bottle.py +sed -i 's/}}/]]/g' venv/bin/bottle.py +sed -i 's/{{/[[/g' venv/lib/python2.7/site-packages/bottle.py +sed -i 's/}}/]]/g' venv/lib/python2.7/site-packages/bottle.py + +# creating mum user if doesn't exist +NB_MUM_USR=$(grep '^mum:' /etc/passwd | wc -l) +if [ $NB_MUM_USR -eq 0 ]; then + /usr/sbin/adduser mum --system + echo 'mum user created' +fi + +# creating mum group if doesn't exist and adding mum user to it +NB_MUM_GRP=$(grep '^mum:' /etc/group | wc -l) +if [ $NB_MUM_GRP -eq 0 ]; then + /usr/sbin/addgroup mum --system + echo 'mum group created' + /usr/sbin/usermod -a -G mum mum + echo 'mum user added to mum group' +fi + +# adding mum group to sudoers if not registered +NB_MUM_SUDOERS=$(grep '^mum\s' /etc/sudoers | wc -l) +if [ $NB_MUM_SUDOERS -eq 0 ]; then + echo 'mum ALL= /usr/bin/nmap' >> /etc/sudoers + echo "mum added to sudoers" +fi + +exit 0; \ No newline at end of file diff --git a/debian/rules b/debian/rules index 9c91a1b..dedaaeb 100755 --- a/debian/rules +++ b/debian/rules @@ -26,8 +26,9 @@ DEST_APP=$(CURDIR)/debian/mum/usr/lib/mum DEST_CONF=$(CURDIR)/debian/mum/etc/mum DEST_VAR=$(CURDIR)/debian/mum/var/lib/mum DEST_BIN=$(CURDIR)/debian/mum/usr/bin -#DEST_INIT_D=$(CURDIR)/debian/mum/etc/init.d -#DEST_SYSTEMD=$(CURDIR)/debian/mum/etc/systemd/system +DEST_INIT_D=$(CURDIR)/debian/mum/etc/init.d +DEST_SYSTEMD=$(CURDIR)/debian/usr/lib/systemd/system +DEST_DOC=$(CURDIR)/debian/usr/share/doc/mum build : build-stamp @@ -50,7 +51,12 @@ install : build clean $(app) $(bower_components) $(static) $(views) $(install_sc mkdir -p $(DEST_APP) mkdir -p $(DEST_CONF) mkdir -p $(DEST_VAR) + mkdir -p $(DEST_BIN) + mkdir -p $(DEST_SYSTEMD) + mkdir -p $(DEST_DOC) mkdir $(DEST_VAR)/keys + mkdir $(DEST_VAR)/logs + mkdir $(DEST_VAR)/data cp -R $(app) $(DEST_APP) cp -R $(bower_components) $(DEST_APP) @@ -59,16 +65,12 @@ install : build clean $(app) $(bower_components) $(static) $(views) $(install_sc cp $(install_script) $(DEST_APP) cp $(in_venv) $(DEST_APP) cp $(mum_conf) $(DEST_CONF) - #@if test -d $(DEST_INIT_D); then \ - # cp $(mum_daemon) $(DEST_INIT_D) - #else :; fi - #@if test -d $(DEST_SYSTEMD); then \ - # cp $(mum_service) $(DEST_SYSTEMD) - #else :; fi + cp $(mum_service) $(DEST_SYSTEMD) cp $(readme) $(DEST_APP) cp $(requirements) $(DEST_APP) cp $(run) $(DEST_APP) - ln -s $(run) $(DEST_BIN) + cp $(mum_daemon) $(DEST_DOC) + ln -s /usr/lib/mum/mum.sh -t $(DEST_BIN) find $(DEST_APP)/app -type f -iname "*.pyc" -exec rm -f {} \; rm -rf $(DEST_APP)/bower_components/jquery diff --git a/mum-daemon.sh b/mum-daemon.sh index 28290d5..adcb03b 100755 --- a/mum-daemon.sh +++ b/mum-daemon.sh @@ -11,7 +11,7 @@ DESC="Mum service" NAME="mum" -DAEMON=/usr/lib/mum/mum.sh +DAEMON=/bin/mum DAEMON_OPTS=/etc/mum PIDFILE=/var/run/$NAME.pid diff --git a/mum.conf b/mum.conf index cdff5fb..0a12be8 100644 --- a/mum.conf +++ b/mum.conf @@ -4,9 +4,10 @@ db_location=/var/lib/mum/data/mum.db log_location=/var/lib/mum/logs external_modules_location=/etc/mum/modules/ keys_location=/var/lib/mum/keys/ -smtp_server= +smtp_server=localhost smtp_port= smtp_address= +log_level=WARNING #scan=Scan name|Scan description|Priority|Nmap parameter options scan=Complete scan and detection|This scan is the most complete but the longest one. Recommended for commom server monitoring. Time necessary: from a minute to several hours depending of the host.|1|-sU -sS -p U:161,T:1-65535 -A -Pn diff --git a/mum.sh b/mum.sh index 10b3a77..39d4ef3 100755 --- a/mum.sh +++ b/mum.sh @@ -1,8 +1,11 @@ #!/bin/sh +DIR=$(basename /usr/lib/mum) +cd $DIR + if [ ! -d "venv" ]; then echo "Preparing the virtual environment for the first launch (this may take several minutes)" echo "Log files will be saved on /etc/mum" - ./install.sh > /etc/mum/mum.install.log 2> /etc/mum/mum.install.err + ./install.sh > /var/log/mum/mum.install.log 2> /var/log/mum/mum.install.err fi exec ./in-venv.sh python app/mum.py $* diff --git a/views/hostpage.html b/views/hostpage.html index 8cd95ff..8a34387 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -477,6 +477,7 @@ <button ng-click="item.upload(item, '\keys')">upload</button> </li> </ul>--> + <div class="row" ng-show="show_form('private_key')"> <div class="col-xs-3"> <label for="private_key">Select a private key</label> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm