{% extends 'admin/master.html' %} {% block body %} {% if host %} {% with active='debug' %} {% include 'admin/_host_tabs.html' with context %} {% endwith %} {% endif %}
{% if not host %}

Debug: {{ hostname or 'pick a host' }}

{% endif %}
{% if mode == 'ansible_host' and ansible_projects %}
{% endif %} {% if rule_preview_groups %}
{% endif %}
{% if rule_preview_error %}
Rule preview: {{ rule_preview_error }}
{% endif %} {% if rule_preview %}
{{ rule_preview.rule_type_label }} Preview — {{ rule_preview.rule_name }} {% if rule_preview.match and rule_preview.match.hit %} Rule matches this host {% elif rule_preview.match and not rule_preview.match.hit %} Rule would NOT match this host {% else %} What the export would render for this host {% endif %}
{% if rule_preview.match and not rule_preview.match.hit %}
This rule does not match the current host — the preview below is hypothetical: the export will skip this rule for {{ hostname }}. {% if rule_preview.match.no_match_reason %} {% set nm = rule_preview.match.no_match_reason %}
First failing condition: {% if nm.match_type == 'host' %} hostname {{ nm.hostname }} ({{ nm.hostname_match }}{% if nm.hostname_match_negate %}, negated{% endif %}) {% else %} tag {{ nm.tag }} = {{ nm.value }} ({{ nm.tag_match }} / {{ nm.value_match }}) {% endif %}
{% endif %}
{% endif %}
{% if not rule_preview.outcomes %}
This rule has no outcomes configured.
{% endif %} {% for o in rule_preview.outcomes %}
{{ o.title }} {% if o.meta %}{{ o.meta }}{% endif %}
{% if o.note %}
{{ o.note }}
{% endif %} {% if o.rows %} {% for label, value in o.rows %} {% endfor %}
{{ label }} {{ value }}
{% endif %}
{% endfor %}
{% endif %} {% if output is mapping %} {% set outcomes = output.get('Outcomes') %} {% set filtered = output.get('Filtered') %} {% set custom = output.get('Custom Attributes') %} {% set full_attrs = output.get('Full Attribute List') %} {% set disabled_info = output.get('Info: Host disabled by Filter', 'MISSING') %} {% macro render_kv(items) %} {% if items %}
{% for k, v in items.items() %}
{{ k }} {{ v }}
{% endfor %}
{% else %}
No entries.
{% endif %} {% endmacro %} {# One rule's contribution to the outcome, and the group total, share this renderer: both are plain key/value data (or a bare value for engines whose outcome is not a dict). #} {% macro render_outcome(data) %} {%- if data is mapping -%}
{%- for key, value in data.items() %}
{{ key }}{{ value }}
{%- endfor %}
{%- else -%}
{{ data }}
{%- endif -%} {% endmacro %} {# Folder attribute values are plain strings, lists (parents) or nested dicts (contactgroups). Render each shape readably instead of dumping the Python repr. #} {% macro render_folder_value(value) %} {%- if value is mapping -%} {%- elif value is string or value is number or value is boolean or value is none -%} {{ value }} {%- elif value is sequence -%} {{ value|join(', ') }} {%- else -%} {{ value }} {%- endif -%} {% endmacro %} {# --- Primary summary: Outcomes + Filtered, both expanded --- #}
Outcomes Actions that will fire for this host
{% if outcomes is mapping %} {{ render_kv(outcomes) }} {% elif outcomes %}
{{ outcomes }}
{% else %}
{% if disabled_info != 'MISSING' %} Host is disabled by a filter rule — no outcome is produced. See the Rules section below. {% else %} No outcome data for this host. {% endif %}
{% endif %}
Filtered Labels After filter / rewrite rules
{{ render_kv(filtered) if filtered else '
No filter/rewrite rules apply — same as full attribute list below.
' | safe }}
{# --- Folder Options: parsed folder attributes, or a loud error --- #} {% if folder_options %}
Folder Options {%- if folder_options.kind == 'create' -%} Checkmk attributes applied to the created folder {%- else -%} Checkmk attributes applied to this host's folder {%- endif -%}
{% if folder_options.error %}
Malformed folder option — silently skipped on export:
{{ folder_options.error }}
{% endif %} {% if folder_options.tree %}
{% for node in folder_options.tree %}
{{ node.parent }}{{ node.name }} {% if loop.last and folder_options.kind == 'move' %} host lands here {% endif %} {% if not node.attributes and not node.error %} no attributes on this level {% endif %}
{% if node.error %}
{{ node.error }}
{% elif node.attributes %}
{% for key, value in node.attributes.items() %}
{{ key }} {{ render_folder_value(value) }}
{% endfor %}
{% endif %}
{% endfor %}
Raw folder value from the rule outcome
{{ folder_options.source }}
{% elif not folder_options.error %}
No folder options for this host.
{% endif %}
{% endif %} {# --- Custom Attributes, only when present --- #} {% if custom %}
Custom Attributes (not Labels) From CustomAttributeRule
{{ render_kv(custom) }}
{% endif %} {# --- Rules drill-down (collapsed accordion by rule group) --- #} {% if rules %} {% set condition_types = { 'equal': "exact match", 'in': "contains", 'not_in': "not contains", 'in_list': "value in your list", 'string_in_list': "string in Python list", 'ewith': "ends with", 'swith': "starts with", 'regex': "regex match", 'bool': "boolean match", 'ignore': "always match" } %} {% set negate = { true: 'not ', false: ' ' } %}
Rules Per-rule match details (click a group to expand)
{% for rule_name, rule_raw in rules.items() %} {% set hit_count = rule_raw['rules'] | selectattr('hit') | list | length %} {% set anchor = 'rule_' ~ rule_name | replace(' ', '_') %} {% endfor %}
{% for rule_name, rule_raw in rules.items() %} {% set anchor = 'rule_' ~ rule_name | replace(' ', '_') %}
{% macro render_condition(cond) %} {% if cond['match_type'] == 'host' %} {{ negate[cond['hostname_match_negate']] }}{{ condition_types[cond['hostname_match']] }} {{ cond['hostname'] }} {% else %} {{ negate[cond['tag_match_negate']] }}{{ condition_types[cond['tag_match']] }} {{ cond['tag'] }} = {{ negate[cond['value_match_negate']] }}{{ condition_types[cond['value_match']] }} {{ cond['value'] }} {% endif %} {% endmacro %} {% for rule in rule_raw['rules'] %} {% endfor %}
Rule Hit Matching condition / first reason it won't match Outcome of this rule Condition Type Last Match
{% if rule['rule_url'] %} {{ rule['name'] }} {% else %} {{ rule['name'] }} {% endif %} {% if rule['hit'] %} {% else %} {% endif %} {% if rule['static'] %} static host-independent — emitted for every host, match conditions ignored {% elif rule['hit'] %} {% if rule['match_reason'] %} {{ render_condition(rule['match_reason']) }} {% else %} always matches {% endif %} {% elif rule['no_match_reason'] %} {{ render_condition(rule['no_match_reason']) }} {% endif %} {% if rule['outcome'] %} {{ render_outcome(rule['outcome']) }} {% elif rule['hit'] %} nothing new — an earlier rule already set it {% else %} {% endif %} {{ rule['condition_type'] }} {{ rule['last_match'] }}
Total outcome — {{ rule_name.capitalize() }} What all matching rules of this group produce together
{% if rule_raw['outcomes'] %} {{ render_outcome(rule_raw['outcomes']) }} {% else %}
No outcome — no rule of this group matched.
{% endif %}
{% endfor %}
{% endif %} {# --- Full Attribute List (collapsed by default) --- #} {% if full_attrs %}
Full Attribute List (raw) All host labels before filter — click to expand
{{ render_kv(full_attrs) }}
{% endif %} {% elif hostname %}
{{ output }}
{% endif %}
{% endblock %}