branch develop updated (50c9f8c -> 1fbeb70)
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 50c9f8c new nmap params for UDP port of snmp detection + corrected init_conn + using telnetlib for smtp check new 9cc1314 fix: deactivating a module that failed will update the global status of the host new adf329d traceroute saved with nmap scan + bugfix on db new 1fbeb70 commented snmp modules + smtp module do helo request using smtplib 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 1fbeb70ae972d23e36645b963f594debefb61043 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Mon Apr 27 11:25:31 2015 +0200 commented snmp modules + smtp module do helo request using smtplib commit adf329d9e8b8ccd83e2df99f82974d4d9386f83b Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 24 10:05:10 2015 +0200 traceroute saved with nmap scan + bugfix on db commit 9cc1314646b319805d3478f55823bb47074d75d7 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 23 13:43:33 2015 +0200 fix: deactivating a module that failed will update the global status of the host Summary of changes: app/modules/monitoring_modules/15_min_load_snmp_linux.py | 8 ++++++-- app/modules/monitoring_modules/cpu_snmp_linux.py | 12 +++++++----- app/modules/monitoring_modules/disk_snmp_linux.py | 10 ++++++---- app/modules/monitoring_modules/http.py | 5 ++++- app/modules/monitoring_modules/memory_snmp_linux.py | 10 ++++++---- app/modules/monitoring_modules/smtp.py | 13 ++++++++++--- app/modules/monitoring_modules/swap_snmp_linux.py | 10 ++++++---- app/modules/nmap_detection.py | 10 ++++++++-- app/modules/storage_modules/shelve_db.py | 12 ++++++++++++ app/mum.py | 9 +++++---- 10 files changed, 70 insertions(+), 29 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 9cc1314646b319805d3478f55823bb47074d75d7 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Thu Apr 23 13:43:33 2015 +0200 fix: deactivating a module that failed will update the global status of the host --- app/modules/storage_modules/shelve_db.py | 11 +++++++++++ app/mum.py | 1 + 2 files changed, 12 insertions(+) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index 16aa2ed..e26486e 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -637,6 +637,17 @@ class shelve_db: rem_instr['addr'] = args['addr_host'] rem_instr['mod_name'] = mod_name dict_instr['rem'].append(rem_instr) + # and from the monitoring data structure + del self.db['hosts'][addr_host]['monitoring'][mod_name] + state = 'success' + for mod_in_monitoring in self.db['hosts'][addr_host]['monitoring']: + if self.db['hosts'][addr_host]['monitoring'][mod_in_monitoring]['state'] == 'danger': + state = 'danger' + elif self.db['hosts'][addr_host]['monitoring'][mod_in_monitoring]['state'] == 'warning' \ + and not state == 'danger': + state = 'warning' + self.db['hosts'][addr_host]['status']['state'] = state + except Exception: print traceback.format_exc() finally: diff --git a/app/mum.py b/app/mum.py index 5c77fe5..2a711bb 100755 --- a/app/mum.py +++ b/app/mum.py @@ -167,6 +167,7 @@ def receive(ws): ws.send(json.dumps({"RES_GET_HOSTS": ml.get_db().get_hosts()})) elif code == "SET_MOD_ACTIVATION": # asked from hostpage, at the block activation conf ml.update_activated_modules(msg["SET_MOD_ACTIVATION"]) + ws.send(json.dumps({"RES_GET_HOSTS": ml.db.get_hosts()})) elif code == "TEST_CONN": try: ml.test_connection(msg["TEST_CONN"]["addr_host"], -- 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 adf329d9e8b8ccd83e2df99f82974d4d9386f83b Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Apr 24 10:05:10 2015 +0200 traceroute saved with nmap scan + bugfix on db --- app/modules/nmap_detection.py | 10 ++++++++-- app/modules/storage_modules/shelve_db.py | 3 ++- app/mum.py | 8 ++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/modules/nmap_detection.py b/app/modules/nmap_detection.py index 873ed6a..85991b4 100644 --- a/app/modules/nmap_detection.py +++ b/app/modules/nmap_detection.py @@ -146,8 +146,8 @@ class nmap_detection: dict_host = {} dict_host['addr'] = address.getAttribute('addr') - dict_host['date'] = host.getAttribute('endtime') - dict_host['state'] = status.getAttribute('state') + #dict_host['date'] = host.getAttribute('endtime') + #dict_host['state'] = status.getAttribute('state') dict_host['os'] = 'unknown' # par defaut hostnames_elem = host.getElementsByTagName('hostnames')[0] @@ -168,6 +168,12 @@ class nmap_detection: dict_port['portid'] = port.getAttribute('portid') dict_port['portname'] = service.getAttribute('name') list_dict_port.append(dict_port) + trace_elem = host.getElementsByTagName('trace')[0] + dict_host['traceroute'] = [] + for hop in trace_elem.getElementsByTagName('hop'): + dict_host['traceroute'].append(hop.getAttribute("ipaddr")) + if dict_host['addr'] in dict_host['traceroute']: + dict_host['traceroute'].remove(dict_host['addr']) dict_host['openports'] = list_dict_port # the host have its IP for ID on the db self.db.add_host(dict_host['addr'], diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index e26486e..0bee1c9 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -638,7 +638,8 @@ class shelve_db: rem_instr['mod_name'] = mod_name dict_instr['rem'].append(rem_instr) # and from the monitoring data structure - del self.db['hosts'][addr_host]['monitoring'][mod_name] + if mod_name in self.db['hosts'][addr_host]['monitoring']: + del self.db['hosts'][addr_host]['monitoring'][mod_name] state = 'success' for mod_in_monitoring in self.db['hosts'][addr_host]['monitoring']: if self.db['hosts'][addr_host]['monitoring'][mod_in_monitoring]['state'] == 'danger': diff --git a/app/mum.py b/app/mum.py index 2a711bb..1f9653d 100755 --- a/app/mum.py +++ b/app/mum.py @@ -157,9 +157,9 @@ def receive(ws): ws.send(json.dumps({"RES_GET_LOADED_CONN_MOD": ml.get_info_mod_conn()})) elif code == "GET_LOADED_NOTIF_MOD": # asekd from notification parameters page ws.send(json.dumps({"RES_GET_LOADED_NOTIF_MOD": ml.get_info_mod_notification()})) - elif code == "GET_ALL_SUBSCRIPTIONS": # asekd from notification parameters page + elif code == "GET_ALL_SUBSCRIPTIONS": # asekd from notification parameters page ws.send(json.dumps({"RES_GET_ALL_SUBSCRIPTIONS": ml.get_all_subscriptions()})) - elif code == "SET_IDLE_STATE": + elif code == "SET_IDLE_STATE": # asked from hostpage ml.set_idling_state(msg["SET_IDLE_STATE"]) dict_host_info = ml.get_host_info(msg["SET_IDLE_STATE"]) dict_host_info['loaded_moni_mod'] = ml.get_info_mod_monitoring() @@ -168,7 +168,7 @@ def receive(ws): elif code == "SET_MOD_ACTIVATION": # asked from hostpage, at the block activation conf ml.update_activated_modules(msg["SET_MOD_ACTIVATION"]) ws.send(json.dumps({"RES_GET_HOSTS": ml.db.get_hosts()})) - elif code == "TEST_CONN": + elif code == "TEST_CONN": # asked from hostpage, at the connection configuration modal try: ml.test_connection(msg["TEST_CONN"]["addr_host"], msg["TEST_CONN"]["conn_mod_name"]) @@ -183,7 +183,7 @@ def receive(ws): ws.send(json.dumps({"RES_INFO_HOST": ml.get_host_info(args['addr_host'])})) elif code == "GET_KEYS_LIST": # asked from hostpage, at the connection configuration ws.send(json.dumps({"KEYS_LIST": ml.get_public_keys_list()})) - elif code == "TASK_LIST": + elif code == "TASK_LIST": # asked from the header controller ws.send(json.dumps({"RES_TASK_LIST": ml.get_db().get_task_list()})) else: break -- 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 1fbeb70ae972d23e36645b963f594debefb61043 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Mon Apr 27 11:25:31 2015 +0200 commented snmp modules + smtp module do helo request using smtplib --- app/modules/monitoring_modules/15_min_load_snmp_linux.py | 8 ++++++-- app/modules/monitoring_modules/cpu_snmp_linux.py | 12 +++++++----- app/modules/monitoring_modules/disk_snmp_linux.py | 10 ++++++---- app/modules/monitoring_modules/http.py | 5 ++++- app/modules/monitoring_modules/memory_snmp_linux.py | 10 ++++++---- app/modules/monitoring_modules/smtp.py | 13 ++++++++++--- app/modules/monitoring_modules/swap_snmp_linux.py | 10 ++++++---- 7 files changed, 45 insertions(+), 23 deletions(-) diff --git a/app/modules/monitoring_modules/15_min_load_snmp_linux.py b/app/modules/monitoring_modules/15_min_load_snmp_linux.py index 00ab092..6334708 100644 --- a/app/modules/monitoring_modules/15_min_load_snmp_linux.py +++ b/app/modules/monitoring_modules/15_min_load_snmp_linux.py @@ -9,6 +9,10 @@ connection = "snmp" def check(conn, mnce): - oid = ".1.3.6.1.4.1.2021.10.1.3.3" - load = float(conn.exec_command(oid)) + # http://www.oid-info.com/get/1.3.6.1.4.1.2021.10.1.3 (.X) + # X = 1 : 5 min load + # X = 2 : 10 min load + # X = 3 : 15 min load + oid_15_min_load = ".1.3.6.1.4.1.2021.10.1.3.3" + load = float(conn.exec_command(oid_15_min_load)) return load \ No newline at end of file diff --git a/app/modules/monitoring_modules/cpu_snmp_linux.py b/app/modules/monitoring_modules/cpu_snmp_linux.py index fad9f05..fa395e3 100644 --- a/app/modules/monitoring_modules/cpu_snmp_linux.py +++ b/app/modules/monitoring_modules/cpu_snmp_linux.py @@ -10,11 +10,13 @@ connection = "snmp" def check(conn, mnce): """ - Check the greatest between the user and system CPU charge + Returns the greatest between the user and system CPU charge """ - oid = ".1.3.6.1.4.1.2021.11.9.0" - user_cpu_charge = int(conn.exec_command(oid)) - oid = ".1.3.6.1.4.1.2021.11.10.0" - system_cpu_charge = int(conn.exec_command(oid)) + # http://www.oid-info.com/get/1.3.6.1.4.1.2021.11.9.0 + oid_user_cpu_charge = ".1.3.6.1.4.1.2021.11.9.0" + user_cpu_charge = int(conn.exec_command(oid_user_cpu_charge)) + # http://www.oid-info.com/get/1.3.6.1.4.1.2021.11.10.0 + oid_system_cpu_charge = ".1.3.6.1.4.1.2021.11.10.0" + system_cpu_charge = int(conn.exec_command(oid_system_cpu_charge)) res_cpu = max(user_cpu_charge, system_cpu_charge) return res_cpu \ No newline at end of file diff --git a/app/modules/monitoring_modules/disk_snmp_linux.py b/app/modules/monitoring_modules/disk_snmp_linux.py index 1ebf706..c18d153 100644 --- a/app/modules/monitoring_modules/disk_snmp_linux.py +++ b/app/modules/monitoring_modules/disk_snmp_linux.py @@ -8,10 +8,12 @@ connection = "snmp" def check(conn, mnce): - oid = ".1.3.6.1.4.1.2021.9.1.7.1" - total_space_on_disk = float(conn.exec_command(oid)) - oid = ".1.3.6.1.4.1.2021.9.1.8.1" - disk_used = float(conn.exec_command(oid)) + # http://www.oid-info.com/get/1.3.6.1.4.1.2021.9.1.7.1 + oid_available_space = ".1.3.6.1.4.1.2021.9.1.7.1" + total_space_on_disk = float(conn.exec_command(oid_available_space)) + # http://www.oid-info.com/get/1.3.6.1.4.1.2021.9.1.8.1 + oid_used_space = ".1.3.6.1.4.1.2021.9.1.8.1" + disk_used = float(conn.exec_command(oid_used_space)) try: percent_disk_used = round((disk_used * 100) / total_space_on_disk, 2) except ZeroDivisionError: diff --git a/app/modules/monitoring_modules/http.py b/app/modules/monitoring_modules/http.py index 8ba058f..1475b31 100644 --- a/app/modules/monitoring_modules/http.py +++ b/app/modules/monitoring_modules/http.py @@ -14,17 +14,20 @@ def check(addr_host, port_list, cnfe): http_port_found = False try: for i in range(len(port_list)): + # for each http port detected for this host if port_list[i]['portname'] == part: http_port_found = True + # the result of the check is true if urlopen returns the http code 200 res_http_check = urllib2.urlopen("http://" + addr_host + ":" + str(port_list[i]['portid']), None, 10 ).getcode() == 200 if not http_port_found: + # if there is no http port detected for this host exception_inst = getattr(cnfe, "CommandNotFoundException")( part, addr_host ) raise exception_inst return res_http_check - except urllib2.URLError: + except Exception: return False \ No newline at end of file diff --git a/app/modules/monitoring_modules/memory_snmp_linux.py b/app/modules/monitoring_modules/memory_snmp_linux.py index f2a0e49..fbbc95a 100644 --- a/app/modules/monitoring_modules/memory_snmp_linux.py +++ b/app/modules/monitoring_modules/memory_snmp_linux.py @@ -8,10 +8,12 @@ connection = "snmp" def check(conn, mnce): - oid = ".1.3.6.1.4.1.2021.4.5.0" - total_mem = float(conn.exec_command(oid)) - oid = ".1.3.6.1.4.1.2021.4.6.0" - mem_used = float(conn.exec_command(oid)) + # http://www.oid-info.com/get/1.3.6.1.4.1.2021.4.5.0 + oid_total_ram_avaliable = ".1.3.6.1.4.1.2021.4.5.0" + total_mem = float(conn.exec_command(oid_total_ram_avaliable)) + # http://www.oid-info.com/get/1.3.6.1.4.1.2021.4.6.0 + oid_total_ram_used = ".1.3.6.1.4.1.2021.4.6.0" + mem_used = float(conn.exec_command(oid_total_ram_used)) try: percent_mem_used = round((mem_used * 100) / total_mem, 2) except ZeroDivisionError: diff --git a/app/modules/monitoring_modules/smtp.py b/app/modules/monitoring_modules/smtp.py index 253d5bc..531f13e 100644 --- a/app/modules/monitoring_modules/smtp.py +++ b/app/modules/monitoring_modules/smtp.py @@ -1,6 +1,6 @@ __author__ = 'aguilbaud' -import telnetlib +import smtplib compatible_os = ["all"] block = "network" @@ -10,14 +10,21 @@ connection = "" def check(addr_host, port_list, cnfe): - res_smtp_check = True + res_smtp_check = False smtp_port_found = False try: for i in range(len(port_list)): + # for each smtp port detected for this host if port_list[i]['portname'] == part: smtp_port_found = True - res_smtp_check = telnetlib.Telnet(addr_host, int(port_list[i]['portid']), 10).read_some() != "" + # try to connect to this port, with a timeout of 10 seconds + smtp_conn_inst = smtplib.SMTP(addr_host, int(port_list[i]['portid']), 10) + # send a HELO request and should return a tuple with 250 as first member if OK + res_smtp_check = smtp_conn_inst.helo()[0] == 250 + # close the connection when finished + smtp_conn_inst.quit() if not smtp_port_found: + # if there is no smtp port detected for this host exception_inst = getattr(cnfe, "CommandNotFoundException")( part, addr_host ) diff --git a/app/modules/monitoring_modules/swap_snmp_linux.py b/app/modules/monitoring_modules/swap_snmp_linux.py index 8f8622c..c7940ec 100644 --- a/app/modules/monitoring_modules/swap_snmp_linux.py +++ b/app/modules/monitoring_modules/swap_snmp_linux.py @@ -8,10 +8,12 @@ connection = "snmp" def check(conn, mnce): - oid = ".1.3.6.1.4.1.2021.4.3.0" - total_swap = float(conn.exec_command(oid)) - oid = ".1.3.6.1.4.1.2021.4.4.0" - swap_used = total_swap - float(conn.exec_command(oid)) + # http://www.oid-info.com/get/1.3.6.1.4.1.2021.4.3.0 + oid_total_swap_size = ".1.3.6.1.4.1.2021.4.3.0" + total_swap = float(conn.exec_command(oid_total_swap_size)) + # http://www.oid-info.com/get/1.3.6.1.4.1.2021.4.4.0 + oid_avaliable_swap_space = ".1.3.6.1.4.1.2021.4.4.0" + swap_used = total_swap - float(conn.exec_command(oid_avaliable_swap_space)) try: percent_swap_used = round( (swap_used * 100) / total_swap, 2) except ZeroDivisionError: -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm