{% extends 'generic/_base.html' %} {% load helpers %} {% block title %}Takeover: {{ object }}{% endblock %} {% block content %}

Takeover of the Checkmk site {{ object|linkify }}

Most objects exist in NetBox and in Checkmk already. The analysis compares both and changes nothing. The hosts with the same name are then adopted in stages: each stage marks the next hosts and opens their preview; deploying it takes them over, with the usual limits and approvals.

{% if object.folder_mode != "new_hosts" %}
Folders follow the template on this instance: every adopted host is moved to the folder of its template. To leave the hosts where they are, set Folders to Only new hosts on the instance.
{% endif %}
{% csrf_token %}
{% if analysis %} Last analysis {{ analysis.created|isodatetime:"minutes" }}{% if analysis.user %} by {{ analysis.user }}{% endif %}. CSV {% endif %}
{% if analysis %}

Result

Same name and address{{ counts.name_ip|default:0 }}
Same name, other address{{ counts.name_only|default:0 }}
Cannot be adopted{{ counts.blocked|default:0 }} (among the two above; see the reason in the table)
Same address, other name{{ counts.ip_only|default:0 }}
Only in NetBox{{ counts.netbox_only|default:0 }}
Only in Checkmk{{ counts.checkmk_only|default:0 }}
Managed already{{ counts.managed|default:0 }}
Mapping errors{{ counts.errors|default:0 }}{% if counts.errors %} (fix them first: Changes){% endif %}

Adopt in stages

{% for key, p in progress.items %}
{% if key == "name_ip" %}Same name and address{% else %}Same name, other address{% endif %} {% if p.total %}{{ p.adopted }} of {{ p.total }} adopted{% if p.marked %}, {{ p.marked }} marked{% endif %}{% else %}none{% endif %}
{% if p.total %}
{{ p.percent }} %
{% endif %}
{% endfor %} {% if can_adopt %}
{% csrf_token %}
hosts

A stage marks the hosts for adoption and opens their preview. A discarded preview keeps the marks: the next deploy adopts them. Adoptions count as changes against the limits; large stages need approval.

{% if progress.name_ip.marked or progress.name_only.marked %}
{% csrf_token %}
{% endif %} {% else %}

Adopting needs the action adopt on this instance.

{% endif %}

What an adopted host gets in Checkmk

  • The label {{ settings.prefix }}/id (its identity) and the other {{ settings.prefix }}/… labels such as site, role and platform. Foreign labels stay.
  • locked_by = netbox / {{ settings.lock_id }}: Checkmk shows the host as managed by NetBox and locks the attributes below in its GUI.
  • Locked attributes: alias, IPv4 and IPv6 address, address family and monitoring site, set from NetBox. What NetBox has no value for (no description, no IPv6 address, no monitoring site) stays as it is in Checkmk and unlocked.
  • {% if settings.tag_groups %}
  • Own tag groups: {% for g in settings.tag_groups %}{{ g }}{% if not forloop.last %}, {% endif %}{% endfor %}.
  • {% endif %} {% if settings.contacts %}
  • Contact groups {{ settings.prefix }}_… of the responsible teams.
  • {% endif %}
  • Folder: {% if settings.keeps_folders %}stays where it is (folders only for new hosts){% else %}moved to the folder of its template{% endif %}.

Everything else (parents set by hand, other tags, rules, services) is left alone. Hand back removes all of the above again and leaves the host as a manually configured one; {% if settings.on_removal == "hand_back" %}this instance hands hosts back when their object leaves{% else %}this instance deletes the host when its object leaves (after the grace period); for a takeover Hand back is safer{% endif %}.

{% for section in sections %}

{{ section.title }} {{ section.total }}

{{ section.help }}

{% if section.rows %}
{% if section.key != "checkmk_only" %}{% endif %} {% if section.key != "netbox_only" %}{% endif %} {% if section.key != "checkmk_only" %}{% endif %} {% if section.key != "netbox_only" %}{% endif %} {% if section.key == "name_ip" or section.key == "name_only" %}{% endif %} {% for row in section.rows %} {% if section.key != "checkmk_only" %}{% endif %} {% if section.key != "netbox_only" %}{% endif %} {% if section.key != "checkmk_only" %}{% endif %} {% if section.key != "netbox_only" %}{% endif %} {% if section.key == "name_ip" or section.key == "name_only" %} {% endif %} {% endfor %}
NetBox objectCheckmk hostFolderNetBox addressCheckmk addressAdopting changes
{% if row.url %}{{ row.name }}{% else %}{{ row.name }}{% endif %}{% if row.host %}{{ row.host }}{% else %}{{ row.hosts|join:", " }}{% endif %}{% if row.site %} ({{ row.site }}){% endif %}{{ row.folder|default:"" }}{{ row.netbox_ip|placeholder }}{{ row.checkmk_ip|placeholder }}{% if row.problem %}Not adopted: {{ row.problem }}{% else %}{{ row.changes|join:", "|default:"nothing besides the marker" }}{% if row.kept %}
keeps: {{ row.kept }}
{% endif %}{% endif %}
{% if limited and section.total > rows %}
Show all {{ section.total }} or download the CSV.
{% endif %} {% endif %}
{% endfor %} {% endif %} {% endblock %}