Hello All,

I had a go at adding standard sFlow instrumentation to haproxy:
https://github.com/sflow/haproxy

This implements the exact same binary-logging-over-UDP export that you get from 
mod-sflow for apache, nginx-sflow-module, tomcat-sflow-valve, and more.  It 
supports random 1-in-N sampling for scalability,  and it is designed to be 
integrated with host performance counters from hsflowd,  along with sFlow 
traffic monitoring from most network switches.  (The goal being holistic 
end-to-end visibility).

Anyone want to try it out?

(If you would need it on a particular branch of haproxy,  let me know.)

These would be the "getting started" steps:

(1) make TARGET=linux26 USE_SFLOW=yes
(2) install hsflowd from http://host-sflow.sourceforge.net
(3) edit /etc/hsflowd.conf to set DNSSD=off,  configure manual collector for 
"collector { ip = 127.0.0.1 } ",  and add a line with "sampling.http = 1"
(4) /etc/init.d/hsflowd start
(5) download sflowtool sources from 
http://www.inmon.com/technology/sflowTools.php (a simple tool for ASCIIfying 
the binary feed)
(6) configure; make; make install
(7) run "sflowtool"
(8) generate some requests through haproxy
(9) you should see output in sflowtool looking something like this:

extendedType proxy_socket4
proxy_socket4_ip_protocol 6
proxy_socket4_local_ip 0.0.0.0
proxy_socket4_remote_ip 10.0.0.160
proxy_socket4_local_port 0
proxy_socket4_remote_port 80
flowBlock_tag 0:2100
extendedType socket4
socket4_ip_protocol 6
socket4_local_ip 0.0.0.0
socket4_remote_ip 10.1.3.2
socket4_local_port 0
socket4_remote_port 62902
flowBlock_tag 0:2206
flowSampleType http
http_method 2
http_protocol 1001
http_uri GET 
/inmsf/Widget?id=base.categorytrend.1&height=200&width=320&ms=1362731388006 
HTTP/1.1
http_host 10.0.0.153:8080
http_referrer http://10.0.0.153:8080/inmsf/Home?action=widgets
http_useragent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:19.0) 
Gecko/20100101 Firefox/19.0
http_mimetype image/png
http_request_bytes 11292
http_bytes 481
http_duration_uS 1434000
http_status 200

(10) Ganglia will accept this feed and display the host and http counters.   
Other sFlow collectors are listed here:
http://sflow.org/products/collectors.php
(Though not all of these will recognize the sFlow-HTTP structures).

More background and documentation here:
http://blog.sflow.com/search?q=HTTP

Neil

Reply via email to