The clean stats from all the hosts reporting to this host.
483870
def merged(self):
        ''''''
        stats = {}
        for topic in self.client.topics()['topics']:
            for producer in self.client.lookup(topic)['producers']:
                hostname = producer['broadcast_address']
                port = producer['http_port']
                host = '%s_%s' % (hostname, port)
                stats[host] = nsqd.Client(
                    'http://%s:%s/' % (hostname, port)).clean_stats()
        return stats
823876
def clean_report(self, options, sosreport): # pragma: no cover
        ''''''

        if options.report_dir: # override the default location for artifacts (/tmp)
            if os.path.isdir(options.report_dir):
                self.report_dir = options.report_dir
        self.origin_path, self.dir_path, self.session, self.logfile, self.uuid = self._prep_environment()
        self._start_logging(self.logfile)
        self._get_disclaimer()
        if options.domains:
            self.domains = options.domains
        if options.keywords:
            self.keywords = options.keywords
            self._keywords2db()
        if not sosreport:
            if not options.files:
                raise Exception("Error: You must supply either an sosreport and/or files to process")

            self.logger.con_out("No sosreport supplied. Only processing specific files")
            self._clean_files_only(options.files)

        else:   # we DO have an sosreport to analyze
            self.report = self._extract_sosreport(sosreport)
            self._make_dest_env()   # create the working directory
            if options.hostname_path:
                self.hostname, self.domainname = self._get_hostname(options.hostname_path)
            else:
                self.hostname, self.domainname = self._get_hostname()

            if options.files:
                self._add_extra_files(options.files)

            if self.hostname:   # if we have a hostname that's not a None type
                self.hn_db['host0'] = self.hostname     # we'll prime the hostname pump to clear out a ton of useless logic later

            self._process_hosts_file()  # we'll take a dig through the hosts file and make sure it is as scrubbed as possible

        self._domains2db()
        files = self._file_list(self.dir_path)
        self.logger.con_out("IP Obfuscation Start Address - %s", self.start_ip)
        self.logger.con_out("*** SOSCleaner Processing ***")
        self.logger.info("Working Directory - %s", self.dir_path)
        for f in files:
            self.logger.debug("Cleaning %s", f)
            self._clean_file(f)
        self.logger.con_out("*** SOSCleaner Statistics ***")
        self.logger.con_out("IP Addresses Obfuscated - %s", len(self.ip_db))
        self.logger.con_out("Hostnames Obfuscated - %s" , len(self.hn_db))
        self.logger.con_out("Domains Obfuscated - %s" , len(self.dn_db))
        self.logger.con_out("Total Files Analyzed - %s", self.file_count)
        self.logger.con_out("*** SOSCleaner Artifacts ***")
        self._create_reports()
        self._create_archive()

        return_data = [self.archive_path, self.logfile, self.ip_report]
        if self.hostname:
            return_data.append(self.hn_report)
        if len(self.dn_db) >= 1:
            return_data.append(self.dn_report)

        return return_data
696446
def _report_self(self):
        '''
        
        '''
        key = "stats:kafka-monitor:self:{m}:{u}".format(
            m=socket.gethostname(),
            u=self.my_uuid)
        self.redis_conn.set(key, time.time())
        self.redis_conn.expire(key, self.settings['HEARTBEAT_TIMEOUT'])
665956
private static void setCleanHost(Matcher matcher, List<String> hosts) {
		// get the host but might be [ipv6]
		String maybeIPv6Host = matcher.group( 1 );
		Matcher ipv6Matcher = NAKED_IPV6_PATTERN.matcher( maybeIPv6Host );
		String cleanHost = maybeIPv6Host;
		if ( ipv6Matcher.matches() ) {
			cleanHost = ipv6Matcher.group( 1 );
			if ( cleanHost == null ) {
				cleanHost = maybeIPv6Host;
			}
		}
		hosts.add( cleanHost );
	}
1014220
def report(self):
        
        # make this prettier
        html = u'<hr/><a name="%s"></a>\n' % self.name()

        # Intro
        html = html + "<h2> Plugin <em>" + self.name() + "</em></h2>\n"

        # Files
        if len(self.copied_files):
            html = html + "<p>Files copied:<br><ul>\n"
            for afile in self.copied_files:
                html = html + '<li><a href="%s">%s</a>' % \
                    (u'..' + _to_u(afile['dstpath']), _to_u(afile['srcpath']))
                if afile['symlink'] == "yes":
                    html = html + " (symlink to %s)" % _to_u(afile['pointsto'])
                html = html + '</li>\n'
            html = html + "</ul></p>\n"

        # Command Output
        if len(self.executed_commands):
            html = html + "<p>Commands Executed:<br><ul>\n"
            # convert file name to relative path from our root
            # don't use relpath - these are HTML paths not OS paths.
            for cmd in self.executed_commands:
                if cmd["file"] and len(cmd["file"]):
                    cmd_rel_path = u"../" + _to_u(self.commons['cmddir']) \
                        + "/" + _to_u(cmd['file'])
                    html = html + '<li><a href="%s">%s</a></li>\n' % \
                        (cmd_rel_path, _to_u(cmd['exe']))
                else:
                    html = html + '<li>%s</li>\n' % (_to_u(cmd['exe']))
            html = html + "</ul></p>\n"

        # Alerts
        if len(self.alerts):
            html = html + "<p>Alerts:<br><ul>\n"
            for alert in self.alerts:
                html = html + '<li>%s</li>\n' % _to_u(alert)
            html = html + "</ul></p>\n"

        # Custom Text
        if self.custom_text != "":
            html = html + "<p>Additional Information:<br>\n"
            html = html + _to_u(self.custom_text) + "</p>\n"

        if six.PY2:
            return html.encode('utf8')
        else:
            return html
302874
private List<TaskTrackerStatus> getStatusesOnHost(String hostName) {
    List<TaskTrackerStatus> statuses = new ArrayList<TaskTrackerStatus>();
    synchronized (taskTrackers) {
      for (TaskTracker tt : taskTrackers.values()) {
        TaskTrackerStatus status = tt.getStatus();
        if (hostName.equals(status.getHost())) {
          statuses.add(status);
        }
      }
    }
    return statuses;
  }
1069122
def save(self):
        ""
        with open(self.state_file, "w") as fh:
            json.dump({
                "hosts": self.hosts,
                "stats": self.stats,
            }, fh)
56712
def dump_all(self, silent='NO'):
        
        all_params = []
        all_params.append(dict(name='phone', val=self.transport))
        all_params.append(dict(name='username', val=self.username))
        all_params.append(dict(name='user', val=self.user))
        all_params.append(dict(name='hostname', val=self.hostname))
        all_params.append(dict(name='host', val=self.host))
        all_params.append(dict(name='cpu_pct', val=self.host_cpu_pct))
        all_params.append(dict(name='num_proc', val=self.host_num_processes))
        all_params.append(dict(name='mem_avail', val=self.host_mem_available))
        all_params.append(dict(name='mem_total', val=self.host_mem_total))
        if silent != 'NO':
            for a in all_params:
                print(a['name'].ljust(14) + '= ' + a['val'])
    
        return all_params
320543
def linkify_hostgroups_hosts(self, hosts):
        
        for hostgroup in self:
            members = hostgroup.get_hosts()
            # The new members identifiers list
            new_members = []
            for member in members:
                # member is an host name
                member = member.strip()
                if not member:  # void entry, skip this
                    continue

                if member == '*':
                    # All the hosts identifiers list
                    new_members.extend(list(hosts.items.keys()))
                else:
                    host = hosts.find_by_name(member)
                    if host is not None:
                        new_members.append(host.uuid)
                        if hostgroup.uuid not in host.hostgroups:
                            host.hostgroups.append(hostgroup.uuid)
                    else:
                        hostgroup.add_unknown_members(member)

            # Make members unique
            new_members = list(set(new_members))

            # We find the id, we replace the names
            hostgroup.replace_members(new_members)
444343
def _clean(self):
        
        if CleanupPolicy.EVERYTHING in self.cleanup:
                self.cleanup_containers()
                self.cleanup_volumes()
                self.cleanup_images()
                self._clean_tmp_dirs()
        else:
            if CleanupPolicy.CONTAINERS in self.cleanup:
                self.cleanup_containers()
            if CleanupPolicy.VOLUMES in self.cleanup:
                self.cleanup_volumes()
            if CleanupPolicy.IMAGES in self.cleanup:
                self.cleanup_images()
            if CleanupPolicy.TMP_DIRS in self.cleanup:
                self._clean_tmp_dirs()
968582
def clean(self):
        
        to_del = []
        for serv in self:
            if not serv.host:
                to_del.append(serv.uuid)
        for service_uuid in to_del:
            del self.items[service_uuid]
944702
public function clean()
    {
        $this->doctype->clean();
        $this->head->clean();
        $this->script->clean();
    }
1022396
def summarize(self, host):
        '''  '''

        return dict(
            ok          = self.ok.get(host, 0),
            failures    = self.failures.get(host, 0),
            unreachable = self.dark.get(host,0),
            changed     = self.changed.get(host, 0),
            skipped     = self.skipped.get(host, 0)
        )
1330268
def collect_and_report(self):
        
        logger.debug("Metric reporting thread is now alive")

        def metric_work():
            self.process()
            if self.agent.is_timed_out():
                logger.warn("Host agent offline for >1 min.  Going to sit in a corner...")
                self.agent.reset()
                return False
            return True

        every(1, metric_work, "Metrics Collection")
1302781
def report_stats(self):
        """"""
        if not self.previous:
            self.previous = dict()
            for key in self.counters:
                self.previous[key] = 0
        values = {
            'name': self.name,
            'consumer_name': self.consumer_name,
            'counts': dict(self.counters),
            'previous': dict(self.previous)
        }
        self.previous = dict(self.counters)
        return values
1328021
def clean(self):
        """"""

        rnftools.utils.shell('rm -fR "{}" "{}"'.format(self.report_dir, self._html_fn))
1288922
def stats(self, request):
        '''
        '''
        # scheme = 'wss' if request.is_secure else 'ws'
        # host = request.get('HTTP_HOST')
        # address = '%s://%s/stats' % (scheme, host)
        doc = HtmlDocument(title='Live server stats', media_path='/assets/')
        # docs.head.scripts
        return doc.http_response(request)