sflow

The sflow tool can be easily configured to monitor both the hosts in a network as well as the OpenvSwitch(es). The sflow tool and implementation for OpenvSwitch is discussed here. Additional information about sflow can be found at the InMon sflow website. The sFlowTrend™ tool is a free, graphical network and server monitoring tool. The sflow installation using DNS-SD for the server hosts and a small script for the OpenvSwitch is remarkably fast and easy.

Install hsflowd Agent on Ubuntu KVM Host

The hsflowd agent can be installed on Ubuntu 14.04 KVM host by going to the sourceforge page for sflow and downloading the deb package for hsflowd. Open the deb package using the Ubuntu Software Manager (right click on the downloaded file and choose "Open with Ubuntu Software Manager"). The link for the download of the deb package is here at Sourceforge and is the hsflowd_1.22.2-1_x86_64.deb package.

The installer will complain that the package is of low-quality and will warn not to install it. Review the warning details and decide whether to Ignore the warning and install the package to continue. The package was installed on this system and works fine with no issues.

Building from source can be attempted as described here at sflow blog. This system would not build hsflowd from source, so the above deb package was used instead, rather than take the time to debug the issues with building from source (make step had issue).

Install hsflowd Agent on OEL KVM Guests

The hsflowd agent can be installed on OEL KVM guests by going to sourceforge page for sflow and downloading the rpm package for hsflowd. The link for the monitoring agent used on these OEL 6.3 and OEL 6.5 KVM guests is here at sourceforge and is the link for the hsflowd-1.24.1-1.x86_64.rpm package. Install the rpm package on each server to be monitored using the following command.

[root@oracle631 ~]# rpm -Uvh hsflowd-1.24.1-1.x86_64.rpm

Download sflowTrend from InMon

The sflow java-based tool is a completely free tool from InMon which is downloaded from here. On Ubuntu 14.04.1 x86_64 the product creates an icon on the desktop.

Configure DNS-SD on Master DNS Host

On this network, the master DNS server is on the oracle651.vmem.org KVM guest. Edit the forward zone file as shown below and run checkzone to be sure edit is correct. Be sure to also updated the "Serial" so that the change will be propagated to the Slave DNS server on the Ubuntu 14.0.4.1 x86_64 KVM host at vmem1.vmem.org as shown below. Items that need to be added / updated are shown in bold.

Note that once this is implemented, all that need be done to add additional hosts to sflow monitoring is install the hsflowd on the server, and then the server will automatically check in to sflowTrend GUI.

[root@oracle651 ~]# cat /var/named/fwd.vmem.org

$TTL 86400

$ORIGIN vmem.org.

@ IN SOA oracle651.vmem.org. postmaster.vmem.org. (

201408261137 ;Serial

60 ;Refresh

1800 ;Retry

604800 ;Expire

86400 ;Minimum TTL

)

@ IN NS oracle651 ; Master DNS Server

@ IN NS vmem1 ; Slave DNS Server

@ IN MX 10 oracle651 ; Mailserver

oracle651 IN A 10.207.39.74 ; KVM guest SCST iSCSI Linux SAN

oracle631 IN A 10.207.39.72 ; KVM guest Oracle Dataguard Primary (512e)

oracle632 IN A 10.207.39.76 ; KVM guest Oracle Dataguard Standby (4K )

oracle635 IN A 10.207.39.95 ; DNS master-slave propagation test IP

vmem1 IN A 10.207.39.1 ; KVM host (Ubuntu 14.04 laptop)

_sflow._udp SRV 0 0 6343 vmem1 ; sflowTrend monitoring host

_sflow._udp TXT (

"txtvers=1"

"polling=20"

"sampling=512"

)

[root@oracle651 ~]#

Verify Forward Zone File Update with Checkzone

The update to the forward zone lookup file can be validated with checkzone before restarting bind9 service as shown below.

[root@oracle651 ~]# named-checkzone vmem.org /var/named/fwd.vmem.org

zone vmem.org/IN: loaded serial 3839765521

OK

[root@oracle651 ~]#

Restart Named DNS Service

Restart the named DNS service as shown below.

[root@oracle651 ~]# service named restart

Stopping named: . [ OK ]

Starting named: [ OK ]

[root@oracle651 ~]#

Verify Servers Appear in sflow GUI

The servers which have agents installed (all of the KVM guests, and the KVM hosts) should self-configure in the sflowTrend GUI tool. It may take a few minutes depending on network and workload on the KVM guests and KVM host, but all servers should have checked in to sflow within about 10 minutes at the most. The graphs should begin to populate a bit after that. Click on the tabs of the GUI to see that the servers have checked in as shown below.

Add OpenvSwitch(es) to sflow

A short script is used to add OpenvSwitch to sflow monitoring as shown below. More information on the various parameters in the script can be found here.

gstanden@vmem1:~$ cat crt_sflow_sw1.sh

AGENT=sw1

COLLECTOR_IP=10.207.39.1

HEADER=128

SAMPLING=512

POLLING=10

COLLECTOR_PORT=6343

sudo ovs-vsctl -- --id=@sflow create sflow agent=${AGENT} \

target=\"${COLLECTOR_IP}:${COLLECTOR_PORT}\" header=${HEADER} \

sampling=${SAMPLING} polling=${POLLING} \

-- set bridge sw1 sflow=@sflow

gstanden@vmem1:~$

Run the script as shown below to being sflow OpenvSwitch monitoring, and verify the switch configuration update as shown below.

gstanden@vmem1:~$ pwd

/home/gstanden

gstanden@vmem1:~$ ./crt_sflow_sw1.sh

5749410f-b68d-4839-9d46-781a3dc16f31

gstanden@vmem1:~$

Verify update to OpenvSwitch as shown below.

gstanden@vmem1:~$ sudo ovs-vsctl list sflow

[sudo] password for gstanden:

_uuid : 5749410f-b68d-4839-9d46-781a3dc16f31

agent : "sw1"

external_ids : {}

header : 128

polling : 10

sampling : 512

targets : ["10.207.39.1:6343"]

gstanden@vmem1:~$ pwd

/home/gstanden

gstanden@vmem1:~$ ls -lrt

Add sflow to the other two switches, sw2 and sw3, as shown below.

/home/gstanden

gstanden@vmem1:~$ cat crt_sflow_sw2.sh

AGENT=sw2

COLLECTOR_IP=10.207.40.1

HEADER=128

SAMPLING=512

POLLING=10

COLLECTOR_PORT=6343

sudo ovs-vsctl -- --id=@sflow create sflow agent=${AGENT} \

target=\"${COLLECTOR_IP}:${COLLECTOR_PORT}\" header=${HEADER} \

sampling=${SAMPLING} polling=${POLLING} \

-- set bridge sw1 sflow=@sflow

gstanden@vmem1:~$ ifconfig sw2

sw2 Link encap:Ethernet HWaddr 62:00:50:4a:e6:4a

inet addr:10.207.40.1 Bcast:0.0.0.0 Mask:255.255.255.0

inet6 addr: fe80::bc90:c5ff:fe41:97cd/64 Scope:Link

UP BROADCAST RUNNING MTU:1500 Metric:1

RX packets:45 errors:0 dropped:0 overruns:0 frame:0

TX packets:9 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2990 (2.9 KB) TX bytes:690 (690.0 B)

gstanden@vmem1:~$ ./crt_sflow_sw2.sh

9777c0a3-bb66-4935-85a6-6c20de874cea

gstanden@vmem1:~$ cat crt_sflow_sw3.sh

AGENT=sw3

COLLECTOR_IP=10.207.41.1

HEADER=128

SAMPLING=512

POLLING=10

COLLECTOR_PORT=6343

sudo ovs-vsctl -- --id=@sflow create sflow agent=${AGENT} \

target=\"${COLLECTOR_IP}:${COLLECTOR_PORT}\" header=${HEADER} \

sampling=${SAMPLING} polling=${POLLING} \

-- set bridge sw1 sflow=@sflow

gstanden@vmem1:~$ ifconfig sw3

sw3 Link encap:Ethernet HWaddr 32:4c:9c:b6:2d:45

inet addr:10.207.41.1 Bcast:0.0.0.0 Mask:255.255.255.0

inet6 addr: fe80::7cc0:ecff:fec0:8e66/64 Scope:Link

UP BROADCAST RUNNING MTU:1500 Metric:1

RX packets:32 errors:0 dropped:0 overruns:0 frame:0

TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2140 (2.1 KB) TX bytes:648 (648.0 B)

gstanden@vmem1:~$ ./crt_sflow_sw3.sh

088a3c05-37c2-497c-a10a-7faa8dd29b42

gstanden@vmem1:~

Confirm OpenvSwitch is in sflow GUI

The sflow GUI should detect the OpenvSwitch and begin monitoring as shown below.

That's it, enjoy monitoring the KVM guests and KVM host with InMon sflowTrend !