{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":30445,"path":"it-operations-management/event-management/grafana-events-integration.md","title":"Integrate Grafana events with basic authentication","bundle":null,"doc_type":null,"release":"australia","body":"\n# Integrate Grafana events with basic authentication\n\nIntegrate Grafana with Event Management by adding a standard webhook in the Grafana console.\n\n## Before you begin\n\n-   Ensure that the Event Management Connectors \\(sn\\_em\\_connector\\) plugin is installed on the ServiceNow AI Platform instance.\n-   The Event Management plugin must be installed on the ServiceNow AI Platform instance.\n-   The CI binding happens through the IP, instances should be discovered as servers to initiate the binding. CIs discovered through cloud or CIs in **cmdb\\_ci\\_vm\\_object** don’t get bounded as Grafana doesn't provide any information for object IDs.\n-   Ensure you have created a user with an **Identify Type** of **Machine** and the evt\\_mgmt\\_integration role.\n-   Role required: evt\\_mgmt\\_integration\n\n## About this task\n\nConfigure the Event Management environment for the collection of events from Grafana. In your Grafana console, set your ServiceNow AI Platform instance as the rest endpoint using a standard webhook.\n\nYou can also configure Grafana as an event push connector from the Integrations Launchpad. For more information, see [Configure an event push connector](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/push-connector.md).\n\n**Note:** Perform steps 1 and 2 for Grafana v7.4.3. For Grafana v9.3.2. skip to step 3.\n\n## Procedure\n\n1.  **Grafana v7.4.3**\n2.  In the Grafana console, create a notification channel.\n\n    1.  Navigate to **Alerting** &gt; **Notification Channels**.\n\n    2.  Click **New Channel** and select the type as **Webhook**.\n\n    3.  Enter a URL.\n\n        For example, use `https://<instance-name>.service-now.com/api/sn_em_connector/em/inbound_event?source=grafana`.\n\n    4.  Under the **Optional WebHook** settings, select the HTTP Method, **POST**, and enter the user name and password of the relevant ServiceNow user.\n\n        **Note:** Ensure that the selected user is assigned the evt\\_mgmt\\_integration role. To ensure proper authentication, use the least privileged user with the evt\\_mgmt\\_integration role, rather than a high privileged user.\n\n    5.  Click **Test** to verify the connection.\n\n3.  In the Grafana console, create alerting rules.\n\n    1.  Click **Edit** on the required panel and then **Create Alert**.\n\n    2.  In the **Alert** tab, add the following tags:\n\n        |Tags|Description|\n        |----|-----------|\n        |Severity|\\(This tag is optional and has to be lower cased.\\) Severity with which the alert has to be created.|\n        |Count|\\(This tag is required, otherwise the alerts don’t close automatically in ServiceNow.\\) The number of devices, hosts, or servers monitored by this alert rule.|\n\n    3.  Add the notification channel under **Notifications** in the alert rule.\n\n    4.  Click **Save**.\n\n    5.  Navigate to **Alerting** &gt; **Alert Rules** to access the created rule.\n\n4.  **Grafana v9.3.2.**\n5.  In the Grafana console, create a contact point.\n\n    1.  Navigate to **Alerting** &gt; **Contact Points**.\n\n    2.  Select **New Contact Point**, enter a name, and select the type as **Webhook**.\n\n    3.  Enter a URL.\n\n        For example, use `https://<instance-name>.service-now.com/api/sn_em_connector/em/inbound_event?source=grafana`.\n\n    4.  In the **Optional WebHook** settings, set the HTTP Method as **POST**, and enter the user name and password of the relevant ServiceNow user.\n\n        **Note:** Ensure that the selected user is assigned the evt\\_mgmt\\_integration role. To ensure proper authentication, use the least privileged user with the evt\\_mgmt\\_integration role, rather than a high privileged user.\n\n    5.  Click **Save** and **Test** to verify the connection.\n\n6.  In the Grafana console, create a notification policy.\n\n    1.  Navigate to **Alerting** &gt; **Notification Policies**.\n\n    2.  Select **New Policy**, add matchers.\n\n        Matchers are labels that direct alert rules to the contact point.\n\n    3.  Select your contact point.\n\n    4.  Select **Save Policy**.\n\n7.  In the Grafana console, create alert rules.\n\n    1.  Navigate to **Alerting** &gt; **Alert Rule**.\n\n    2.  Select **New Rule**.\n\n    3.  Set the Query and Alert Condition.\n\n    4.  Set the data source, metrics, and the necessary filters.\n\n    5.  Set the alert evaluation behavior.\n\n    6.  Enter the rule name.\n\n    7.  In the summary and annotations section, add a summary or a description.\n\n    8.  From the scroll down, select **+Add New**.\n\n    9.  Enter the node, resource, and metric information.\n\n        This information is required for the node, resource, and metric\\_name fields for the event.\n\n        **Note:** Use the value string to pass these values. For example, a node can be \\{\\{ $values.C0.Labels.instance \\}\\}.\n\n    10. Under custom labels, provide the required labels to direct your notifications to the appropriate contact point.\n\n        **Note:** You can also pass the severity under custom labels. The same is used for events. The available severity options are: critical, major, minor, warning.\n\n    11. Click **Save**.\n\n\n## Result\n\nAlerts start flowing from Grafana into the Event Management plugin. The plugin extracts information from the original Grafana alert message to populate the required event fields and inserts the event into the database. In your ServiceNow AI Platform instance, navigate to **All Events** to see the events.\n\n**Note:**\n\n-   For Grafana v7.4.3, you may see extra clear events coming into ServiceNow which aren’t bound to an alert. Ignore them as they’re created to overcome the issue of Grafana not sending information in the clear notification.\n-   A severity parameter is added which is used only for Grafana 8 and above. The provided value is used as a severity for an event if the severity isn’t passed in custom labels.\n\n**Parent Topic:**[Integrate Grafana events](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/event-management/grafana-integration.md)\n\n"}}