Enhanced Alert

OvenMediaEngine Enterprise 0.18.3.2-1 버전부터 Enhanced Alert 기능을 지원합니다.

Enhanced Alert는 Stream 또는 System에서 이상 징후와 관심 패턴을 탐지하고 사용자에게 Notification을 전송하는 Module입니다. 사전 정의된 규칙으로 이상 징후와 관심 패턴을 설정할 수 있으며, 조건이 충족되면 Module이 사용자의 Notification Server로 HTTP(S) Request를 전송합니다.

Enhanced Alert 설정하기

Enhanced Alert는 아래와 같이 <Server>에서 설정할 수 있습니다:

<Server version="8">
	<Alert>
		<Url>http://192.168.0.161:9595/alert/notification</Url>
		<SecretKey>1234</SecretKey>
		<Timeout>3000</Timeout>
		<RulesFile>AlertRules.xml</RulesFile>
		<Rules>
			<Ingress>
				<StreamStatus />
				<MinBitrate>2000000</MinBitrate>
				<MaxBitrate>4000000</MaxBitrate>
				<MinFramerate>15</MinFramerate>
				<MaxFramerate>60</MaxFramerate>
				<MinWidth>1280</MinWidth>
				<MinHeight>720</MinHeight>
				<MaxWidth>1920</MaxWidth>
				<MaxHeight>1080</MaxHeight>
				<MinSamplerate>16000</MinSamplerate>
				<MaxSamplerate>50400</MaxSamplerate>
				<LongKeyFrameInterval />
				<HasBFrames />
			</Ingress>
			<Egress>
				<StreamStatus />
				<LLHLSReady />
				<HLSReady />
			</Egress>
			<InternalQueueCongestion />
		</Rules>
	</Alert>
</Server>
Key
Description

Url

Notification을 수신할 HTTP Server 주소입니다.

  • HTTP와 HTTPS를 모두 지원합니다.

SecretKey

HMAC-SHA1 암호화에 사용되는 Secret Key입니다. 자세한 내용은 아래 Security를 참고하십시오.

Timeout

요청 전송 후 응답을 대기하는 시간입니다.

  • 단위는 밀리초입니다.

RulesFile

(Optional) Alert 탐지 규칙이 정의된 별도의 외부 파일을 참조합니다.

Rules

(Optional) 탐지할 이상 징후 및 관심 패턴을 정의합니다.

  • < RulesFile>이 지정된 경우, <RulesFile>을우선합니다.

Rules File 설정하기

탐지할 이상 징후와 관심 패턴을 별도의 파일로 정의할 수 있습니다. OvenMediaEngine Enterprise는 Rules File의 변경 사항을 모니터링하고, 서비스 재시작 없이 즉시 적용합니다. 운영 중에 규칙을 자주 수정해야 한다면 <RulesFile> 사용을 권장합니다.

Rules

Key
Description

Ingress

StreamStatus

Ingress Stream의 생성, 준비 완료, 실패, 삭제 상태를 감지합니다.

MinBitrate

Ingress Stream의 Video Bitrate가 설정값보다 낮을 때 감지합니다.

MaxBitrate

Ingress Stream의 Video Bitrate가 설정값보다 높을 때 감지합니다.

MinFramerate

Ingress Stream의 Framerate가 설정값보다 낮을 때 감지합니다.

MaxFramerate

Ingress Stream의 Framerate가 설정값보다 높을 때 감지합니다.

MinWidth

Ingress Stream의 가로 해상도 (Width)가 설정값보다 작을 때 감지합니다.

MaxWidth

Ingress Stream의 가로 해상도 (Width)가 설정값보다 클 때 감지합니다.

MinHeight

Ingress Stream의 세로 해상도 (Height)가 설정값보다 작을 때 감지합니다.

MaxHeight

Ingress Stream의 세로 해상도 (Height)가 설정값보다 클 때 감지합니다.

MinSamplerate

Ingress Stream의 Audio Samplerate가 설정값보다 낮을 때 감지합니다.

MaxSamplerate

Ingress Stream의 Audio Samplerate가 설정값보다 높을 때 감지합니다.

LongKeyFrameInterval

Ingress Stream의 Keyframe Interval이 너무 길 때 감지합니다.

  • 기준은 4초 초과입니다.

HasBFrames

Ingress Stream에 B-frame이 포함되어 있을 때 감지합니다.

Egress

StreamStatus

Egress Stream의 생성, 준비 완료, 실패, 삭제 상태를 감지합니다.

LLHLSReady

Low-Latency HLS 재생이 가능해지는 시점을 감지합니다.

HLSReady

HLS 재생이 가능해지는 시점을 감지합니다.

TranscodeStatus

Egress Stream의 Transcoding 과정에서 발생할 수 있는 Decoding, Encoding, Filtering의 실패 상태를 감지합니다.

InternalQueueCongestion

내부 Queue가 혼잡한 상황을 감지합니다.

Anomaly

DTSReversal

DTS가 단조 증가 하지 않는 경우를 탐지합니다.

DTSJump

연속된 프레임 간 DTS가 급격히 증가한 경우를 탐지합니다.

DTSDuplication

연속된 프레임 간 DTS가 동일한 경우를 탐지합니다.

PacketTimeout

지정한 시간 동안 패킷이 수신되지 않는 경우를 탐지합니다.

Notification 구성 알아보기

Request

Element

다음은 JSON Payload의 각 Element에 대한 상세 설명입니다:

Element
Description

messages

Rules에 의해 감지된 Messages 목록입니다.

type

JSON Payload의 형식을 나타냅니다. 값에 따라 포함되는 Element의 정보가 달라질 수 있습니다.

sourceUri

감지된 Source의 URI 정보입니다.

  • INGRESS: #<vhost>#<application>/<input_stream>

  • EGRESS: #<vhost>#<application>/<output_stream>

  • ANOMALY: #<vhost>#<application>/<input_stream>

sourceInfo

감지 시점의 Source 상세 정보입니다. 형식은 해당 Source를 REST API로 정보 조회한 응답과 동일합니다.

parentSourceUri

감지된 Source의 상위 레벨의 Source URI 정보입니다.

parentSourceInfo

감지 된 Source의 상황에 따라 상세 정보가 없을 수 있습니다. 이럴 때 Source를 추적 할 수 있도록 Source와 연결 된 상위 레벨의 Source에 대한 상세 정보입니다.

Messages

Type
Code
Description

INGRESS

INGRESS_STREAM_CREATED

A new ingress stream has been created.

INGRESS_STREAM_PREPARED

A ingress stream has been prepared.

INGRESS_STREAM_DELETED

A ingress stream has been deleted.

INGRESS_STREAM_CREATION_FAILED_DUPLICATE_NAME

Failed to create stream because the specified stream name is already in use.

INGRESS_BITRATE_LOW

The ingress stream's current video bitrate (%d bps) is lower than the configured bitrate (%d bps).

INGRESS_BITRATE_HIGH

The ingress stream's current video bitrate (%d bps) is higher than the configured bitrate (%d bps).

INGRESS_FRAMERATE_LOW

The ingress stream's current framerate (%.2f fps) is lower than the configured framerate (%.2f fps).

INGRESS_FRAMERATE_HIGH

The ingress stream's current framerate (%f fps) is higher than the configured framerate (%f fps).

INGRESS_WIDTH_SMALL

The ingress stream's width (%d) is smaller than the configured width (%d).

INGRESS_WIDTH_LARGE

The ingress stream's width (%d) is larger than the configured width (%d).

INGRESS_HEIGHT_SMALL

The ingress stream's height (%d) is smaller than the configured height (%d).

INGRESS_HEIGHT_LARGE

The ingress stream's height (%d) is larger than the configured height (%d).

INGRESS_SAMPLERATE_LOW

The ingress stream's current audio samplerate (%d) is lower than the configured samplerate (%d).

INGRESS_SAMPLERATE_HIGH

The ingress stream's current audio samplerate (%d) is higher than the configured samplerate (%d).

INGRESS_LONG_KEY_FRAME_INTERVAL

The ingress stream's current keyframe interval (%.1f seconds) is too long. Please use a keyframe interval of 4 seconds or less.

INGRESS_HAS_BFRAME

There are B-frames in the ingress stream.

EGRESS

EGRESS_STREAM_CREATED

A new egress stream has been created.

EGRESS_STREAM_PREPARED

A egress stream has been prepared.

EGRESS_STREAM_DELETED

A egress stream has been deleted.

EGRESS_STREAM_CREATION_FAILED_OUTPUT_PROFILE

Failed to create egress stream because the output profile configuration is invalid

EGRESS_STREAM_CREATION_FAILED_DECODER

Failed to create egress stream because the decoder could not be created

EGRESS_STREAM_CREATION_FAILED_ENCODER

Failed to create egress stream because the encoder could not be created

EGRESS_STREAM_CREATION_FAILED_FILTER

Failed to create egress stream because the filter could not be created

EGRESS_LLHLS_READY

Low-Latency HLS stream is ready to play - initial segment(s) have been generated.

EGRESS_HLS_READY

HLS stream is ready to play - initial segment(s) have been generated.

EGRESS_TRANSCODE_FAILED_DECODING

Failed to transcode the egress stream due to a frame decoding failure.

EGRESS_TRANSCODE_FAILED_ENCODING

Failed to transcode the egress stream due to a frame encoding failure.

EGRESS_TRANSCODE_FAILED_FILTERING

Failed to transcode the egress stream due to a frame filtering failure.

INTERNAL_QUEUE

INTERNAL_QUEUE

Internal queue(s) is currently congested

ANOMALY

ANOMALY_DTS_REVERSAL_DETECTED

DTS has been reversed by %lld.

ANOMALY_DTS_JUMP_DETECTED

DTS has increased significantly by %lld.

ANOMALY_DTS_DUPLICATION_DETECTED

DTS has been duplicated %d times.

ANOMALY_PACKET_TIMEOUT_DETECTED

No packets have been received for %lldms.

Additional Element (EGRESS_STREAM_CREATION_FAILED)

다음은 Egress Stream 생성 실패 시 제공되는 추가 정보입니다.

Egress Stream 실패 예제:

chevron-right#01 Output Track 생성 실패:hashtag
chevron-right#02-1 Decoder 생성 실패:hashtag
chevron-right#02-2 Encoder 생성 실패:hashtag
chevron-right#02-3 Filter 생성 실패:hashtag
chevron-right#03-1 Frame Decoding 실패:hashtag
chevron-right#03-2 Frame Encoding 실패:hashtag
chevron-right#03-3 Frame Filtering 실패:hashtag

typeEGRESS인 경우 전달되는 데이터:

Element
Description

sourceInfo

Egress Stream 정보입니다.

parentSourceInfo

Ingress Stream 정보입니다.

extraInfo.outputProfil

Stream 생성 실패 또는 Transcoding 실패와 관련된 Output Profile 정보입니다.

extraInto.codecModule

Stream 생성 실패 또는 Transcoding 실패와 관련된 Codec Module 정보입니다.

extraInfo.sourceTrackId

Stream 생성 실패 또는 Transcoding 실패와 관련된 Egress Stream의 Track ID입니다.

extraInfo.parentSourceTrackId

Stream 생성 실패 또는 Transcoding 실패와 관련된 Ingress Stream의 Track ID입니다.

Security

보안상의 이유로 Control Server는 수신된 HTTP 요청의 유효성을 검사해야 할 수 있습니다. 이를 위해 Enhanced Alert Module은 X-OME-Signature 값을 HTTP Request Header에 추가합니다.

이때, X-OME-SignatureServer.xml<Alert><SecretKey>에 설정된 Secret Key를 사용하여 HMAC-SHA1 Algorithm으로 HTTP Request의 Payload를 암호화한 뒤, URL-safe (base64)로 인코딩한 값입니다.

Response

Engine이 Closing 상태일 때, Response에 별도의 Parameter가 필요하지 않으므로 Response Payload는 무시됩니다.

Anomaly Detection | 0.20.1.0+

Anomaly Detection는 Streaming 과정에서 발생하는 Input Stream 오류를 탐지하고, Alert Callback 또는 Stream 종료 등 후속 조치를 취할 수 있는 모듈입니다.

Anomaly Detection는 아래와 같이 <Server><Alert><Rules>에서 설정할 수 있습니다:

Key
Default (Allowed)
Description

CheckDuration

10 (0-3600)

Action 실행 조건을 판단하기 위해, Anomaly 발생 횟수를 누적 집계하는 기준 시간입니다.

  • 단위는 초 (s)입니다.

CheckDuration으로 설정된 시간 내에 Threshold (아래 각 옵션마다 설명)를 초과하는 상황이 Count 횟수만큼 발생할 경우 Action이 발동됩니다.

  • ex) CheckDuration0으로 설정된 경우, Count1이면 대기 시간 없이 즉시 탐지하지만, Count2이상이면 시간 구간이 없으므로 탐지가 불가능합니다.

Count

1 (1-65535)

CheckDuration으로 설정된 시간 내에 Anomaly 횟수가 Count에 설정된 값보다 많이 발생하면 Anomaly로 판단합니다.

  • 단위는 회 입니다.

Action

N/A

Anomaly가 탐지된 이후에 어떤 후속 조치를 할지 지정합니다. 설정 가능한 후속 조치는 아래와 같으며, 복수로 지정할 수 있습니다.

  1. TerminateStream: Anomaly가 감지된 WebRTC, Ovt, RTMP, RtmpPull, Rtsp, RtspPull, Mpegts, Srt 와같은 Source Type일 때, Stream을 중단합니다.

  2. Alert: Anomaly 감지 여부를 Alert으로 전송합니다.

DTSReversal 설정하기

DTSReversal은 Decoding Time Stamp (DTS)가 이전 값 (ms)보다 작아지거나, 증가하지 않아 재생 문제가 생길 수 있는 경우를 탐지합니다.

DTSReversal<Server><Alert><Rules><Anomaly>에 설정할 수 있으며, 아래는 예제입니다:

= 최근 5초 동안 (CheckDuration) DTS가 5밀리초 이상 역전 (Threshold)된 횟수가 2회 이상 (Count)이라면 해당 Stream을 종료하고 Alert을 전송 (Action)합니다.

Key
Default (Allowed)
Description

Threshold

1 (1-2147483647)

"DTS가 몇 밀리초 이상 역전해야 Anomaly로 판단하는가?"에 대한 기준입니다.

  • 단위는 밀리초 (ms)입니다.

Notification 예제

DTSJump 설정하기

DTSJump는 연속된 Frame 사이에 DTS가 급격히 증가하여, 재생 문제를 일으킬 수 있는 경우를 탐지합니다.

DTSJump<Server><Alert><Rules><Anomaly>에 설정할 수 있으며, 아래는 예제입니다:

= 최근 5초 동안 (CheckDuration) DTS가 1,000밀리초 이상 급증 (Threshold)한 횟수가 2회 이상 (Count)이라면 해당 Stream을 종료하고 Alert을 전송 (Action)합니다.

Key
Default (Allowed)
Description

Threshold

1000 (1-2147483647)

"DTS가 몇 밀리초 이상 급증해야 Anomaly로 판단하는가?"에 대한기준입니다.

  • 단위는 밀리초 (ms)입니다.

Notification 예제

DTSDuplication 설정하기

DTSDuplication는 연속된 Frame의 DTS가 동일하여, 재생 문제를 일으킬 수 있는 경우를 탐지합니다.

DTSDuplication<Server><Alert><Rules><Anomaly>에 설정할 수 있으며, 아래는 예제입니다:

= 최근 5초 동안 (CheckDuration) DTS가 동일한 횟수가 2회 이상 (Count)이라면 해당 Stream을 종료하고 Alert을 전송 (Action)합니다.

Notification 예제

PacketTimeout 설정하기

PacketTimeout은 지정한 시간 동안 Packet이 수신되지 않아, 재생 문제를 일으킬 수 있는 경우를 탐지합니다.

PacketTimeout<Server><Alert><Rules><Anomaly>에 설정할 수 있으며, 아래는 예제입니다:

= 최근 5초 동안 (CheckDuration) Packet이 1,000밀리초 이상 수신 (Threshold)되지 않은 횟수가 2회 이상 (Count)이라면 해당 Stream을 종료하고 Alert을 전송 (Action)합니다.

Key
Default (Allowed)
Description

Threshold

1500 (1-2147483647)

"Packet이 몇 밀리초 만큼 수신되지 않을 경우 Anomaly로 판단하는가?"에 대한 기준입니다.

  • 단위는 밀리초 (ms)입니다.

circle-exclamation

Notification 예제

Last updated