Created
October 17, 2017 17:17
-
-
Save jmaitrehenry/e4408ce82865468134d680fe2593eb97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Discovery Rule | |
| # | |
| # HAProxy Frontend, Backend and Server Discovery rules | |
| UserParameter=haproxy.list.discovery[*],/usr/local/bin/haproxy_discovery.sh $1 $2 | |
| # cached results | |
| UserParameter=haproxy.stats[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 $4 | |
| # support legacy way | |
| UserParameter=haproxy.stat.qcur[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 qcur | |
| UserParameter=haproxy.stat.qmax[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 qmax | |
| UserParameter=haproxy.stat.scur[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 scur | |
| UserParameter=haproxy.stat.smax[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 smax | |
| UserParameter=haproxy.stat.slim[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 slim | |
| UserParameter=haproxy.stat.bin[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 bin | |
| UserParameter=haproxy.stat.bout[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 bout | |
| UserParameter=haproxy.stat.dreq[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 dreq | |
| UserParameter=haproxy.stat.dresp[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 dresp | |
| UserParameter=haproxy.stat.ereq[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 ereq | |
| UserParameter=haproxy.stat.econ[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 econ | |
| UserParameter=haproxy.stat.eresp[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 eresp | |
| UserParameter=haproxy.stat.wretr[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 wretr | |
| UserParameter=haproxy.stat.wredis[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 wredis | |
| UserParameter=haproxy.stat.weight[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 weight | |
| UserParameter=haproxy.stat.act[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 act | |
| UserParameter=haproxy.stat.bck[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 bck | |
| UserParameter=haproxy.stat.chkfail[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 chkfail | |
| UserParameter=haproxy.stat.chkdown[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 chkdown | |
| UserParameter=haproxy.stat.lastchg[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 lastchg | |
| UserParameter=haproxy.stat.downtime[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 downtime | |
| UserParameter=haproxy.stat.qlimit[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 qlimit | |
| UserParameter=haproxy.stat.throttle[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 throttle | |
| UserParameter=haproxy.stat.lbtot[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 lbtot | |
| UserParameter=haproxy.stat.tracked[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 tracked | |
| UserParameter=haproxy.stat.type[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 type | |
| UserParameter=haproxy.stat.rate[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 rate | |
| UserParameter=haproxy.stat.rate_lim[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 rate_lim | |
| UserParameter=haproxy.stat.rate_max[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 rate_max | |
| UserParameter=haproxy.stat.check_status[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 check_status | |
| UserParameter=haproxy.stat.check_code[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 check_code | |
| UserParameter=haproxy.stat.check_duration[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 check_duration | |
| UserParameter=haproxy.stat.req_rate[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 req_rate | |
| UserParameter=haproxy.stat.req_rate_max[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 req_rate_max | |
| UserParameter=haproxy.stat.req_tot[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 req_tot | |
| UserParameter=haproxy.stat.cli_abrt[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 cli_abrt | |
| UserParameter=haproxy.stat.srv_abrt[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 srv_abrt | |
| UserParameter=haproxy.stat.comp_in[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 comp_in | |
| UserParameter=haproxy.stat.comp_out[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 comp_out | |
| UserParameter=haproxy.stat.comp_byp[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 comp_byp | |
| UserParameter=haproxy.stat.comp_rsp[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 comp_rsp | |
| UserParameter=haproxy.stat.lastsess[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 lastsess | |
| UserParameter=haproxy.stat.qtime[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 qtime | |
| UserParameter=haproxy.stat.ctime[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 ctime | |
| UserParameter=haproxy.stat.rtime[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 rtime | |
| UserParameter=haproxy.stat.status[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 status | |
| UserParameter=haproxy.stat.pid[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 pid | |
| UserParameter=haproxy.stat.iid[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 iid | |
| UserParameter=haproxy.stat.sid[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 sid | |
| UserParameter=haproxy.stat.hrsp_1xx[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 hrsp_1xx | |
| UserParameter=haproxy.stat.hrsp_2xx[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 hrsp_2xx | |
| UserParameter=haproxy.stat.hrsp_3xx[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 hrsp_3xx | |
| UserParameter=haproxy.stat.hrsp_4xx[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 hrsp_4xx | |
| UserParameter=haproxy.stat.hrsp_5xx[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 hrsp_5xx | |
| UserParameter=haproxy.stat.hrsp_other[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 hrsp_other | |
| UserParameter=haproxy.stat.hanafail[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 hanafail | |
| UserParameter=haproxy.stat.last_chk[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 last_chk | |
| UserParameter=haproxy.stat.last_agt[*],/usr/local/bin/haproxy_stats.sh $1 $2 $3 last_agt | |
| # Debugging / Running it manually | |
| ## Discover: /usr/local/bin/haproxy_discovery.sh $1 $2 | |
| ### $1 is a path to haproxy socket | |
| ### $2 is FRONTEND or BACKEND or SERVERS | |
| # /usr/local/bin/haproxy_discovery.sh /var/run/haproxy/info.sock FRONTEND # second argument is optional | |
| # /usr/local/bin/haproxy_discovery.sh /var/run/haproxy/info.sock BACKEND # second argument is optional | |
| # /usr/local/bin/haproxy_discovery.sh /var/run/haproxy/info.sock SERVERS # second argument is optional | |
| # haproxy_stats.sh script | |
| ## haproxy_stats.sh $1 $2 $3 $4 | |
| ### $1 is a path to haproxy socket - optional, defaults to haproxy_stats.sh | |
| ### $2 is a name of the backend, as set in haproxy.cfg | |
| ### $3 is a name of the server, as set in haproxy.cfg | |
| ### $4 is a stat as references by HAProxy terminology | |
| # haproxy_stats.sh /var/run/haproxy/info.sock www-backend www01 status | |
| # haproxy_stats.sh www-backend BACKEND status | |
| # haproxy_stats.sh https-frontend FRONTEND status | |
| # For the list of stats HAProxy supports as of version 1.5 | |
| # see TEXT: http://www.haproxy.org/download/1.5/doc/configuration.txt | |
| # see HTML: http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#9.1 | |
| # Getting stats from HAProxy manually | |
| ## Bytes In: echo "show stat" | socat $1 stdio | grep "^$2,$3" | cut -d, -f9 | |
| ## Bytes Out: echo "show stat" | socat $1 stdio | grep "^$2,$3" | cut -d, -f10 | |
| ## Session Rate: echo "show stat" | socat $1 stdio | grep "^$2,$3" | cut -d, -f5 | |
| ### $1 is a path to haproxy socket | |
| ### $2 is a name of the backend, as set in haproxy.cfg | |
| ### $3 is a name of the server, as set in haproxy.cfg | |
| # echo "show stat" | socat /var/run/haproxy/info.sock stdio | grep "^www-backend,www01" | cut -d, -f9 | |
| # echo "show stat" | socat /var/run/haproxy/info.sock stdio | grep "^www-backend,BACKEND" | cut -d, -f10 | |
| # echo "show stat" | socat /var/run/haproxy/info.sock stdio | grep "^https-frontend,FRONTEND" | cut -d, -f5 | |
| # echo "show stat" | socat /var/run/haproxy/info.sock stdio | grep "^api-backend,api02" | cut -d, -f18 | cut -d\ -f1 | |
| ## | |
| # Take a look at the output of the following to learn more about what is available though HAProxy socket | |
| # echo "show stat" | socat /var/run/haproxy/info.sock stdio |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment