<commit_before>%# If got no group, bailout
%if not group:
%rebase layout title='Invalid group name'

Invalid group name

%else:

%if group=='all':
%groupname = 'all'
%groupalias = 'All hosts and services'
%title = 'Minemap for all hosts and services'
%else:
%groupname = group.get_name()
%groupalias = group.alias
%title = "Minemap for: <a href='/hosts-group/%s'>%s</a>" % (groupname, groupalias)
%end

%helper = app.helper
%datamgr = app.datamgr

%#rows and columns will contain, respectively, all different hosts and all different services ...
%rows = []
%columns = []

%nHosts=0
%hUp=0
%hDown=0
%hUnreachable=0
%hPending=0
%hUnknown=0
%for h in hosts:
	%if not h.get_name() in rows:
		%nServices=0
		%for s in h.services:
			%nServices=nServices+1
			%if not s.get_name() in columns:
				%columns.append(s.get_name())
			%end
		%end

		%if nServices > 0:
			%rows.append(h.get_name())
			%nHosts=nHosts+1
			%if h.state == 'UP':
				%hUp=hUp+1
			%elif h.state == 'DOWN':
				%hDown=hDown+1
			%elif h.state == 'UNREACHABLE':
				%hUnreachable=hUnreachable+1
			%elif h.state == 'PENDING':
				%hPending=hPending+1
			%else:
				%hUnknown=hUnknown+1
			%end
		%end
	%end
%end
%if nHosts > 0:
	%pctUp			= round(100.0 * hUp / nHosts, 2)
	%pctDown		= round(100.0 * hDown / nHosts, 2)
	%pctUnreachable	= round(100.0 * hUnreachable / nHosts, 2)<commit_msg>Include host in minemap even if no services are configured for this host<commit_after>%# If got no group, bailout
%if not group:
%rebase layout title='Invalid group name'

Invalid group name

%else:

%if group=='all':
%groupname = 'all'
%groupalias = 'All hosts and services'
%title = 'Minemap for all hosts and services'
%else:
%groupname = group.get_name()
%groupalias = group.alias
%title = "Minemap for: <a href='/hosts-group/%s'>%s</a>" % (groupname, groupalias)
%end

%helper = app.helper
%datamgr = app.datamgr

%#rows and columns will contain, respectively, all different hosts and all different services ...
%rows = []
%columns = []

%nHosts=0
%hUp=0
%hDown=0
%hUnreachable=0
%hPending=0
%hUnknown=0
%for h in hosts:
	%if not h.get_name() in rows:
		%# Include host name even if it has no services ...
		%rows.append(h.get_name())
		
		%nServices=0
		%for s in h.services:
			%nServices=nServices+1
			%if not s.get_name() in columns:
				%columns.append(s.get_name())
			%end
		%end

		%if nServices > 0:
			%nHosts=nHosts+1
			%if h.state == 'UP':
				%hUp=hUp+1
			%elif h.state == 'DOWN':
				%hDown=hDown+1
			%elif h.state == 'UNREACHABLE':
				%hUnreachable=hUnreachable+1
			%elif h.state == 'PENDING':
				%hPending=hPending+1
			%else:
				%hUnknown=hUnknown+1
			%end
		%end
	%end
%end
%if nHosts > 0:
	%pctUp			= round(100.0 * hUp / nHosts, 2)
	%pctDown		= round(100.0 * hDown / nHosts, 2)
	%pctUnreachable	= round(100.0 * hUnreachable / nHosts, 2)
{'fraction_non_alphanumeric': 0.15479985830676585, 'fraction_numerical': 0.021962451292950762, 'mean_word_length': 3.810902896081772, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4541586', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1149, 'n_words': 300}