Beispiel #1
0
    def check_host_bigip_pool(self):
        os_get = MetaOS()
        _local_ip_string = os_get.get_network_ip_byiface(os_get.get_network_default_gateway_iface())
        #_local_ip_string = '10.80.40.13'
        _local_ip_adrress_long = ip2long(_local_ip_string)
        log.debug("BigIP: Start query in pools... this very expensive...")
        for poolname in self.bigip.getAllPools():
            result_member = self.bigip.getAllMembersOfPool(poolname.strip())
            for row_host in result_member.keys():

                result_ip_address_long = ip2long(str(row_host))
                if _local_ip_adrress_long == result_ip_address_long:
                    self.exist_in_pool = True
                    log.debug("BigIP: This server(%s) has found in  %s" % (_local_ip_string, poolname))
                    avail = result_member.get(row_host).get('avail')
                    enabled = result_member.get(row_host).get('enabled')
                    cons_a = CONS_BIGIP_AVAIL.get(1)
                    cons_b = CONS_BIGIP_ENABLE.get(1)
                    if avail == cons_a and enabled == cons_b:
                        self.enabled_in_poll = True
                        log.debug(
                            "BigIP: This server(%s) has found in and Enabled :-) %s" % (_local_ip_string, poolname))
                        break
                    else: # Break internal loop for row_host
                        log.debug(
                            "BigIP: This server(%s) has found in %s but unavailable :-(" % (_local_ip_string, poolname))
                else:
                    continue
            if self.enabled_in_poll:
                break
Beispiel #2
0
    def collect_size_status(self, priority=1):
        '''
        mysql_version = self.mysqldb.get_mysql_version()
        priority_select = None

        if mysql_version < (5,5,0):
            priority_select = CONS_COLLECT_FOR["INVOKED"]
        else:
            priority_select = CONS_COLLECT_FOR["CONTINUOUS"]
        '''
        ts = str(int(time.time()))
        get_os = MetaOS()
        if bool(self.mysqldb.get_mysql_ping()):
            # Others Status
            # MySQL 5.1.x is very very slower to get SELECT sum(.... from information_schema.tables
            '''
            mysql_version = self.mysqldb.get_mysql_version()
            priority_select = None

            if mysql_version < (5,5,0):
                priority_select = CONS_COLLECT_FOR["INVOKED"]
            else:
                priority_select = CONS_COLLECT_FOR["CONTINUOUS"]
            '''
            total_data = 0
            number_database = 0
            file_system_used = 0

            if priority == CONS_COLLECT_FOR["INVOKED"]:
                try:
                    status = self.mysqldb.get_databases_status()
                    total_data = status.total_data
                    number_database = status.number_database
                except:
                    pass

                self.write_key("db.mysql.total_size", total_data, ts)
                self.write_key("db.mysql.number_database", number_database, ts)

            ''' get file usage on Operational System viwer '''
            if priority == CONS_COLLECT_FOR["CONTINUOUS"] or priority == CONS_COLLECT_FOR["BOOTH"]:
                try:
                    file_system_used = get_os.get_folder_size(self.datadir)
                except:
                    pass

                self.write_key("db.mysql.filesystem_used", file_system_used, ts)