#
# ThingsBoard, Inc. ("COMPANY") CONFIDENTIAL
#
# Copyright © 2016-2025 ThingsBoard, Inc. All Rights Reserved.
#
# NOTICE: All information contained herein is, and remains
# the property of ThingsBoard, Inc. and its suppliers,
# if any.  The intellectual and technical concepts contained
# herein are proprietary to ThingsBoard, Inc.
# and its suppliers and may be covered by U.S. and Foreign Patents,
# patents in process, and are protected by trade secret or copyright law.
#
# Dissemination of this information or reproduction of this material is strictly forbidden
# unless prior written permission is obtained from COMPANY.
#
# Access to the source code contained herein is hereby forbidden to anyone except current COMPANY employees,
# managers or contractors who have executed Confidentiality and Non-disclosure agreements
# explicitly covering such access.
#
# The copyright notice above does not evidence any actual or intended publication
# or disclosure  of  this source code, which includes
# information that is confidential and/or proprietary, and is a trade secret, of  COMPANY.
# ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC  PERFORMANCE,
# OR PUBLIC DISPLAY OF OR THROUGH USE  OF THIS  SOURCE CODE  WITHOUT
# THE EXPRESS WRITTEN CONSENT OF COMPANY IS STRICTLY PROHIBITED,
# AND IN VIOLATION OF APPLICABLE LAWS AND INTERNATIONAL TREATIES.
# THE RECEIPT OR POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION
# DOES NOT CONVEY OR IMPLY ANY RIGHTS TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS,
# OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT  MAY DESCRIBE, IN WHOLE OR IN PART.
#

monitoring:
  # Monitored server domain
  domain: "${DOMAIN:localhost}"
  rest:
    # Base REST API url, https://DOMAIN by default
    base_url: '${REST_BASE_URL:https://${monitoring.domain}}'
    # Authentication username
    username: '${REST_AUTH_USERNAME:tenant@thingsboard.org}'
    # Authentication password
    password: '${REST_AUTH_PASSWORD:tenant}'
    # REST request timeout in milliseconds
    request_timeout_ms: '${REST_REQUEST_TIMEOUT_MS:5000}'
  ws:
    # WebSocket url, wss://DOMAIN by default
    base_url: '${WS_BASE_URL:wss://${monitoring.domain}}'
    # WebSocket request timeout
    request_timeout_ms: '${WS_REQUEST_TIMEOUT_MS:3000}'

  # Checks frequency in milliseconds
  monitoring_rate_ms: '${MONITORING_RATE_MS:10000}'
  # Maximum time between request to transport and WebSocket update
  check_timeout_ms: '${CHECK_TIMEOUT_MS:5000}'

  # Failures threshold for notifying
  failures_threshold: '${FAILURES_THRESHOLD:1}'
  # Notify after each REPEATED_FAILURE_NOTIFICATION subsequent failures, 0 to notify only once on first failure
  repeated_failure_notification: '${REPEATED_FAILURE_NOTIFICATION:4}'

  transports:
    mqtt:
      # Enable MQTT transport checks
      enabled: '${MQTT_TRANSPORT_MONITORING_ENABLED:true}'
      # MQTT request timeout in milliseconds
      request_timeout_ms: '${MQTT_REQUEST_TIMEOUT_MS:4000}'
      # MQTT QoS
      qos: '${MQTT_QOS_LEVEL:1}'
      targets:
          # MQTT transport base url, tcp://DOMAIN:1883 by default
        - base_url: '${MQTT_TRANSPORT_BASE_URL:tcp://${monitoring.domain}:1883}'
          # Queue to use for target device
          queue: '${MQTT_TRANSPORT_USED_QUEUE:Main}'
          # Whether to monitor IPs associated with the domain from base url
          check_domain_ips: '${MQTT_TRANSPORT_CHECK_DOMAIN_IPS:false}'
          # Prefix for the target device name
          name_prefix: '${MQTT_TRANSPORT_TARGET_NAME_PREFIX:}'
        # To add more targets, use following environment variables:
        # monitoring.transports.mqtt.targets[1].base_url, monitoring.transports.mqtt.targets[2].base_url, etc.

    coap:
      # Enable CoAP transport checks
      enabled: '${COAP_TRANSPORT_MONITORING_ENABLED:true}'
      # CoAP request timeout in milliseconds
      request_timeout_ms: '${COAP_REQUEST_TIMEOUT_MS:4000}'
      targets:
          # CoAP transport base url, coap://DOMAIN by default
        - base_url: '${COAP_TRANSPORT_BASE_URL:coap://${monitoring.domain}}'
          # Queue to use for target device
          queue: '${COAP_TRANSPORT_USED_QUEUE:Main}'
          # Whether to monitor IPs associated with the domain from base url
          check_domain_ips: '${COAP_TRANSPORT_CHECK_DOMAIN_IPS:false}'
          # Prefix for the target device name
          name_prefix: '${COAP_TRANSPORT_TARGET_NAME_PREFIX:}'
        # To add more targets, use following environment variables:
        # monitoring.transports.coap.targets[1].base_url, monitoring.transports.coap.targets[2].base_url, etc.

    http:
      # Enable HTTP transport checks
      enabled: '${HTTP_TRANSPORT_MONITORING_ENABLED:true}'
      # HTTP request timeout in milliseconds
      request_timeout_ms: '${HTTP_REQUEST_TIMEOUT_MS:4000}'
      targets:
          # HTTP transport base url, http://DOMAIN by default
        - base_url: '${HTTP_TRANSPORT_BASE_URL:http://${monitoring.domain}}'
          # Queue to use for target device
          queue: '${HTTP_TRANSPORT_USED_QUEUE:Main}'
          # Whether to monitor IPs associated with the domain from base url
          check_domain_ips: '${HTTP_TRANSPORT_CHECK_DOMAIN_IPS:false}'
          # Prefix for the target device name
          name_prefix: '${HTTP_TRANSPORT_TARGET_NAME_PREFIX:}'
        # To add more targets, use following environment variables:
        # monitoring.transports.http.targets[1].base_url, monitoring.transports.http.targets[2].base_url, etc.

    lwm2m:
      # Enable LwM2M transport checks
      enabled: '${LWM2M_TRANSPORT_MONITORING_ENABLED:true}'
      # LwM2M request timeout in milliseconds
      request_timeout_ms: '${LWM2M_REQUEST_TIMEOUT_MS:4000}'
      targets:
          # LwM2M transport base url, coap://DOMAIN:5685 by default
        - base_url: '${LWM2M_TRANSPORT_BASE_URL:coap://${monitoring.domain}:5685}'
          # Queue to use for target device
          queue: '${LWM2M_TRANSPORT_USED_QUEUE:Main}'
          # Whether to monitor IPs associated with the domain from base url
          check_domain_ips: '${LWM2M_TRANSPORT_CHECK_DOMAIN_IPS:false}'
          # Prefix for the target device name
          name_prefix: '${LWM2M_TRANSPORT_TARGET_NAME_PREFIX:}'
        # To add more targets, use following environment variables:
        # monitoring.transports.lwm2m.targets[1].base_url, monitoring.transports.lwm2m.targets[2].base_url, etc.

  integrations:
    http:
      # Enable HTTP integration checks
      enabled: '${HTTP_INTEGRATION_MONITORING_ENABLED:false}'
      # HTTP request timeout in milliseconds
      request_timeout_ms: '${HTTP_REQUEST_TIMEOUT_MS:4000}'
      target:
        # HTTP integration base url, http://DOMAIN by default
        base_url: '${HTTP_INTEGRATION_BASE_URL:http://${monitoring.domain}}'
        # Whether to monitor IPs associated with the domain from base url
        check_domain_ips: '${HTTP_INTEGRATION_CHECK_DOMAIN_IPS:false}'
        # Prefix for the target name
        name_prefix: '${HTTP_INTEGRATION_TARGET_NAME_PREFIX:}'
    coap:
      # Enable CoAP integration checks
      enabled: '${COAP_INTEGRATION_MONITORING_ENABLED:false}'
      # CoAP request timeout in milliseconds
      request_timeout_ms: '${COAP_REQUEST_TIMEOUT_MS:4000}'
      target:
        # CoAP integration base url, coap://DOMAIN by default
        base_url: '${COAP_INTEGRATION_BASE_URL:coap://${monitoring.domain}}'
        # Whether to monitor IPs associated with the domain from base url
        check_domain_ips: '${COAP_INTEGRATION_CHECK_DOMAIN_IPS:false}'
        # Prefix for the target name
        name_prefix: '${COAP_INTEGRATION_TARGET_NAME_PREFIX:}'
    mqtt:
      # Enable MQTT integration checks
      enabled: '${MQTT_INTEGRATION_MONITORING_ENABLED:false}'
      # MQTT request timeout in milliseconds
      request_timeout_ms: '${MQTT_REQUEST_TIMEOUT_MS:4000}'
      target:
        # MQTT integration base url, tcp://DOMAIN:1883 by default
        base_url: '${MQTT_INTEGRATION_BASE_URL:tcp://${monitoring.domain}:1883}'
        # Whether to monitor IPs associated with the domain from base url
        check_domain_ips: '${MQTT_INTEGRATION_CHECK_DOMAIN_IPS:false}'
        # Prefix for the target name
        name_prefix: '${MQTT_INTEGRATION_TARGET_NAME_PREFIX:}'

  edqs:
    enabled: "${EDQS_MONITORING_ENABLED:false}"

  calculated_fields:
    enabled: "${CALCULATED_FIELDS_MONITORING_ENABLED:true}"

  notifications:
    message_prefix: '${NOTIFICATION_MESSAGE_PREFIX:}'
    slack:
      # Enable notifying via Slack
      enabled: '${SLACK_NOTIFICATION_CHANNEL_ENABLED:false}'
      # Slack webhook url
      webhook_url: '${SLACK_WEBHOOK_URL:}'

  latency:
    # Enable latencies reporting
    enabled: "${LATENCY_REPORTING_ENABLED:true}"
    # Latency threshold for notifying
    threshold_ms: '${LATENCY_THRESHOLD:2000}'
    # ID of the asset to save latencies to. If not set and latencies reporting is enabled - asset will be found or created automatically
    reporting_asset_id: '${LATENCY_REPORTING_ASSET_ID:}'
