How to get server status via SNMP ?

Discussion on the (deprecated) VideoLAN Server application as well as the miniSAPserver stream announcer. This is not about VLC!
Forum rules
Please do not post VLC related questions in this forum category. See the Forum Rules for more information.
anhquan
New Cone
New Cone
Posts: 5
Joined: 13 Aug 2008 15:30

How to get server status via SNMP ?

Postby anhquan » 18 Aug 2008 16:36

Hello all,

I am working on a project which uses VLC.
I would like to make a web interface to control multiple streaming servers via SNMP.
And I don't know how to configure my SNMP agent.
In the source code (get from here: http://www.videolan.org/vlma/download.html), i could not find the implementation of SNMP Agent extension.
So how can VLC server communicate via SNMP.
I also saw the id like TRAFFIC_IN "1.3.6.1.4.1.2021.2016.11.4.1.2.10.116.114.97.102.102.105.99.95.105.110.1", but could not find the MIB file which declare this number.

I tried to run this small test (which i added inside the VLMa source code) :
----------
public static void main(String[] args) {
try {
InetAddress address = InetAddress.getByName("127.0.01");
VlServerReal server = new VlServerReal("localhost",address);
System.out.println("CHECK :" +server.checkVLC());
server.updateSnmpData();

System.out.println("currentCpuLoad: "+server.currentCpuLoad);
System.out.println("currentTrafficIn: "+server.currentTrafficIn);
System.out.println("currentTrafficOut: "+server.currentTrafficOut);
System.out.println("currentVlcCpu: "+server.currentVlcCpu);
System.out.println("currentVlcMem: "+server.currentVlcMem);
System.out.println("Address = "+address.toString());
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
------------
and get those errors:
-----------
snmp.SNMPGetException: OID 1.3.6.1.4.1.2021.2016.10.4.1.2.8.99.112.117.95.108.111.97.100.1 not available for retrieval
at snmp.SNMPv1CommunicationInterface.getMIBEntry(SNMPv1CommunicationInterface.java:409)
at VlServerReal.updateSnmpData(VlServerReal.java:104)
at Test.main(Test.java:15)
Exception in thread "main" java.lang.NullPointerException
at VlServerReal.updateSnmpData(VlServerReal.java:117)
at Test.main(Test.java:15)
---------------

It seems that MIB configuration is wrong

I highly appreciate any help from you.

Thank you for your time

jpountz
Blank Cone
Blank Cone
Posts: 17
Joined: 22 Apr 2008 23:49

Re: How to get server status via SNMP ?

Postby jpountz » 18 Aug 2008 21:40

Hi,

Yes VLMa uses SNMP to retrieve metrics concerning VLC on a remote server. However, VLC does not answer thoses requests itself (VLMa is not part of VLC, it is a web interface which aims at making easy to manage of several servers running VLC), that's why you can't find the implementation of the SNMP agent extension. The server running VLC is supposed to have its SNMP server configured in order to answer thoses requests.

The easiest way to manage VLC remotely is probably the telnet interface. If you absolutely want to use SNMP or even get information that you can't get using VLC telnet interface, you could write a wrapper around VLC and embed a SNMP server in it. Clément Sténac had started writing a project similar to VLMa (but this project seems dead now) in which he used a wrapper around VLC to expose some methods through a web service. I think it could be easily adapted to run a SNMP server instead of a web server. The SVN repository of this project can be found here: https://svn.diwi.org/svn/manager/. For the wrapper around VLC, see the file trunk/pyclient/VLCWrapper.py.

I hope this helps you.
jpountz
Adrien Grand

anhquan
New Cone
New Cone
Posts: 5
Joined: 13 Aug 2008 15:30

Re: How to get server status via SNMP ?

Postby anhquan » 19 Aug 2008 01:20

Yes, to control VLC remotely, i can use telnet. However, in order to get such information as which channels are playing, using telnet interface is not effective (need to parse the text responsed from server).

Ok, then i will learn how to wrap VLC.

Link: https://svn.diwi.org/svn/manager/ is not working. May you have a check !

Thank you for your fast reply.

jpountz
Blank Cone
Blank Cone
Posts: 17
Joined: 22 Apr 2008 23:49

Re: How to get server status via SNMP ?

Postby jpountz » 19 Aug 2008 09:07

It is a Subversion repository. You can dowload the code by running the following command:
svn checkout https://svn.diwi.org/svn/manager/trunk
jpountz
Adrien Grand

anhquan
New Cone
New Cone
Posts: 5
Joined: 13 Aug 2008 15:30

Re: How to get server status via SNMP ?

Postby anhquan » 19 Aug 2008 10:47

Great, thanks a lot !

anhquan
New Cone
New Cone
Posts: 5
Joined: 13 Aug 2008 15:30

Re: How to get server status via SNMP ?

Postby anhquan » 19 Aug 2008 12:01

As i can see from the file VLCWrapper.py, this VLCWrapper actually uses Telnet interface to control VLC (play/stop/resume or something).
But there is no implementation to get streaming status. Well, i think in this wrapper, we have to use telnet command, e.g. "show my_channel_1", then parse the text responded from server :D

I try to find another way !

jpountz
Blank Cone
Blank Cone
Posts: 17
Joined: 22 Apr 2008 23:49

Re: How to get server status via SNMP ?

Postby jpountz » 19 Aug 2008 20:43

The idea behind the wrapper was to be able to check things like CPU usage of VLC, memory, or even restart it which are actions you can't do from VLC itself.

Parsing the output may be a good solution. I don't know if there is a better one. I'm not a VLC expert.
jpountz
Adrien Grand

fangji
New Cone
New Cone
Posts: 4
Joined: 08 Dec 2008 14:11

Re: How to get server status via SNMP ?

Postby fangji » 14 Dec 2008 12:44

Great!!!

aalixmani
New Cone
New Cone
Posts: 1
Joined: 30 Dec 2008 11:59
Contact:

Re: How to get server status via SNMP ?

Postby aalixmani » 30 Dec 2008 12:01

Thanks jpountz I also need this, Thanks again


Return to “VideoLAN Server and miniSAPserver”

Who is online

Users browsing this forum: No registered users and 2 guests