Bernard,

works for me.  

Thanx,
Matthias

On Tue, 15 Jan 2008, Bernard Li wrote:

> Hi Brad:
> 
> The following patch should make tcpconn.py compatible with Python
> 2.3.x which does not have the subprocess module:
> 
> --- tcpconn.py.orig     2008-01-15 15:30:09.000000000 -0800
> +++ tcpconn.py  2008-01-15 15:30:48.000000000 -0800
> @@ -30,7 +30,7 @@
>  #* Author: Brad Nicholes (bnicholes novell.com)
>  
> #******************************************************************************/
> 
> -import os, sys, subprocess
> +import os, sys, popen2
>  import threading
>  import time
> 
> @@ -210,7 +210,7 @@
>                  tempconns[conn] = 0
> 
>              #Call the netstat utility and split the output into separate 
> lines
> -            netstat_output=subprocess.Popen(["netstat", '-t', '-a'],
> stdout=subprocess.PIPE).communicate()[0]
> +            netstat_output=popen2.popen2(["netstat", '-t', '-a'],
> mode='r')[0].read()
>              lines = netstat_output.splitlines()
> 
>              #Iterate through the netstat output looking for the 'tcp'
> keyword in the tcp_at
> 
> Cheers,
> 
> Bernard
> 
> On 11/8/07, Brad Nicholes <[EMAIL PROTECTED]> wrote:
> > >>> On 11/7/2007 at 4:16 PM, in message
> > <[EMAIL PROTECTED]>, "Bernard Li"
> > <[EMAIL PROTECTED]> wrote:
> > > Hi Brad:
> > >
> > > On 11/7/07, Brad Nicholes <[EMAIL PROTECTED]> wrote:
> > >
> > >> Yes, the fact that the .py file exists in the
> > > /usr/lib/ganglia/python_modules directory means that mod_python will
> > > automatically load the module.  Gmond will not try to collect metrics 
> > > from it
> > > or call any of its handlers, but it will load the module.  The only way to
> > > avoid this is to move the .py file out of the directory or give it a
> > > different extention.  So to disable a python module, you not only have to
> > > rename the .conf file, but you also have to move or remove the 
> > > corresponding
> > > .py file itself.
> > >>   So the more interesting question is why won't the tcpconn module load?
> > > One of the nice things about building a gmond python module is that you 
> > > can
> > > actually do all of the development and debugging completely independent 
> > > from
> > > gmond.  In other words, you can just run the .py script directly through
> > > python and it will function just as if gmond had called it.  Have you 
> > > tried
> > > to run tcpconn.py directly in python?  I would be interested to know what 
> > > it
> > > is failing on.
> > >
> > > # python tcpconn.py
> > > Traceback (most recent call last):
> > >   File "tcpconn.py", line 33, in ?
> > >     import os, sys, subprocess
> > > ImportError: No module named subprocess
> > >
> > > # rpm -q python
> > > python-2.3.4-14.4
> > >
> > > 'subprocess' was introduced in Python 2.5 I believe -- perhaps you can
> > > re-write it using popen?
> > >
> >
> > Perfect, that's what I needed to know.
> >
> > Brad
> >
> >
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Ganglia-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ganglia-developers
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to