apache / skywalking

APM, Application Performance Monitoring System
https://skywalking.apache.org/
Apache License 2.0
23.79k stars 6.52k forks source link

Can I use WeChat Hook sent messages via http proxy? #7174

Closed liuyanzhen34 closed 3 years ago

liuyanzhen34 commented 3 years ago

Dear Sheng WU,and other teachers: I have set up a k8s cluster in local network that can be not connected to the Internet, and I use Helm to install skywalking in my k8s cluster, and I choose the WeChat Hook in alarm-settings.yml as the way to sent alarm messages to the wechat enpterprise edtion, as you know that my k8s cluster can not connect to the Internet,So if you don't use http proxy, you won't be able to send alerts to enterprise wechat, but I can't find any configuration parameters for http proxy in the configuration file, so how am I supposed to send out an alert on the k8s Lan through another proxy server that's connected to the outside network. I tried to add an env http-proxy in my deplyment skywalking-oap ,and change the network to hostNetwork, but it still fails.

The following is skywalking-oap deployment's yaml :

apiVersion: extensions/v1beta1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: "3" field.cattle.io/publicEndpoints: '[{"addresses":["10.142.243.11"],"port":31198,"protocol":"TCP","serviceName":"skywalking:skywalking-oap","allNodes":true},{"addresses":["10.142.243.11"],"port":32315,"protocol":"TCP","serviceName":"skywalking:skywalking-oap","allNodes":true},{"nodeName":"c-fxr4b:machine-4ll7z","addresses":["10.142.243.28"],"port":11800,"protocol":"TCP","podName":"skywalking:skywalking-oap-b8c5ddb98-k9bws","allNodes":false},{"nodeName":"c-fxr4b:machine-4ll7z","addresses":["10.142.243.28"],"port":12800,"protocol":"TCP","podName":"skywalking:skywalking-oap-b8c5ddb98-k9bws","allNodes":false}]' meta.helm.sh/release-name: skywalking meta.helm.sh/release-namespace: skywalking creationTimestamp: "2021-06-25T03:33:36Z" generation: 5 labels: app: skywalking app.kubernetes.io/managed-by: Helm chart: skywalking-4.0.0 component: oap heritage: Helm release: skywalking name: skywalking-oap namespace: skywalking resourceVersion: "208588611" selfLink: /apis/extensions/v1beta1/namespaces/skywalking/deployments/skywalking-oap uid: db44d935-f195-46ca-bc27-801bd5c50cf3 spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: app: skywalking component: oap release: skywalking strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: creationTimestamp: null labels: app: skywalking component: oap release: skywalking spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution:

wu-sheng commented 3 years ago

You could use proxy server to do so, or OS hosts settings. There is no point for SkyWalking to do so.

liuyanzhen34 commented 3 years ago

The following is alarm-settings.yml configuration:

[root@k8s-master1 oap]# more alarm-settings.yml

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Sample alarm rules.
rules:
  # Rule unique name, must be ended with `_rule`.
  service_resp_time_rule:
    metrics-name: service_resp_time
    op: ">"
    threshold: 1
    period: 10
    count: 3
    silence-period: 5
    message: Response time of service {name} is more than 1000ms in 3 minutes of last 10 minutes.
  service_sla_rule:
    # Metrics value need to be long, double or int
    metrics-name: service_sla
    op: "<"
    threshold: 8000
    # The length of time to evaluate the metrics
    period: 10
    # How many times after the metrics match the condition, will trigger alarm
    count: 2
    # How many times of checks, the alarm keeps silence after alarm triggered, default as same as period.
    silence-period: 3
    message: Successful rate of service {name} is lower than 80% in 2 minutes of last 10 minutes
  service_resp_time_percentile_rule:
    # Metrics value need to be long, double or int
    metrics-name: service_percentile
    op: ">"
    threshold: 1000,1000,1000,1000,1000
    period: 10
    count: 3
    silence-period: 5
    message: Percentile response time of service {name} alarm in 3 minutes of last 10 minutes, due to more than one condition of p50 
> 1000, p75 > 1000, p90 > 1000, p95 > 1000, p99 > 1000
  service_instance_resp_time_rule:
    metrics-name: service_instance_resp_time
    op: ">"
    threshold: 1000
    period: 10
    count: 2
    silence-period: 5
    message: Response time of service instance {name} is more than 1000ms in 2 minutes of last 10 minutes
  database_access_resp_time_rule:
    metrics-name: database_access_resp_time
    threshold: 1000
    op: ">"
    period: 10
    count: 2
    message: Response time of database access {name} is more than 1000ms in 2 minutes of last 10 minutes
  endpoint_relation_resp_time_rule:
    metrics-name: endpoint_relation_resp_time
    threshold: 1000
    op: ">"
    period: 10
    count: 2
    message: Response time of endpoint relation {name} is more than 1000ms in 2 minutes of last 10 minutes
#  Active endpoint related metrics alarm will cost more memory than service and service instance metrics alarm.
#  Because the number of endpoint is much more than service and instance.
#
#  endpoint_avg_rule:
#    metrics-name: endpoint_avg
#    op: ">"
#    threshold: 1000
#    period: 10
#    count: 2
#    silence-period: 5
#    message: Response time of endpoint {name} is more than 1000ms in 2 minutes of last 10 minutes

#webhooks:
#  - http://127.0.0.1/notify/
#  - http://127.0.0.1/go-wechat/

wechatHooks:
  textTemplate: |-
    {
      "msgtype": "text",
      "text": {
        "content": "Apache SkyWalking Alarm: \n %s."
      }
    }
  webhooks:
    - https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=494aef2e3-335e-4g28-bac4-e5191c1f35fr
wu-sheng commented 3 years ago

Can't understand your words due to chaos formats. You are asking for helps, at least make people eaiser to read, otherwise, nothing to say.

liuyanzhen34 commented 3 years ago

You could use proxy server to do so, or OS hosts settings. There is no point for SkyWalking to do so.

Teacher, can you tell me how to use the proxy in detail, skywalking I was deployed in the form of K8s pod.