Configuration

global:
  min_interval: 0s
  scrape_timeout: 10s
  scrape_timeout_offset: 500ms
  max_connections: 10
  max_idle_connections: 10
collector_files:
- '*.collector.yml'
target:
  data_source_name: <secret>
  collectors:
  - Channel_Monitoring
  - srt_monitoring
collectors:
- collector_name: Channel_Monitoring
  metrics:
  - metric_name: Channel_SPTS_Stats
    type: gauge
    help: Total bytes passed, Error Packets, squencial error packets, and scrambled
      packets
    key_labels:
    - cm_sitechannel_recid
    value_label: Statistic
    values:
    - passed_bytes
    - error_packets
    - seq_error_packets
    - scrambled_packets
    - program_id
    - critical_pid_discontinuities
    - status_code
    query_ref: CM_Query
  - metric_name: Channel_Video_Stats
    type: gauge
    help: Video Status of channel, Program id, video pid, video width, video height,
      video codec
    key_labels:
    - cm_sitechannel_recid
    value_label: Statistic
    values:
    - video_pid
    - video_width
    - video_height
    - video_codec
    - video_avg_frame_rate
    - video_closed_captions
    query_ref: CM_Query
  - metric_name: Channel_Audio_Stats
    type: gauge
    help: Audio Status of channel, Audio PID, Audio Bit Rate, Audio Codec
    key_labels:
    - cm_sitechannel_recid
    value_label: Statistic
    values:
    - audio_pid
    - audio_bit_rate
    - audio_codec
    query_ref: CM_Query
  queries:
  - query_name: CM_Query
    query: |
      SELECT DISTINCT ON (stream_id)
      s.cm_sitechannel_recid, passed_bytes, error_packets, seq_error_packets, scrambled_packets, COALESCE(program_id, -1) as program_id, COALESCE(video_pid, -1) as video_pid, COALESCE(video_width, -1) as video_width, COALESCE(video_height, -1) as video_height, COALESCE(video_codec, 998) as video_codec, COALESCE(video_avg_frame_rate, -1) as video_avg_frame_rate, COALESCE(video_closed_captions::int, 0) as video_closed_captions, COALESCE(audio_pid, -1) as audio_pid, COALESCE(audio_bit_rate, -1) as audio_bit_rate, COALESCE(audio_codec, 998) as audio_codec, critical_pid_discontinuities::int, COALESCE(status_code::bigint, 0) AS status_code
      FROM channel_monitoring.polling_data p
      INNER JOIN channel_monitoring.streams s ON p.stream_id = s.id
      WHERE timestamp > now() - INTERVAL '40 seconds'
      ORDER BY stream_id, timestamp DESC;
- collector_name: srt_monitoring
  metrics:
  - metric_name: SRT_Process_Stats
    type: gauge
    help: Statistics about if the SRT Process is available/who is connected
    key_labels:
    - cm_sitechannel_recid
    - direction
    value_label: Statistic
    values:
    - process_stopped
    - process_restarted
    - socket_available
    - decode_errors
    - status_code
    query_ref: SRT_Query
  - metric_name: SRT_Connection_Stats
    type: gauge
    help: Statistics about if the SRT Connection, lost packets, retransmitts etc.
    key_labels:
    - cm_sitechannel_recid
    - direction
    value_label: Statistic
    values:
    - total_packets
    - packets_lost
    - packets_dropped
    - packets_retransmitted
    - packet_loss
    - connected_ip
    - avg_rtt
    - jitter
    - sid
    - time
    - bandwidth
    - max_bandwidth
    - mbit_rate
    query_ref: SRT_Query
  queries:
  - query_name: SRT_Query
    query: "SELECT DISTINCT ON (process_id)\n   p.cm_sitechannel_recid\n  ,CASE WHEN
      p.Receive = false THEN 'send' ELSE 'receive' END AS direction\n  ,process_stopped::int\n
      \ ,process_restarted::int\n  ,socket_available::int\n  ,coalesce(connected_ip,
      0) as connected_ip\n  ,total_packets\n  ,packets_lost\n  ,packets_dropped\n
      \ ,packets_retransmitted\n  ,packet_loss\n  ,avg_rtt\n  ,jitter\n  ,decode_errors::int\n
      \ ,COALESCE(status_code::bigint, 0) AS status_code\n  ,sid\n  ,time\n  ,bandwidth\n
      \ ,max_bandwidth\n  ,mbit_rate\n  \nFROM srt_monitoring.polling_data pd \nINNER
      JOIN srt_monitoring.processes p on pd.process_id = p.id\n\nWHERE timestamp >
      now() - interval '40 seconds'\n\nORDER BY process_id, \"timestamp\" desc\n"