How can I get nginx-rtmp-module stats for all workers?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I get nginx-rtmp-module stats for all workers?

Alexander Chekalin
Hello,

I’ve set up nginx with nginx-rtmp-module as a NGINX-based Media Streaming Server, and it works fine, but now I try to get stats for this server.

General approach is to use

location /stat {  rtmp_stat all; }

which produce xml that can be parsed nicely, but my suspicions are that I got stats for one worker random worker on each poll (not accumulated stats for all workers). The host itself is 4-cores, so I have 4 workers running and I think I got confusing stats since each poll brings me stats for random worker.

Is there any way I can use to get cumulated stats for all workers on host?

Thank you in advance!

- Alexander
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: How can I get nginx-rtmp-module stats for all workers?

Roman Arutyunyan
Hello,

On Wed, May 10, 2017 at 03:33:26PM +0000, Alexander Chekalin wrote:

> Hello,
>
> I’ve set up nginx with nginx-rtmp-module as a NGINX-based Media Streaming Server, and it works fine, but now I try to get stats for this server.
>
> General approach is to use
>
> location /stat {  rtmp_stat all; }
>
> which produce xml that can be parsed nicely, but my suspicions are that I got stats for one worker random worker on each poll (not accumulated stats for all workers). The host itself is 4-cores, so I have 4 workers running and I think I got confusing stats since each poll brings me stats for random worker.
>
> Is there any way I can use to get cumulated stats for all workers on host?

Yes, RTMP statistics is only available for a single worker.
For multi-worker statictics there was a patch "per-worker-listener" at
https://github.com/arut/nginx-patches.
However, this solution is not perfect.

--
Roman Arutyunyan
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: How can I get nginx-rtmp-module stats for all workers?

Alexander Chekalin
Thank you for the patch (and your attention). The only thing I don’t like in the idea is that patch is against nginx source, right? Just in a case nginx will ever change the source (and the patch is a bit outdated, isn’t it?) we can see problems on patching newer versions.

Just out of curiosity, is it possible to have one (accumulated) stat from all workers? I’m not a programmer by myself but I can try to find someone who can do that if the change is easy to implement.

Or maybe it is possible to output stats for different workers without patching nginx code itself (e.g. maybe via different URIs)?

Thank you again for your module and you attention for us your users! :)


> On 10 May 2017, at 17:25, Roman Arutyunyan <[hidden email]> wrote:
>
> Hello,
>
> On Wed, May 10, 2017 at 03:33:26PM +0000, Alexander Chekalin wrote:
>> Hello,
>>
>> I’ve set up nginx with nginx-rtmp-module as a NGINX-based Media Streaming Server, and it works fine, but now I try to get stats for this server.
>>
>> General approach is to use
>>
>> location /stat {  rtmp_stat all; }
>>
>> which produce xml that can be parsed nicely, but my suspicions are that I got stats for one worker random worker on each poll (not accumulated stats for all workers). The host itself is 4-cores, so I have 4 workers running and I think I got confusing stats since each poll brings me stats for random worker.
>>
>> Is there any way I can use to get cumulated stats for all workers on host?
>
> Yes, RTMP statistics is only available for a single worker.
> For multi-worker statictics there was a patch "per-worker-listener" at
> https://url.serverdata.net/?aZyQRg2CGut2qgyHrdHxA3r5xEAceK79DVxYd3Bfe3feJf7HCqpY0DPDS06nZJMU0e8eXTfFB-VA1xp75D9zo3w~~.
> However, this solution is not perfect.
>
> --
> Roman Arutyunyan
> _______________________________________________
> nginx mailing list
> [hidden email]
> https://url.serverdata.net/?a3BrMch5W140wejaZNkOqCNQqLTtIMrfZvjOpEFvhllkxqKu1_sY819idHe0COINGIHy8TOVEd5aW7nX9Av-rDw~~

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: How can I get nginx-rtmp-module stats for all workers?

Roman Arutyunyan
Hi,

On Thu, May 11, 2017 at 09:42:35AM +0000, Alexander Chekalin wrote:
> Thank you for the patch (and your attention). The only thing I don’t like in the idea is that patch is against nginx source, right? Just in a case nginx will ever change the source (and the patch is a bit outdated, isn’t it?) we can see problems on patching newer versions.
>
> Just out of curiosity, is it possible to have one (accumulated) stat from all workers? I’m not a programmer by myself but I can try to find someone who can do that if the change is easy to implement.

It does not look easy.  Otherwise I would have done this long ago.
Probably a solution is to store statistics in shared memory and make workers
update it regularly.

> Or maybe it is possible to output stats for different workers without patching nginx code itself (e.g. maybe via different URIs)?

Currently not.

> Thank you again for your module and you attention for us your users! :)
>
>
> > On 10 May 2017, at 17:25, Roman Arutyunyan <[hidden email]> wrote:
> >
> > Hello,
> >
> > On Wed, May 10, 2017 at 03:33:26PM +0000, Alexander Chekalin wrote:
> >> Hello,
> >>
> >> I’ve set up nginx with nginx-rtmp-module as a NGINX-based Media Streaming Server, and it works fine, but now I try to get stats for this server.
> >>
> >> General approach is to use
> >>
> >> location /stat {  rtmp_stat all; }
> >>
> >> which produce xml that can be parsed nicely, but my suspicions are that I got stats for one worker random worker on each poll (not accumulated stats for all workers). The host itself is 4-cores, so I have 4 workers running and I think I got confusing stats since each poll brings me stats for random worker.
> >>
> >> Is there any way I can use to get cumulated stats for all workers on host?
> >
> > Yes, RTMP statistics is only available for a single worker.
> > For multi-worker statictics there was a patch "per-worker-listener" at
> > https://url.serverdata.net/?aZyQRg2CGut2qgyHrdHxA3r5xEAceK79DVxYd3Bfe3feJf7HCqpY0DPDS06nZJMU0e8eXTfFB-VA1xp75D9zo3w~~.
> > However, this solution is not perfect.
> >
> > --
> > Roman Arutyunyan
> > _______________________________________________
> > nginx mailing list
> > [hidden email]
> > https://url.serverdata.net/?a3BrMch5W140wejaZNkOqCNQqLTtIMrfZvjOpEFvhllkxqKu1_sY819idHe0COINGIHy8TOVEd5aW7nX9Av-rDw~~
>
> _______________________________________________
> nginx mailing list
> [hidden email]
> http://mailman.nginx.org/mailman/listinfo/nginx

--
Roman Arutyunyan
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx