Page 1 of 1

How to get server status via SNMP ?

Posted: 18 Aug 2008 16:36
by anhquan
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

Re: How to get server status via SNMP ?

Posted: 18 Aug 2008 21:40
by jpountz
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.

Re: How to get server status via SNMP ?

Posted: 19 Aug 2008 01:20
by anhquan
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.

Re: How to get server status via SNMP ?

Posted: 19 Aug 2008 09:07
by jpountz
It is a Subversion repository. You can dowload the code by running the following command:
svn checkout https://svn.diwi.org/svn/manager/trunk

Re: How to get server status via SNMP ?

Posted: 19 Aug 2008 10:47
by anhquan
Great, thanks a lot !

Re: How to get server status via SNMP ?

Posted: 19 Aug 2008 12:01
by anhquan
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 !

Re: How to get server status via SNMP ?

Posted: 19 Aug 2008 20:43
by jpountz
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.

Re: How to get server status via SNMP ?

Posted: 14 Dec 2008 12:44
by fangji
Great!!!

Re: How to get server status via SNMP ?

Posted: 30 Dec 2008 12:01
by aalixmani
Thanks jpountz I also need this, Thanks again