# Zabbix

## Introduction

To automate monitoring tasks or integrate Zabbix with third-party orchestration tools like Mindflow, you need a secure way to authenticate.

While Zabbix supports username/password authentication via the API, **API Tokens** are the modern, secure standard. They allow for long-lived, revocable access without exposing user credentials in scripts or automation workflows.

This guide covers the generation of a permanent or time-limited token that grants programmatic access to the Zabbix API based on the permissions of the assigned user.

## Walkthrough

### 1. Access the API Token Section

Depending on your user permissions, there are two ways to reach the token management screen:

- **As an Admin:** Go to **Administration → Users → API tokens**. This allows you to create tokens for any user in the system.

  <div class="docs-screenshot-compact">

  ![Api tokens](./assets/api-tokens.png)

  </div>

- **As a Regular User:** Go to **User settings → API tokens** (accessible via the user icon in the top right).
  - _Note: Your User Role must have "Manage API tokens" enabled._

### 2. Configure Token Details

Click the **Create API token** button in the top-right corner and fill in the following fields:

| **Parameter**           | **Description**                                                                                                            |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **Name**                | A recognizable name for the token (e.g., "Mindflow Integration").                                                          |
| **User**                | The user account the token will act as. The token inherits all permissions (Host groups, Templates, Actions) of this user. |
| **Description**         | Optional notes on what this token is used for.                                                                             |
| **Set expiration date** | Uncheck this for a "Permanent" token, or set a specific date/time for security compliance.                                 |
| **Enabled**             | Ensure this is checked to make the token active immediately.                                                               |

   <div class="docs-screenshot-compact">

   ![Api token conf](./assets/api-token-conf.png)

   </div>

### 3. Generate and Save the Token

After clicking **Add**, Zabbix will generate the unique **Auth token** string.

:::note
**CRITICAL:** This is the only time you will ever see the token value. Zabbix does not store the raw token in its database for security reasons.

1. Copy the token immediately.
2. Save it in a secure location (like a password manager or your Mindflow credentials vault).
3. Click **Close**.

:::

   <div class="docs-screenshot-compact">

   ![Api token](./assets/api-token.png)

   </div>

### 4. Regenerating or Revoking Tokens

- **Regenerate:** If a token is lost or leaked, you can click on the token name in the list and select **Regenerate**. This provides a new string and immediately invalidates the old one.
- **Disable/Delete:** Use the status toggle in the list to temporarily disable access, or select the checkbox and click **Delete** to remove the token permanently.

## Configure the Mindflow Credential

With the Zabbix API token copied, you must now create a corresponding secure credential within Mindflow to allow your workflows to communicate with the Zabbix API.

### 1. Initiate Credential Creation

Within the Mindflow platform, navigate to your **Environments**. If you are creating a new credential, use the "Create credential" icon, which is shown here and highlighted in black:

   <div class="docs-screenshot-compact">

   ![Disable delete](./assets/disable-delete-3.png)

   </div>

Within the window the search interface in the **Create Credential** modal. Search for "zabbix" as shown below.

   <div class="docs-screenshot-compact">

   ![Disable delete](./assets/disable-delete-4.png)

   </div>

### 2. Fill Out Credential Details

Mindflow will open an integration-specific form to configure the connection. You must complete the required fields marked with an asterisk (\*). Refer to the configuration screen below:

   <div class="docs-screenshot-compact">

   ![Disable delete](./assets/disable-delete-2.png)

   </div>

Follow these steps to fill out the form:

| **Field**              | **How to Configure**                                                                                                                        |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **Service \***         | This will automatically display "Zabbix" and its version (e.g., 2.0.17 Native).                                                             |
| **Credential name \*** | Enter a clear name, such as "Zabbix Integration Key".                                                                                       |
| **URL \***             | Select **Custom** from the dropdown menu to provide your specific instance's API URL.                                                       |
| **Address \***         | Enter the full URL to your Zabbix API, which usually ends in `/api_jsonrpc.php`. (e.g., `https://bright-bat.zabbix.cloud/api_jsonrpc.php`). |
| **Credential type**    | Set this to **HTTP API Key** as shown in the example.                                                                                       |
| Header                 | Add an item and name it `Authorization`. The value to be added is as follows: `Bearer`<api_token>``.                                        |

Click **Update** or **Create** to save the credential securely. It is now ready to be used in your automated workflows.

### 3. Test the credential

Once done, head over **Flows** and, within a test flow, create a step using the Zabbix API connector.

Create a step to an endpoint that should not require any extra configuration, like `users.get` or `map.get`.

   <div class="docs-screenshot-compact">

   ![Disable delete](./assets/disable-delete-5.png)

   </div>

Assign the newly create credential within the Settings tab and click the play icon to trigger a unitary run of this step. If the pill turns green the integration is properly configured.

   <div class="docs-screenshot-compact">

   ![Disable delete](./assets/disable-delete.png)

   </div>
