首页 > 解决方案 > CoTURN 使用统计

问题描述

我对 WebRTC 世界还是有点陌生​​,并试图找到自己的出路。我已成功设置 CoTURN,并且能够使用 CoTURN 在防火墙后面路由呼叫。现在我想知道是否有可能以某种方式检查并可能可视化 CoTURN 的使用统计信息?我很想知道在任何给定时间有多少用户在使用服务器,带宽和 CPU 使用率是多少等?我在官方文档中看到了有关如何优化带宽和 CPU 使用率的详细信息,但我没有找到任何有关实际监控使用情况的信息。任何帮助将不胜感激。

标签: webrtcturncoturn

解决方案


如果您想监控标准使用统计信息,例如 CPU 使用情况、负载、带宽等,您可以专注于您的基础架构可用的内容。例如,在 AWS 中,您可以使用 CloudWatch,或者在通用 Linux 部署中使用 Prometheus 导出使用统计数据,然后使用 Grafana 呈现它们。

对于 coturn/TURN 特定的统计信息,coturn 允许在 Redis 中存储一些指标;它在https://github.com/coturn/coturn/blob/master/turndb/schema.stats.redis中有描述

Total traffic information is also reported when the allocation is deleted. The keys are
"turn/user/<username>/allocation/<id>/total_traffic" or "turn/user/<username>/allocation/<id>/total_traffic/peer". 
Applications interested in the total amount of traffic per allocation can subscribe to these events as:

    psubscribe turn/realm/*/user/*/allocation/*/total_traffic
    psubscribe turn/realm/*/user/*/allocation/*/total_traffic/peer

推荐阅读