CoTURN使用情况统计

问题描述

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

解决方法

如果您想监控 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