Manage Nagios XI hosts, services, contacts, auth servers, and more as Terraform resources instead of clicking through the XI web UI. Nagios XI's REST API has no official Go SDK and several real quirks - every response is HTTP 200 even on failure, PUT addresses objects by their old name on rename, writes don't take effect until a follow-up applyconfig call - this provider handles them internally so your Terraform config doesn't have to.
Nagios XI 5.6.7 and later
terraform {
required_providers {
nagios = {
source = "dunkin0486/nagios"
}
}
}
provider "nagios" {
url = "http://localhost/nagiosxi" # or NAGIOS_URL env var
token = var.nagios_api_token # or API_TOKEN env var
}
resource "nagios_host" "web01" {
host_name = "web01.example.com"
address = "10.0.0.10"
max_check_attempts = "3"
check_period = "24x7"
notification_interval = "30"
notification_period = "24x7"
contacts = ["nagiosadmin"]
templates = ["generic-host"]
}The API token is found in the Nagios XI web UI under Admin > API Key, or via Help > Introduction. See docs/ for full resource and data source reference, and examples/ for more configuration examples.
- Resources:
nagios_host,nagios_hostgroup,nagios_contact,nagios_contactgroup,nagios_service,nagios_servicegroup,nagios_authserver,nagios_timeperiod,nagios_command,nagios_nna_source,nagios_nna_source_group,nagios_nna_user,nagios_user - Data sources:
nagios_host,nagios_hostgroup,nagios_service,nagios_contact,nagios_contactgroup,nagios_servicegroup,nagios_authserver,nagios_user
See CONTRIBUTING.md for build, test, and contribution instructions, including how to run the acceptance test suite against a local Nagios XI instance in Docker.
Open a GitHub Issue and pick the bug report or feature request template - each prompts for the details needed to act on it (for a bug: Nagios XI version, steps to reproduce, expected vs. actual behavior). Filed issues get triaged onto the Nagios Provider Enhancements project board.
Do not open a public issue for a security vulnerability - see SECURITY.md for private reporting instead.
The plan for this provider is to allow complete management of Nagios XI through code. Planned and in-progress work is tracked on the Nagios Provider Enhancements project board, not duplicated here.