mikaku / Monitorix

Monitorix is a free, open source, lightweight system monitoring tool.
https://www.monitorix.org
GNU General Public License v2.0
1.12k stars 167 forks source link

wowza_update(): Not a HASH reference on live applications #88

Closed bsyd closed 9 years ago

bsyd commented 9 years ago

clean installation from up-to-date git. enabled wowza collecting added one existing app to the wowza channel list

                http://localhost:8086/connectioncounts = live

One minute after restarting, I see this message in the logs :

Fri Mar 27 10:26:00 2015 - wowza_update(): Not a HASH reference at /usr/lib/monitorix/wowza.pm line 336.

The impacted code is :

    336                                         if(ref($entry->{ApplicationInstance}->{Stream}) eq "ARRAY") {
    337                                                 $instance = $entry->{ApplicationInstance}->{Stream}[0];
    338                                         } else {
    339                                                 $instance = $entry->{ApplicationInstance}->{Stream};
    340                                         }

Result : no data collected and no wowza graphs.

bsyd commented 9 years ago

I just changed the application to a non-live (VOD) app, and the error disappears, graphs are showing. So this bug only strikes on live applications.

mikaku commented 9 years ago

I don't have a Wowza server to test so I'm using this public URL http://videostream.indostreamserver.com:8086/connectioncounts.

I've added only one channel and I don't see the errors you get.

mikaku commented 9 years ago

Perhaps you might want to email me directly or chat in IRC freenode #monitorix channel to be able to test with your own Wowza server using a private URL and see if we can fix all these problems with 'non-live' applications.

bsyd commented 9 years ago

which channel do you check on this server ? If I specify only non-live applications in my config, there are no problems. Only with live. Here is a sample of my live channel :

<Application>
<Name>live</Name>
<Status>loaded</Status>
<TimeRunning>74224.831</TimeRunning>
<ConnectionsCurrent>9</ConnectionsCurrent>
<ConnectionsTotal>2112</ConnectionsTotal>
<ConnectionsTotalAccepted>2024</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>88</ConnectionsTotalRejected>
<MessagesInBytesRate>122122.0</MessagesInBytesRate>
<MessagesOutBytesRate>852018.0</MessagesOutBytesRate>
<ApplicationInstance>
<Name>_definst_</Name>
<TimeRunning>74224.826</TimeRunning>
<ConnectionsCurrent>9</ConnectionsCurrent>
<ConnectionsTotal>2112</ConnectionsTotal>
<ConnectionsTotalAccepted>2024</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>88</ConnectionsTotalRejected>
<MessagesInBytesRate>123292.0</MessagesInBytesRate>
<MessagesOutBytesRate>860770.0</MessagesOutBytesRate>
<Stream>
<Name>direct.stream</Name>
<SessionsFlash>7</SessionsFlash>
<SessionsCupertino>1</SessionsCupertino>
<SessionsSanJose>0</SessionsSanJose>
<SessionsSmooth>0</SessionsSmooth>
<SessionsRTSP>0</SessionsRTSP>
<SessionsMPEGDash>0</SessionsMPEGDash>
<SessionsTotal>8</SessionsTotal>
</Stream>
</ApplicationInstance>
<ApplicationInstance>
<Name>direct.stream</Name>
<TimeRunning>64682.594</TimeRunning>
<ConnectionsCurrent>0</ConnectionsCurrent>
<ConnectionsTotal>0</ConnectionsTotal>
<ConnectionsTotalAccepted>0</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>0</ConnectionsTotalRejected>
<MessagesInBytesRate>0.0</MessagesInBytesRate>
<MessagesOutBytesRate>0.0</MessagesOutBytesRate>
</ApplicationInstance>
</Application>
mikaku commented 9 years ago

I've selected some random channels from that server:

http://videostream.indostreamserver.com:8086/connectioncounts = itworadio, klubsuksesmuliatv, achanneltv, nirwanatv, aqltv, kakilimatv, tv9, madurachannel

How do I know if a channel is a live application? and what are the differences between live and non-live applications?

Thanks.

bsyd commented 9 years ago

I see no big differences in the output between live and vod. A vod application can appear and disappear after a certain time if no access is done on it. The output contains the file names currently played show as streams, one stream for each file currently played.

The server you take as an exemple is live-only, AFAICT. I send you by email the url of my server.

To come back to the problem, I see a difference. In my case, there is an additionnal (with no streams) appinstance, as you can see in the sample above. I think it should be ignored. I don't see those empty appinstances in the url you give. Those empty appinstances may be coming from the urls I gave to the live encoders (I didn't specify the "_definst_").

mikaku commented 9 years ago

Hmm, I think I've found out the problem. [edit: Oh, I see now that you already found it, I'm having problems with Github web site, and your email arrived before]

It looks like your live application has multiple ApplicationInstances tags and (AFAIK) this is what is causing the problem since they are obtained as an ARRAY instead of a HASH.

Let me see if I can fix this.

mikaku commented 9 years ago

Please, check if the latest commit fix this for you.

bsyd commented 9 years ago

As an afterthought, I think that collecting individual transport statistics is rather pointless in the case of VOD. You cannot get global statistics this way since the numbers are linked to the currently playing stream. So, extracting

                    $rrdata .= ":" . ($instance->{SessionsRTSP} || 0);
                    $rrdata .= ":" . ($instance->{SessionsSmooth} || 0);
                    $rrdata .= ":" . ($instance->{SessionsCupertino} || 0);
                    $rrdata .= ":" . ($instance->{SessionsFlash} || 0);
                    $rrdata .= ":" . ($instance->{SessionsSanJose} || 0);
                    $rrdata .= ":" . ($instance->{SessionsTotal} || 0);
                    $rrdata .= ":" . "0:0";

doesn't give you any usable information.

bsyd commented 9 years ago

the last commit fixed the bad behaviour.

bsyd commented 9 years ago

And for the individual transports counters, I use JMX.