|
|
|
|
@ -88,7 +88,7 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
@@ -88,7 +88,7 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
|
|
|
|
|
|
|
|
|
|
res := m.pathManager.apiPathsList() |
|
|
|
|
if res.err == nil && len(res.data.Items) != 0 { |
|
|
|
|
for name, i := range res.data.Items { |
|
|
|
|
for _, i := range res.data.Items { |
|
|
|
|
var state string |
|
|
|
|
if i.SourceReady { |
|
|
|
|
state = "ready" |
|
|
|
|
@ -96,7 +96,7 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
@@ -96,7 +96,7 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
|
|
|
|
|
state = "notReady" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
tags := "{name=\"" + name + "\",state=\"" + state + "\"}" |
|
|
|
|
tags := "{name=\"" + i.Name + "\",state=\"" + state + "\"}" |
|
|
|
|
out += metric("paths", tags, 1) |
|
|
|
|
out += metric("paths_bytes_received", tags, int64(i.BytesReceived)) |
|
|
|
|
} |
|
|
|
|
@ -107,8 +107,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
@@ -107,8 +107,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
|
|
|
|
|
if !interfaceIsEmpty(m.hlsManager) { |
|
|
|
|
res := m.hlsManager.apiMuxersList() |
|
|
|
|
if res.err == nil && len(res.data.Items) != 0 { |
|
|
|
|
for name, i := range res.data.Items { |
|
|
|
|
tags := "{name=\"" + name + "\"}" |
|
|
|
|
for _, i := range res.data.Items { |
|
|
|
|
tags := "{name=\"" + i.Path + "\"}" |
|
|
|
|
out += metric("hls_muxers", tags, 1) |
|
|
|
|
out += metric("hls_muxers_bytes_sent", tags, int64(i.BytesSent)) |
|
|
|
|
} |
|
|
|
|
@ -122,8 +122,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
@@ -122,8 +122,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
|
|
|
|
|
func() { |
|
|
|
|
res := m.rtspServer.apiConnsList() |
|
|
|
|
if res.err == nil && len(res.data.Items) != 0 { |
|
|
|
|
for id, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + id + "\"}" |
|
|
|
|
for _, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + i.ID.String() + "\"}" |
|
|
|
|
out += metric("rtsp_conns", tags, 1) |
|
|
|
|
out += metric("rtsp_conns_bytes_received", tags, int64(i.BytesReceived)) |
|
|
|
|
out += metric("rtsp_conns_bytes_sent", tags, int64(i.BytesSent)) |
|
|
|
|
@ -138,8 +138,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
@@ -138,8 +138,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
|
|
|
|
|
func() { |
|
|
|
|
res := m.rtspServer.apiSessionsList() |
|
|
|
|
if res.err == nil && len(res.data.Items) != 0 { |
|
|
|
|
for id, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + id + "\",state=\"" + i.State + "\"}" |
|
|
|
|
for _, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + i.ID.String() + "\",state=\"" + i.State + "\"}" |
|
|
|
|
out += metric("rtsp_sessions", tags, 1) |
|
|
|
|
out += metric("rtsp_sessions_bytes_received", tags, int64(i.BytesReceived)) |
|
|
|
|
out += metric("rtsp_sessions_bytes_sent", tags, int64(i.BytesSent)) |
|
|
|
|
@ -156,8 +156,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
@@ -156,8 +156,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
|
|
|
|
|
func() { |
|
|
|
|
res := m.rtspsServer.apiConnsList() |
|
|
|
|
if res.err == nil && len(res.data.Items) != 0 { |
|
|
|
|
for id, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + id + "\"}" |
|
|
|
|
for _, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + i.ID.String() + "\"}" |
|
|
|
|
out += metric("rtsps_conns", tags, 1) |
|
|
|
|
out += metric("rtsps_conns_bytes_received", tags, int64(i.BytesReceived)) |
|
|
|
|
out += metric("rtsps_conns_bytes_sent", tags, int64(i.BytesSent)) |
|
|
|
|
@ -172,8 +172,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
@@ -172,8 +172,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
|
|
|
|
|
func() { |
|
|
|
|
res := m.rtspsServer.apiSessionsList() |
|
|
|
|
if res.err == nil && len(res.data.Items) != 0 { |
|
|
|
|
for id, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + id + "\",state=\"" + i.State + "\"}" |
|
|
|
|
for _, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + i.ID.String() + "\",state=\"" + i.State + "\"}" |
|
|
|
|
out += metric("rtsps_sessions", tags, 1) |
|
|
|
|
out += metric("rtsps_sessions_bytes_received", tags, int64(i.BytesReceived)) |
|
|
|
|
out += metric("rtsps_sessions_bytes_sent", tags, int64(i.BytesSent)) |
|
|
|
|
@ -189,8 +189,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
@@ -189,8 +189,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
|
|
|
|
|
if !interfaceIsEmpty(m.rtmpServer) { |
|
|
|
|
res := m.rtmpServer.apiConnsList() |
|
|
|
|
if res.err == nil && len(res.data.Items) != 0 { |
|
|
|
|
for id, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + id + "\",state=\"" + i.State + "\"}" |
|
|
|
|
for _, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + i.ID.String() + "\",state=\"" + i.State + "\"}" |
|
|
|
|
out += metric("rtmp_conns", tags, 1) |
|
|
|
|
out += metric("rtmp_conns_bytes_received", tags, int64(i.BytesReceived)) |
|
|
|
|
out += metric("rtmp_conns_bytes_sent", tags, int64(i.BytesSent)) |
|
|
|
|
@ -205,8 +205,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
@@ -205,8 +205,8 @@ func (m *metrics) onMetrics(ctx *gin.Context) {
|
|
|
|
|
if !interfaceIsEmpty(m.webRTCManager) { |
|
|
|
|
res := m.webRTCManager.apiSessionsList() |
|
|
|
|
if res.err == nil && len(res.data.Items) != 0 { |
|
|
|
|
for id, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + id + "\"}" |
|
|
|
|
for _, i := range res.data.Items { |
|
|
|
|
tags := "{id=\"" + i.ID.String() + "\"}" |
|
|
|
|
out += metric("webrtc_sessions", tags, 1) |
|
|
|
|
out += metric("webrtc_sessions_bytes_received", tags, int64(i.BytesReceived)) |
|
|
|
|
out += metric("webrtc_sessions_bytes_sent", tags, int64(i.BytesSent)) |
|
|
|
|
|