# Check MK

## Prerequisites: <a href="#prerequisites" id="prerequisites"></a>

This section explains on how to integrate and ingest alerts from Check MK monitoring tool into CloudFabrix AIOPs platform.

Check MK (derived from Nagios Core) is a monitoring tool which supports alert notifications via email, slack, pagerduty, victorops or a script executing a command. CloudFabrix AIOPs platform uses webhook notification method using a script from Check MK monitoring tool to receive and ingest the alerts or events.

Click here for [Alert Sources](https://oiadocs.cloudfabrix.io/features-guide/alert-watch/alert-sources) to create a Webhook URL for Check MK alert notifications in CloudFabrix OIA application.

**Note:** Under **Alert Mapping** section, use Nagios alert mapping configuration for Check MK alerts.

## **Configure Check MK for Alert notifications over a Webhook:** <a href="#create-webhook-for-incoming-alerts-from-dynatrace-1" id="create-webhook-for-incoming-alerts-from-dynatrace-1"></a>

**Step 1:** Download the below scripts for both '**Host**' and '**Service**' type of alerts

For '**Host**' type alerts:&#x20;

<https://macaw-amer.s3.amazonaws.com/releases/OIA/scripts/webhook/cfx-host-webhook-notification.sh>

For '**Service**' type alerts:&#x20;

<https://macaw-amer.s3.amazonaws.com/releases/OIA/scripts/webhook/cfx-service-webhook-notification.sh>

**Step 2:** Copy the '**cfx-host-webhook-notification.sh**' and '**cfx-service-webhook-notification.sh**' script to Check MK system into the folder '**/omd/sites/\<Site\_Name>/local/share/check\_mk/notifications**'

**Step 3:** Login into Check MK monitoring tool's machine using SSH CLI as 'root' user and execute the below commands.

```
ssh root@<checkmk-ip-address>
```

```
cd /omd/sites/<Site_Name>/local/share/check_mk/notifications
```

```
chmod 755 cfx-host-webhook-notification.sh
chmod 755 cfx-service-webhook-notification.sh
```

**Step 4:** Edit the scripts '**cfx-host-webhook-notification.sh**' & '**cfx-service-webhook-notification.sh**' and configure the below variables. Configure the '**CFX\_WEBHOOK\_URL**' variable with 'Webhook URL' that was created under ['Alert Sources](https://oiadocs.cloudfabrix.io/features-guide/alert-watch/alert-sources)' section in CloudFabrix OIA application.&#x20;

Configure '**CFX\_WEBHOOK\_USERNAME**' and '**CFX\_WEBHOOK\_PASSWORD'** variables if the Webhook is configured with HTTP authentication, otherwise, leave them empty.

```
CFX_WEBHOOK_URL="<cfx-webhook-url>"
CFX_WEBHOOK_USERNAME="<cfx-webhook-username-Optional>"
CFX_WEBHOOK_PASSWORD="<cfx-webhook-username-Optional>"
```

**Step 5:** Login into Check MK monitoring tool UI as a user which has admin privileges to configure the alert notifications.

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2FDDp31DCEgnQNLNzLfl7V%2FScreen%20Shot%202022-04-25%20at%2010.31.04%20PM.png?alt=media\&token=2579b781-98d8-424c-8420-83134adb1518)

**Step 6:** Under '**Setup**' menu, click on '**Users**' menu to create a new user for Check MK alert notifications.

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2FUXNL1izEzPndmxI5NHU4%2FScreen%20Shot%202022-04-25%20at%2010.34.16%20PM.png?alt=media\&token=fb082715-62be-4bca-87b8-97a1ea286253)

**Step 7:** Click on '**Add**' button

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2FWhfMewRLRRLAJupsqaD8%2FScreen%20Shot%202022-04-25%20at%2010.37.53%20PM.png?alt=media\&token=3e7e33b4-2d5c-454c-8c04-9e14274df79e)

**Step 8:** Enter username as '**cfx\_notifications**'. Select appropriate sites under '**Authorized sites**'. Under '**Security**' section, select '**Automatic secret for machine accounts**' and generate a secret.&#x20;

Select '**Disable password**' option to disable the login to this account. Select the roles as '**Normal monitoring user**'

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2FtD8jG9rMPNYYIEKW9eqp%2FScreen%20Shot%202022-04-25%20at%2010.40.42%20PM.png?alt=media\&token=f340d464-2bc7-49f8-bb01-44a288752e4d)

**Step 9:** Commit the changes.

**Step 10**: Under '**Setup**' menu, click on '**Notifications**' menu to create configure alert notifications for both **Host** and **Service** type problems.

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2FMEMcKdFEuHlNEnYVt8N1%2FScreen%20Shot%202022-04-25%20at%2010.47.51%20PM.png?alt=media\&token=7ac27f5f-3d4b-4433-bcdf-5044ec7ab97b)

**Step 11**: Configure alert notifications for '**Host**' type problems.

Click on '**Add rule**' button.

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2F4e26mLH3ZoCd22kE5IMo%2FScreen%20Shot%202022-04-25%20at%2010.50.45%20PM.png?alt=media\&token=57a68b7d-c3b6-4c9b-9596-e6f5a677810c)

**Step 12**: Enter the '**Decsription**' as '**cfx\_host\_notification**'.

Select '**Notification Method**' as '**cfx-host-webhook-notification.sh**' from the drop down menu.

Under Contact selection section, select **cfx\_notifications** user that was created to enable the alert notification.

Select appropriate '**Sites**' to enable the alert notification.

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2F4jb6TRiTpdvhmjixle8X%2FScreen%20Shot%202022-04-25%20at%2010.55.26%20PM.png?alt=media\&token=5a92459e-a912-483e-98fb-fa27aab3a877)

**Step 13**: For '**Match host event type**' option, select appropriate options as shown below.

Click on **Save** button to save the alert notification rule.

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2Fzmtv6wjePoRblFKBSSz2%2FScreen%20Shot%202022-04-25%20at%2010.58.23%20PM.png?alt=media\&token=0b0a93bd-a3ed-46a4-8787-8693a63d7333)

**Step 14**: Configure alert notifications for '**Service**' type problems.

Click on '**Add rule**' button.

Enter the '**Decsription**' as '**cfx\_service\_notification**'.

Select '**Notification Method**' as '**cfx-service-webhook-notification.sh**' from the drop down menu.

Under Contact selection section, select **cfx\_notifications** user that was created to enable the alert notification.

Select appropriate '**Sites**' to enable the alert notification.

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2F7lfm8OB5mBmaaf10eHz5%2FScreen%20Shot%202022-04-25%20at%2011.02.11%20PM.png?alt=media\&token=80146a78-36f6-4aa2-9f3d-c0e0a40cbf0d)

**Step 15**: For '**Match service event type**' option, select appropriate options as shown below.

Click on **Save** button to save the alert notification rule.

![](https://4260296531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MAygHzNCQ33zRR43qxF%2Fuploads%2Fl8Yz7nN7rkrVaLjzn9BD%2FScreen%20Shot%202022-04-25%20at%2011.04.36%20PM.png?alt=media\&token=b749de7e-a640-4a2a-bbee-652e298ad64d)

Below is the Alert Filed mapping table (for information only) between Check MK alert notification fields and CloudFabrix OIA's common data model fields for Alerts.

| **Check MK Alert Field**                                                     | **CloudFabrix OIA Alert Field**                                            |
| ---------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| Alert\_NotificationType                                                      | alertType                                                                  |
| Alert\_Nagios\_SourceType                                                    | <p>Determines whether source alert is from </p><p>Host or Service type</p> |
| <p>Alert\_ServiceNotificationId /</p><p>Alert\_HostNotificationId</p>        | key (Service/Host)                                                         |
| <p>Alert\_ServiceDescription /</p><p>Alert\_ServiceOutput</p>                | message (Service)                                                          |
| Alert\_HostName                                                              | assetName                                                                  |
| Alert\_HostAddress                                                           | assetIpAddress                                                             |
| Alert\_Nagios\_SourceType                                                    | assetType                                                                  |
| <p>Alert\_HostState /</p><p>Alert\_HostAddress (or)<br>Alert\_HostOutput</p> | message (Host)                                                             |
| Alert\_DateTime                                                              | raisedAt / clearedAt                                                       |
| <p>Alert\_ServiceState/</p><p>Alert\_HostState</p>                           | severity (Service/Host)                                                    |
