> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudthinker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Icinga

> Connect the Icinga 2 API with an ApiUser so agents check hosts and services, then acknowledge, recheck, or set downtime.

Connect Icinga 2 so [CloudThinker](https://docs.cloudthinker.io/guide/agents/overview.md) can check hosts, services, problems, and downtimes, and, if you allow it, acknowledge a problem, run a check now, or set downtime. The connection signs in to the Icinga 2 REST API as an `ApiUser` with a password, and can do only what that user's permissions allow.

## Prerequisites

* An Icinga 2 API that CloudThinker can reach over HTTPS, by default on port `5665`. For a private address, follow [Reaching private services](https://docs.cloudthinker.io/guide/connections/overview.md#reaching-private-services).
* Access to the Icinga 2 configuration on the master, to add an `ApiUser` and copy its CA certificate.
* The **Admin** role in your CloudThinker workspace. See [Roles](https://docs.cloudthinker.io/guide/security/roles.md).

## Setup

**1. Create an ApiUser**

On the Icinga master, add an `ApiUser` object, for example in `/etc/icinga2/conf.d/api-users.conf`. Give it a strong password and only the permissions in [Required permissions](#required-permissions):

```text theme={null}
object ApiUser "cloudthinker" {
  password = "<strong password>"
  permissions = [ "status/query", "objects/query/Host", "objects/query/Service", "objects/query/Downtime" ]
}
```

Restart Icinga 2 to load it. See [Icinga's API user instructions](https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/).

**2. Copy the CA certificate**

Icinga signs its API certificate with its own certificate authority by default. Copy the CA certificate from the master, usually `/var/lib/icinga2/certs/ca.crt`.

**3. Connect in CloudThinker**

Open **Settings → Workspace → Connections**, open the **Discover** tab, and select **Icinga**. Click **Connect**, fill in the fields below, then click **Connect** in the dialog.

**Success state:** the connection shows a **Connected** status with your Icinga version. CloudThinker then opens a chat that takes a read-only deep look at the connection ("Often takes about 15 min. You can leave the chat."). To run it again later, open the card's **More** menu and choose **Try in chat**.

## Connection details

| Field | Required | Description |
| - | - | - |
| **API URL** | Yes | The HTTPS address of the Icinga 2 API, with its port and no path, such as `https://icinga.example.com:5665` |
| **API user** | Yes | The name of the `ApiUser` object |
| **API password** | Yes | The password of that `ApiUser` |
| **CA certificate (optional)** | No | The PEM of the CA that issued the API certificate, usually `/var/lib/icinga2/certs/ca.crt` on the master. Leave it empty to use public trust. CloudThinker always checks the certificate and hostname |

CloudThinker checks that the API certificate matches the host name in **API URL**, so use the name the certificate was issued for. It also refuses redirects.

## Required permissions

| You want agents to | `ApiUser` permissions |
| - | - |
| Check hosts, services, problems, and downtimes | `status/query`, `objects/query/Host`, `objects/query/Service`, `objects/query/Downtime` |
| Also acknowledge, recheck, or set and end downtime | Also `actions/acknowledge-problem`, `actions/remove-acknowledgement`, `actions/schedule-downtime`, `actions/remove-downtime`, `actions/reschedule-check` |

> [!TIP]
>
> Start with the four query permissions only. Agents can still investigate every host, and no approval, mistaken or automatic, can change anything in Icinga.

## Agent capabilities

| Capability | What agents can do |
| - | - |
| **Overview** | Report the Icinga version, host totals and hosts down, service problems by state, unhandled problems, and downtimes |
| **Problems** | List hosts not up and services in a problem state, worst first, with how long and the check output. Acknowledged problems and problems in downtime are left out unless you ask |
| **One host** | Read a host's state, address, last check, and output, its services worst first, and its downtimes |
| **Changes** | Acknowledge one host or service problem or remove its acknowledgement, run one check now, set downtime on one host or service, or end one downtime |

Reads run without asking. Each change targets one host or service, and the agent reads it again afterwards to confirm the change. A downtime starts at once and lasts from 1 minute to 7 days. A downtime on a host covers every service on that host, and the agent says so before it asks.

Agents cannot change configuration, add hosts, or send custom notifications. Make those changes in Icinga.

Writes also need **Allow writes** on, which starts on. To lock writes in CloudThinker, open **Icinga** in **Settings → Workspace → Connections** and turn off the **Allow writes** switch on its detail panel.

Every change an agent makes goes through your workspace's [Approvals](https://docs.cloudthinker.io/guide/approvals/overview.md) first. On the default **Auto · Rules + AI · Ask me** mode, AI judgment can let a safe change run without asking — and an Allow [Rule](https://docs.cloudthinker.io/guide/approvals/rules.md) can too. Choose **Manual** to approve every change yourself.

### Verify the connection

```text theme={null}
Give me an Icinga overview: version, hosts down, service problems by state, and current downtimes
```

Expect your Icinga version with real host and service names. A failed section is unavailable data, not zero problems.

### Example prompts

```text theme={null}
Which Icinga hosts are down and which services are CRITICAL right now?
How is web-prod-01 doing in Icinga? Show its services worst first
Recheck the disk service on db-prod-01 in Icinga now
```

## Troubleshooting

> [accordion] Icinga rejected the API user or its password.
>
> Check the `ApiUser` name and password in the Icinga configuration, then edit the connection and paste them again.

> [accordion] The API user signed in, but it lacks the status/query permission. Give it status/query and objects/query permissions.
>
> Add `status/query` and the `objects/query` permissions to the `ApiUser`, restart Icinga 2, and connect again. If a change fails later with a permission error, add the matching `actions/` permission.

> [accordion] That address has no Icinga 2 API. Use the API address, usually on port 5665.
>
> The address points at Icinga Web or another service. Enter the Icinga 2 API address with its port, such as `https://icinga.example.com:5665`, and no path.

> [accordion] Icinga answered with a redirect. Use the exact https API address, such as [https://icinga.example.com:5665](https://icinga.example.com:5665).
>
> Enter the API address Icinga 2 serves directly, not an address that forwards to it.

> [accordion] The Icinga certificate is not trusted. Paste the Icinga CA certificate, usually /var/lib/icinga2/certs/ca.crt on the master.
>
> Paste that file into **CA certificate (optional)**. If CloudThinker says the CA certificate is not valid PEM, paste the full certificate, including its `BEGIN` and `END` lines. If the error stays, the host name in **API URL** does not match the API certificate.

> [accordion] Could not reach the Icinga 2 API over HTTPS. Check the URL, port 5665, and that the sandbox can reach it.
>
> CloudThinker could not open a connection to that address. Confirm the URL starts with `https://`, includes the API port, and that your firewall lets CloudThinker reach it. Browser access from your laptop alone is not enough.

> [accordion] An agent says the Icinga write tool is off
>
> **Allow writes** is off on this connection, so the change was refused and nothing changed. Turn it on in the connection's detail panel, or make the change in Icinga.

## Security

* **Least privilege** — grant only the permissions the agents need for your use case; start read-only and widen later.
* **Read-only by default** — use read-only credentials unless you want agents to make changes through this connection.
* **Rotate credentials** — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
* **Revoke on offboarding** — remove the credential at the provider when you delete a connection or a teammate leaves.

- Use a dedicated `ApiUser` for CloudThinker with an explicit permission list. Never use `*`.
- Port `5665` also carries cluster traffic between Icinga nodes. Limit who can reach it with your firewall.

## Related

> [card] [Approval rules](https://docs.cloudthinker.io/guide/approvals/rules.md)
>
> Decide which Icinga changes run, wait for a person, or are refused.

> [card] [Checkmk](https://docs.cloudthinker.io/guide/connections/checkmk.md)
>
> Check hosts and services on a Checkmk site, then acknowledge or set downtime.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.