[ovs-dev] problem with sflow

Neil McKee neil.mckee at inmon.com
Thu Jul 15 15:57:53 UTC 2010


The example config in that blog entry predates the move to JSON config for OpenVSwitch.  I'm guessing that is what went wrong.  Below is a script  that uses the ovs-vsctl command-line tools to query the list of bridges and then configure sFlow on each one.

 You'll need to adjust the settings on the first few lines,  or make them input parameters.   Note that setting AGENT_IP=xenbr0 is the same as saying "get the IP from the interface called 'xenbr0'".

#!/bin/bash
COLLECTOR=10.0.0.9:6347
AGENT_IP=xenbr0
HEADER_BYTES=128
SAMPLING_N=256
POLLING_SECS=30
SFLOWUUID=`ovs-vsctl create sFlow  \
           agent=\"${AGENT_IP}\"   \
           target=\"${COLLECTOR}\" \
           header=${HEADER_BYTES}  \
           sampling=${SAMPLING_N}  \
           polling=${POLLING_SECS}`
for BRIDGE in `ovs-vsctl list br | awk -- '/^name/ { print $3; }'` ; do
    BRIDGE=`echo $BRIDGE | tr -d "\""`
    echo "configuring sFlow for $BRIDGE"
    ovs-vsctl set bridge $BRIDGE sflow=$SFLOWUUID ;
done


and here is a script that should reverse that out again:

#!/bin/bash
for SFLOWUUID in `ovs-vsctl list sflow | awk -- '/^_uuid/ { print $3; }'` ; do
   for BRIDGE in `ovs-vsctl list br | awk -- '/^name/ { print $3; }'` ; do
       BRIDGE=`echo $BRIDGE | tr -d "\""`
       ovs-vsctl remove bridge $BRIDGE sflow $SFLOWUUID ;
   done
   ovs-vsctl destroy sflow $SFLOWUUID;
done

These haven't been tested since May,  so please let me know if they work or not.

Regards,
Neil


P.S. bash(1) gurus probably know a better way to remove double-quotes that using tr(1).  I think you can do it using $(( ))  or something like that.


On Jul 15, 2010, at 8:03 AM, Ben Pfaff wrote:

> On Thu, Jul 15, 2010 at 2:22 AM, Kiani, Parham <pkiani at essex.ac.uk> wrote:
>> I am new in openvswitch and I have one computer with nox and one computer openvswitch(five ports)(192.168.1.1). these computers connected to each other and a br0 has been created. I have been trying to use sflow due to  visualize my network.I installed sflow trend in my controller computer(192.168.1.2) and trying configure my switch with help of http://blog.sflow.com/2010/01/open-vswitch.html . unfortunatley, I can not manage it. I was wondering if somebody could help me and explain what exacly should be done with help of commands. did i do wrong to install sflowswitch in my controler computer?
> 
> Could you be more specific?  So far as I can tell from your message,
> you are just saying "it doesn't work".  What did you do, what happened,
> and what did you expect to happen?
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list