opensearch-project / dashboards-notifications

The Notifications plugin provides a central location for all of your notifications from OpenSearch plugins. You can use either OpenSearch Dashboards or the REST API to configure notifications. Dashboards offers a more organized way of selecting a channel type and selecting which OpenSearch plugin sources you want to use.
Apache License 2.0
9 stars 35 forks source link

[BUG] Notifications Channels does not appear in Monitor Trigger Actions #218

Closed josiasnonato closed 4 weeks ago

josiasnonato commented 3 months ago

Describe the bug

When I create an actions in a Monitor Trigger, the only option is "Manage Channels" with a message: "There are no existing channels. Add a channel to create an action".

I've created a channel, but I can't it in the Trigger Actions.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Notifications' page
  2. Click on 'Create channel'
  3. Select the type: Slack and create click on button Create PS.: My type is a Slack Channel.
  4. Go to Alerting page
  5. Click on Monitors Ribbon and create a Monitor
  6. Choose the following items: 6.1. Per query monitor 6.2. Visual Editor 6.3. By internal - 1 minute 6.4. Index Pattern: {{ Put your index }} 6.5. Time field: timestamp 6.6. Triggers: Add another Trigger 6.7. Put a trigger name 6.8 Actions: Here is the problem

Expected behavior I believe that I should select my channel or select some options to channels

OpenSearch Version Opensearch 2.14.0

Dashboards Version Opensearch Dashboards 2.14.0

Plugins Alerting

Screenshots

  1. The screen of my Notification channels notifications-screen

  2. The screen of my monitor showing the actions page alerting-monitor-triggers-actions-screen

Host/Environment (please complete the following information):

Additional context

josiasnonato commented 3 months ago

Adding an information:

I've tried to create monitor with API following the oficial documentation. But it was unsuccessful.

Using the API creates the monitor and one Action, but I can't edit and select my channel. alerting-monitor-triggers-actions-notifictions-screen

I used this command in Opensearch Dashboards DevTools:

POST _plugins/_alerting/monitors
{
   "name": "my-monitor-test-2",
   "type": "monitor",
   "monitor_type": "query_level_monitor",
   "enabled": true,
   "schedule": {
      "period": {
         "unit": "MINUTES",
         "interval": 1
      }
   },
   "inputs": [
      {
         "search": {
            "indices": [
               "logs-ns-argocd*"
            ],
            "query": {
               "size": 0,
               "aggregations": {},
               "query": {
                  "bool": {
                     "filter": [
                        {
                           "range": {
                              "@timestamp": {
                                 "gte": "{{period_end}}||-10m",
                                 "lte": "{{period_end}}",
                                 "format": "epoch_millis"
                              }
                           }
                        },
                        {
                           "match_phrase": {
                              "stream": "stderr"
                           }
                        }
                     ]
                  }
               }
            }
         }
      }
   ],
   "triggers": [
      {
         "query_level_trigger": {
            "id": "8ofoEpABAV0q5COWFoqX",
            "name": "greater-than-10",
            "severity": "1",
            "condition": {
               "script": {
                  "source": "ctx.results[0].hits.total.value > 10",
                  "lang": "painless"
               }
            },
            "actions": [
              {
                "name": "test-action",
                "destination_id": "my-private",
                "message_template": {
                  "source": "This is my message body."
                },
                "throttle_enabled": true,
                "throttle": {
                  "value": 27,
                  "unit": "MINUTES"
                },
                "subject_template": {
                  "source": "TheSubject"
                }
              }
            ]
         }
      }
   ]
}
AMoo-Miki commented 2 months ago

@opensearch-project/admin: plz route this to opensearch-project/dashboards-notifications

dblock commented 2 months ago

Thanks for opening this.

[Catch All Triage - Attendees 1, 2, 3, 4, 5]

Hailong-am commented 4 weeks ago

It has been fixed in 2.15 https://github.com/opensearch-project/notifications/issues/922