This is a small tutorial that shows how to use Netbox (DCIM) and Director Automation to manage location data for the Icingaweb2 Maps Module.
Requirements
This tutorial assumes you have familiarity with Netbox and Director Automation of Netbox Devices and/or Virtual Machines.
Overview
Netbox Site contains Latiude/Longitude data which can be used by the Icingaweb2 Maps Module to create a reliable map of monitoring over a geographical area.
Director automation along with Netbox custom validation can ensure that every host in Icinga has a lat/long value.
How it works
- In Netbox add Custom Validation to Site objects so the fields latitude and longitude are required fields and optionally custom validation to Virtual Machines to make Site a required field.
This step ensures the data Icinga will rely on is validated by Netbox at data entry time - Add a Director Import Source for Netbox Sites.
- Add a Director Import Source Modifier that combines the latitude and longitude on the site object into a single value
<latitude>,<longitude>
which is needed by the Icingaweb2 Maps Module - Add a Director Sync Rule which creates a site host template that includes a var named
geolocation
and has the combined value from step 3 - In the Director Sync Rule’s that create Netbox Devices/Virtual Machines to create the Host object, the sync rule should have a property to import the site host template.
Now, whenever a new NetBox Device/Virtual Machine to be monitored is added to Netbox, automation will create an Icinga Host linked to a site templates which contains the vars.geolocation = "<latitude>,<longitude>"
value needed by the maps modules to show where devices are located.
If the site latitude and longitude is incorrect and updated in Netbox then the automation next runs Icinga site template and all hosts that import that template will get the new value.