def get_mem_info(self): status = {} with open("/proc/meminfo") as mem: for line in mem: key = line.strip().split()[0].split(':')[0] value = line.strip().split()[1] status[key.lower()] = (long(value)) return convert_dict_to_object(status)
def get_mem_info(self): status = { 'memtotal': 0, 'memtotal': 0, 'memfree': 0, 'cached': 0, 'buffers': 0, 'swaptotal': 0, 'swapfree': 0 } return convert_dict_to_object(status)
def get_mysql_memory_report(self): my_dic = {} variables = self.__my_conn.mysql_show_variables() pid_file = variables['pid_file'] os_get = OS(None) try: my_dic = os_get.get_pid_memory_info(None, pid_file) if my_dic != None: return convert_dict_to_object(dict_key2lower(my_dic)) else: return None except: pass
def get_mysql_tcp_state(self): my_dic = {} os_get = OS(None) variables = self.__my_conn.mysql_show_variables() try: timewait = os_get.get_tcp_status(variables['port'], 'TIME_WAIT') established = os_get.get_tcp_status(variables['port'], 'ESTABLISHED') except: timewait = 0 established = 0 my_dic['time_wait'] = timewait my_dic['established'] = established return convert_dict_to_object(dict_key2lower(my_dic))
def get_mysql_mem_usage(self): my_dic = {} os_get = OS(None) mysql_usage = self.__my_conn.mysql_memory_usage() meminfo = os_get.get_mem_info() try: ram = long(kbytes2bytes(meminfo.memtotal)) # bytes if ram < mysql_usage: ram = CONS_RAM_SERVER # 128 GB Ram except: ram = CONS_RAM_SERVER # 128 GB Ram my_dic['mysql_usage'] = fixfloat(round(mysql_usage, 2)) #bytes my_dic['usage_ram_free_size'] = fixfloat(round(ram - mysql_usage, 2)) my_dic['usagem_ram_percent'] = round(mysql_usage * 100 / ram, 2) return convert_dict_to_object(dict_key2lower(my_dic))
def get_now(self): my_dic = self.__my_conn.mysql_get_now() if my_dic != None: return convert_dict_to_object(dict_key2lower(my_dic)) else: return None
def get_show_innodb_status(self): my_dic = self.__my_conn.mysql_show_engine_innodb_status() if my_dic != None: return convert_dict_to_object(dict_key2lower(my_dic)) else: return None
def get_show_variables(self): my_dic = self.__my_conn.mysql_show_variables() if my_dic != None: return convert_dict_to_object(dict_key2lower(my_dic)) else: return None
def get_gpq(self): my_dic = self.__my_conn.mysql_query_per_second() if my_dic != None: return convert_dict_to_object(dict_key2lower(my_dic)) else: return None
def get_databases_status(self): my_dic = self.__my_conn.mysql_show_database_usage_status() if my_dic != None: return convert_dict_to_object(dict_key2lower(my_dic)) else: return None