• SEARCH
  • DOWNLOADS
  • MY ACCOUNT
  • Buy (0)
  • CONTACT
  • Free Trial
Wowza Logo
  • PRODUCTS
  • DEVELOPER
  • SOLUTIONS
  • PRICING
  • RESOURCES
  • SUPPORT
  • My Account
  • Buy (0)
  • SEARCH
  • Ask a question
  • Forums
    • Wowza ClearCaster Pro
    • Wowza Streaming Engine
    • Wowza Streaming Cloud
    • Wowza Player
    • Wowza GoCoder SDK
    • Wowza Developer Dojo
    • Topics
    • Questions
    • Articles
    • Users
    • Badges
  • Sign in
  • Community Home /
  • Wowza Developer Dojo /
  • Wowza Streaming Server Java API /
avatar image
Question by Georgi Ivanov · Aug 05, 2010 at 02:56 PM · wowza streaming server java api

Scripts to monitor Wowza connections from MRTG and Munin

Hi,

Here i will post scripts to monitor total and live connections for wowza servers. This will work on Linux(or Unix ?) platforms.

Someone may find this useful.

You will need the JMX command-line interface(you can download it from this forums).

I think this is the JMX command-line tool : http://www.wowza.com/forums/showthread.php?t=5668

MRTG

Create script /root/scripts/get_wowza_connections.sh

#!/bin/bash
TOTALCONNS=`java -cp /root/scripts JMXCommandLine -jmx service:jmx:rmi://$1:8084/jndi/rmi://$1:8085/jmxrmi -user admin -pass jmxpassword getConnectionCounts`
LIVECONNS=`java -cp /root/scripts JMXCommandLine -jmx service:jmx:rmi://$1:8084/jndi/rmi://$1:8085/jmxrmi -user admin -pass jmxpassword getConnectionCounts _defaultVHost_:liverepeater`
echo "$TOTALCONNS"
echo "$LIVECONNS"


Be sure to replace the values for username and password .

liverepeater is the name of your live app.

Test the script :

/root/scripts/get_wowza_connections.sh 10.0.0.1


It should print two numbers : Total connections and connections to your live application.

Put this snippet in your mrtg.conf

Target[edge1.conns]: `/root/scripts/get_wowza_connections.sh 10.0.0.1`
Directory[edge1.conns]:     myhostname
Options[edge1.conns]: nopercent,growright,gauge,noinfo
Title[edge1.conns]: Open Wowza connections  -- edge1.btvcluster
PageTop[edge1.conns]: <H1>Open Wowza connections  -- edge1.btvcluster</H1>
MaxBytes[edge1.conns]: 10000
YLegend[edge1.conns]: # conns
ShortLegend[edge1.conns]: connections
LegendI[edge1.conns]:  Total Connections:
LegendO[edge1.conns]:  Live Cons
Legend1[edge1.conns]: Open Wowza connections  -- myhostname


Munin:

Create script /root/scripts/get_wowza_connections.sh

#!/bin/bash
TOTALCONNS=`java -cp /root/scripts JMXCommandLine -jmx service:jmx:rmi://$1:8084/jndi/rmi://$1:8085/jmxrmi -user admin -pass jmxpassword getConnectionCounts`
LIVECONNS=`java -cp /root/scripts JMXCommandLine -jmx service:jmx:rmi://$1:8084/jndi/rmi://$1:8085/jmxrmi -user admin -pass jmxpassword getConnectionCounts _defaultVHost_:liverepeater`
echo "$TOTALCONNS $LIVECONNS"


Create munin plugin as follows (usually in /etc/munin/plugins/ ):

#!/bin/sh

case $1 in
   config)
        cat <<'EOM'
graph_title Wowza connections
graph_scale no
graph_category wowza
graph_vlabel connections
total_connections.label total connections
live_connections.label live connections
total_connections.draw AREA
live_connections.draw LINE1
EOM
        exit 0;;
esac

cons=`/root/scripts/get_wowza_connections.sh 10.0.0.1`

tot=`echo $cons | cut -d' ' -f1`
live=`echo $cons | cut -d' ' -f2`

echo -n "total_connections.value "
echo $tot

echo -n "live_connections.value "
echo $live


Here is the result:

Comment

People who like this

0 Show 0
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

8 Replies

· Add your reply
  • Sort: 
avatar image

Answer by tuan phan van · Jun 07, 2011 at 01:32 AM

Hi georgi,

Your post is very helpful for me, but i can't run it for my wowza. When i test the scrip:

sh /root/scripts/get_wowza_connections.sh 127.0.0.1

It showed:

ERROR: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:

java.net.ConnectException: Connection refused]

ERROR: java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:

java.net.ConnectException: Connection refused]

I don't know what's wrong, pls help me

thanks
Comment

People who like this

0 Show 1 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Georgi Ivanov · Jun 07, 2011 at 12:04 PM 0
Share
Hi,

I'm guessing but i think 127.0.0.1 is not the IP where JMX is listening. If i recall u can see these settings in Server.xml

You need to configure the IP in the config file.
avatar image

Answer by Richard Lanham · Jun 07, 2011 at 10:14 AM

JConsole/JMX quickstart guide is here:

http://www.wowza.com/forums/content.php?217#jmx

Richard
Comment

People who like this

0 Show 1 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tuan phan van · Jun 16, 2011 at 08:37 PM 0
Share
Hi georgi

I have configured JMX and Jconsole,but when i run Jconsole, it doesn't appear the image likes you, how can i get that image?
avatar image

Answer by Richard Lanham · Aug 23, 2011 at 10:32 PM

Should run same on Windows. Here is setup guide for JMX command line:

http://www.wowza.com/forums/content.php?151-Sample-Java-class-for-creating-a-command-line-interface-to-control-Wowza-Media-Server

Richard
Comment

People who like this

0 Show 1 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image danny lau · Mar 01, 2012 at 04:36 PM 0
Share
Should run same on Windows. Here is setup guide for JMX command line:

http://www.wowza.com/forums/content.php?151-Sample-Java-class-for-creating-a-command-line-interface-to-control-Wowza-Media-Server

Richard


I have installed mrtg and perl on my machine. However I have no idea on how to getting those graphs in windows.

Could anyone advise, please?
avatar image

Answer by Richard Lanham · Mar 01, 2012 at 02:38 PM

Regarding the graphs at the top of this thread posted by "georgi", I'm not familiar with that. You can get connection count graphs in JConsole like this:

http://www.wowza.com/forums/content.php?174-How-to-graph-individual-values-(ex.-concurrent-connections-to-the-server)

Richard
Comment

People who like this

0 Show 2 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image danny lau · Mar 02, 2012 at 11:16 AM 0
Share
Regarding the graphs at the top of this thread posted by "georgi", I'm not familiar with that. You can get connection count graphs in JConsole like this:

http://www.wowza.com/forums/content.php?174-How-to-graph-individual-values-(ex.-concurrent-connections-to-the-server)

Richard


Thanks, I got the graph in JConsole :cool:

However, how if I wanna to use MRTG to plot the graph? Any suggestions on how to do so?
avatar image lee lee danny lau · Jan 05, 2013 at 11:31 AM 0
Share
Hi,

How about Cacti? I'm trying to monitor the current connection through Cacti. Any help would be appreciated
avatar image

Answer by Richard Lanham · Jan 05, 2013 at 02:20 PM

Wowza EC2 AMIs used to include Cacti but do not now. We don't support it. Take a look at these HTTPProviders that provide real-time data for Wowza

http://www.wowza.com/forums/content.php?129-How-to-get-realtime-connection-counts-from-Wowza-Media-Server

Richard
Comment

People who like this

0 Show 1 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image lee lee · Jan 07, 2013 at 05:22 PM 0
Share
Hi Richard,

What I want is to create graph about current connection (CCU) statistics for monitoring. The built-in method only provide real-time data.

Is there an easy way to achieve this? I'm trying to use munin, according to geogri tutorial but nothing work.

Lee
avatar image

Answer by Richard Lanham · Jan 07, 2013 at 02:09 PM

Lee,

I am not sure about the contributed scripts at the top of this thread. These HTTPProviders include current connection counts. If you want to graph that over time you can poll these at intervals and build a set to graph

Richard
Comment

People who like this

0 Show 0 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Eliran Hayun · Aug 23, 2011 at 08:50 PM

Hi,

Did someone convert the scripts to Windows?
Comment

People who like this

0 Show 0 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Randall Auriemma · Mar 01, 2012 at 06:41 PM

Danny, you'd have to look at the docs for MRTG or Munin, depending on which one you decide to use.
Comment

People who like this

0 Show 3 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ekachai Woranut · Jul 26, 2012 at 12:49 AM 0
Share
I try as below have error

root@wowza:~# /root/scripts/get_wowza_connections.sh localhost

Exception in thread "main" java.lang.NoClassDefFoundError: JMXCommandLine

Caused by: java.lang.ClassNotFoundException: JMXCommandLine

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Could not find the main class: JMXCommandLine. Program will exit.

Exception in thread "main" java.lang.NoClassDefFoundError: JMXCommandLine

Caused by: java.lang.ClassNotFoundException: JMXCommandLine

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Could not find the main class: JMXCommandLine. Program will exit.
avatar image indra cyd Ekachai Woranut · Oct 19, 2012 at 01:55 PM 0
Share
this features is free?
avatar image indra cyd indra cyd · Oct 20, 2012 at 12:30 PM 0
Share
can someone help how to create graph with rrdtool?using that script?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Module to disconnect idle client connections after timeout period 1 Answer

Stream class stream controller 22 Answers

StreamNameAlias doesn't honor querystring 1 Answer

ModuleAddAudioTrack produces video speeding up 1 Answer

IMediaStream stream.getName is empty. How come? 2 Answers

Hot Topics
  • Streaming Protocols
  • Wowza SDKs
  • AWS Hosting
  • Deployment Options
  • Load Balancing
  • Content Security
Product Sign-in
  • Wowza Streaming Cloud
  • Wowza Player
Under the Hood
  • Developer Tools
  • Wowza System Status
  • Test Players
  • Developer IDE
Partners
  • Partners Overview
  • Find a Reseller
  • Channel Partner Program
  • OEM Program
  • Wowza Reseller Portal
Company
  • About Us
  • Blog
  • News
  • Events
  • Careers
  • Customers
  • Contact Us
Stay Connected
Sign Up for Our Blog
Select a Language
  • English
    • English
    • Español
    • 日本語
    • 한국어
    • हिन्दी भाषा
    • 中文
    • русский язык

© 2005–2019 Wowza Media Systems, LLC. All rights reserved.   Terms | Privacy | Trademarks | Legal


Enterprise
Social Q&A

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Forums
  • Wowza ClearCaster Pro
  • Wowza Streaming Engine
  • Wowza Streaming Cloud
  • Wowza Player
  • Wowza GoCoder SDK
  • Wowza Developer Dojo
  • Explore
  • Topics
  • Questions
  • Articles
  • Users
  • Badges