Not able to send notifications to mattermost from x-pack watcher with Elastic search and Kibana version 5.6.0


(Amruta) #1

I am using x-pack for monitoring and sending alerts on elastic search logs. I am able to send email alerts using x-pack but not able to send notifications to mattermost, I am using webhook configurations.

"actions" : {
    "my_webhook" : {
      "webhook" : {
        "scheme": "https",
        "method" : "POST",
        "host" : "mylisteninghost",
        "port" : 443,
        "path" : "hooks/<hook_id>",
        "body" : "{\"message_type\": \"INFO\",\"monitoring_tool\":\"ElasticWatcher\",\"entity_id\": 123,\"entity_display_name\": \"hello Amruta1\",\"state_message\": \"ALERT\",\"text\":\"Hello amruta,test meassage from webhook url\"}",
         "headers" : {"Content-type": "application/json"}
      }
    }
}

Above are my configurations, please someone guide me with this.
When I am running the same request with postman, its successful but not with x-pack watcher.
With postman its sending notification with https scheme and with x-pack watcher with https its giving handshake failure error.
Please respond someone.


(Alexander Reelsen) #2

Hey,

can you paste the full output of calling the Execute Watch API on this watch? Thank you!

--Alex


(Amruta) #3

Here is output of execute command:

{
  "_id": "cluster_health_watch_ok_57c07aa4-fce1-42cf-8fcb-22b7a6b09c39-2018-01-24T12:09:51.609Z",
  "watch_record": {
    "watch_id": "cluster_health_watch_ok",
    "state": "executed",
    "status": {
      "state": {
        "active": true,
        "timestamp": "2018-01-24T12:09:49.681Z"
      },
      "last_checked": "2018-01-24T12:09:51.609Z",
      "last_met_condition": "2018-01-24T12:09:51.609Z",
      "actions": {
        "send_emails": {
          "ack": {
            "timestamp": "2018-01-24T12:09:51.609Z",
            "state": "ackable"
          },
          "last_execution": {
            "timestamp": "2018-01-24T12:09:51.609Z",
            "successful": true
          },
          "last_successful_execution": {
            "timestamp": "2018-01-24T12:09:51.609Z",
            "successful": true
          }
        },
        "my_webhook": {
          "ack": {
            "timestamp": "2018-01-24T12:09:49.681Z",
            "state": "awaits_successful_execution"
          },
          "last_execution": {
            "timestamp": "2018-01-24T12:09:51.609Z",
            "successful": false,
            "reason": "SSLHandshakeException[Received fatal alert: handshake_failure]"
          }
        }
      }
    },
    "trigger_event": {
      "type": "manual",
      "triggered_time": "2018-01-24T12:09:51.609Z",
      "manual": {
        "schedule": {
          "scheduled_time": "2018-01-24T12:09:51.609Z"
        }
      }
    },
    "input": {
      "http": {
        "request": {
          "scheme": "http",
          "host": "<elasticsearch-host>",
          "port": 9200,
          "method": "get",
          "path": "/_cluster/health",
          "params": {},
          "headers": {}
        }
      }
    },
    "condition": {
      "compare": {
        "ctx.payload.status": {
          "eq": "green"
        }
      }
    },
    "result": {
      "execution_time": "2018-01-24T12:09:51.609Z",
      "execution_duration": 266,
      "input": {
        "type": "http",
        "status": "success",
        "payload": {
          "number_of_pending_tasks": 0,
          "cluster_name": "testxpack",
          "active_shards": 40,
          "active_primary_shards": 20,
          "unassigned_shards": 0,
          "delayed_unassigned_shards": 0,
          "timed_out": false,
          "relocating_shards": 0,
          "_headers": {
            "content-length": [
              "388"
            ],
            "content-type": [
              "application/json; charset=UTF-8"
            ]
          },
          "initializing_shards": 0,
          "task_max_waiting_in_queue_millis": 0,
          "number_of_data_nodes": 3,
          "number_of_in_flight_fetch": 0,
          "active_shards_percent_as_number": 100,
          "_status_code": 200,
          "status": "green",
          "number_of_nodes": 5
        },
        "http": {
          "request": {
            "host": "<elasticsearch-host>",
            "port": 9200,
            "scheme": "http",
            "method": "get",
            "path": "/_cluster/health"
          },
          "status_code": 200
        }
      },
      "condition": {
        "type": "compare",
        "status": "success",
        "met": true,
        "compare": {
          "resolved_values": {
            "ctx.payload.status": "green"
          }
        }
      },
      "actions": [
        {
          "id": "send_emails",
          "type": "email",
          "status": "success",
          "email": {
            "account": "work",
            "message": {
              "id": "cluster_health_watch_ok_57c07aa4-fce1-42cf-8fcb-22b7a6b09c39-2018-01-24T12:09:51.609Z",
              "from": "<myemailid>",
              "sent_date": "2018-01-24T12:09:51.619Z",
              "to": [
                "<myanotheremailid>"
              ],
              "subject": "Cluster Status OK",
              "body": {
                "text": "Cluster status is GREEN"
              }
            }
          }
        },
        {
          "id": "my_webhook",
          "type": "webhook",
          "status": "failure",
          "reason": "SSLHandshakeException[Received fatal alert: handshake_failure]"
        }
      ]
    },
    "messages": []
  }
}

(Alexander Reelsen) #4

Are you using self signed certificates on the mattermost site? Which JDK are you using? Can you run the following against the mattermost system?

nmap --script ssl-enum-ciphers -p 443 your_mattermost_host

(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.