louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
56.78k stars 5.11k forks source link

[New Monitor] RTSP support #2851

Open myxor opened 1 year ago

myxor commented 1 year ago

⚠️ Please verify that this feature request has NOT been suggested before.

🏷️ Feature Request Type

New Monitor

🔖 Feature description

Support RTSP (https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol) which is often used by IP Cameras.

✔️ Solution

Support RTSP Monitor

❓ Alternatives

-

📝 Additional Context

-

totalitarian commented 1 year ago

love this too

CommanderStorm commented 1 year ago

As always: We are open to PRs, here is our contribution guide.

Note that

Baruxa commented 10 months ago

I need it very much, that would be great!!!

serveradmin9912 commented 9 months ago

Yes I would need that too. Im currently just pinging the cams. A RTSP checkup would be more precise.

thielj commented 8 months ago

@CommanderStorm

RTSP(S) is almost exactly like HTTP(S), except that you would send a request like this...

OPTIONS rtsp://media.example.com:554/path?query RTSP/1.0
CSeq: 1

...and receive a respnse like that...

RTSP/1.0 200 OK
Cseq: 1

...plus some optional headers you can ignore. The major difference is the use of RTSP/1.0 vs HTTP/1.0 and that most implementations probably require the CSeq header.


Testing if the camera actually transmits a video stream would require using ffprobe (from ffmpeg). For example, the following could be run repeatedly from a cron job:

docker run -it --rm --entrypoint ffprobe minidocks/ffmpeg \
  -hide_banner -loglevel info \
  -rtsp_transport tcp \
  -i 'rtsp://media.example.com:554/path?query' \
  | grep 'Video:.*' \
  && curl https://uptime-kuma.example.com/api/push/hJKhjk4Hjk?status=up

Run only the first few lines before the grep until you can get a sensible output. Then grep for whatever assures you that your camera feed is what you're expecting. For brownie points, extract a fancy message and pass it on to uptime-kuma.

If ffprobe is already installed, replace the first line with just ffprobe.