def bytes(self, check_config): status = self._value_to_status_less(self.stats['bytes'], check_config, human_to_bytes) output = 'Memcached memory: {}'.format( bytes_to_human(self.stats['bytes']) ) return status, output
def upload_data_speed(self, check_config): ul, _, _, _ = self.get_network_data( interface=check_config['interface']) ul = round(ul, 2) return (self._value_to_status_less(ul, check_config, human_to_bytes), 'Upload speed: {}/s'.format(bytes_to_human(ul)))
def available(self, check_config): available = self.virtual_memory.available return ( self._value_to_status_more(available, check_config, human_to_bytes), 'Memory available: {}'.format(bytes_to_human(available)) )
def used_memory_rss(self, check_config): status = self._value_to_status_less( self.redis_info['used_memory_rss'], check_config, human_to_bytes ) output = 'Used memory RSS: {}'.format( bytes_to_human(self.redis_info['used_memory_rss']) ) return status, output
def used_percent(self, check_config): used_percent = int(self.stats['bytes'] * 100 / self.stats['limit_maxbytes']) status = self._value_to_status_less(used_percent, check_config, self._strip_percent_sign) output = 'Memcached memory used: {}% of {}'.format( used_percent, bytes_to_human(self.stats['limit_maxbytes'])) return status, output
def download_data_speed(self, check_config): _, dl, _, _ = self.get_network_data( interface=check_config['interface']) dl = round(dl, 2) return ( self._value_to_status_less(dl, check_config, human_to_bytes), 'Download speed: {}/s'.format(bytes_to_human(dl)) )
def upload_data_speed(self, check_config): ul, _, _, _ = self.get_network_data( interface=check_config['interface']) ul = round(ul, 2) return ( self._value_to_status_less(ul, check_config, human_to_bytes), 'Upload speed: {}/s'.format(bytes_to_human(ul)) )
def used_percent(self, check_config): used_percent = int( self.stats['bytes'] * 100 / self.stats['limit_maxbytes'] ) status = self._value_to_status_less(used_percent, check_config, self._strip_percent_sign) output = 'Memcached memory used: {}% of {}'.format( used_percent, bytes_to_human(self.stats['limit_maxbytes']) ) return status, output
def download_data_speed(self, check_config): _, dl, _, _ = self.get_network_data( interface=check_config['interface']) dl = round(dl, 2) return (self._value_to_status_less(dl, check_config, human_to_bytes), 'Download speed: {}/s'.format(bytes_to_human(dl)))
def test_bytes_to_human(self): self.assertEqual('0B', bytes_to_human(0)) self.assertEqual('1000B', bytes_to_human(1000)) self.assertEqual('1.0K', bytes_to_human(1024)) self.assertEqual('5.0M', bytes_to_human(5 * 1024 * 1024)) self.assertEqual('10.0G', bytes_to_human(10 * 1024 * 1024 * 1024))
def test_bytes_to_human(self): self.assertEquals('0B', bytes_to_human(0)) self.assertEquals('1000B', bytes_to_human(1000)) self.assertEquals('1.0K', bytes_to_human(1024)) self.assertEquals('5.0M', bytes_to_human(5*1024*1024)) self.assertEquals('10.0G', bytes_to_human(10*1024*1024*1024))
def bytes(self, check_config): status = self._value_to_status_less(self.stats['bytes'], check_config, human_to_bytes) output = 'Memcached memory: {}'.format( bytes_to_human(self.stats['bytes'])) return status, output
def used_memory_rss(self, check_config): status = self._value_to_status_less( self.disque_info['used_memory_rss'], check_config, human_to_bytes) output = 'Used memory RSS: {}'.format( bytes_to_human(self.disque_info['used_memory_rss'])) return status, output
def available(self, check_config): available = self.virtual_memory.available return (self._value_to_status_more(available, check_config, human_to_bytes), 'Memory available: {}'.format(bytes_to_human(available)))