Standard URI for haproxy Stats
Hi,
I want to use haproxy input plugin, but it seems it doesn't work with standard configuration from Haproxy.
They define default URI as: http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4.2-stats%20enable
This statement enables statistics reporting with default settings defined at build time. Unless stated otherwise, these settings are used :
- stats uri : /haproxy?stats
- stats realm : "HAProxy Statistics"
And when plugin tries to parse it, fails:
Error in input [haproxy]: Unable to get valid stat result from 'http://127.0.0.1:80/haproxy?stats': %!s(<nil>)
It seems query values are not being parsed, and default URI from haproxy is not supported.
Configuration:
[[inputs.haproxy]]
servers = ["http://127.0.0.1:80/haproxy?stats"]
Output:
Error in input [haproxy]: Unable to get valid stat result from 'http://127.0.0.1:80/haproxy?stats': %!s(
)
I've created a fork in my local repository, and ammend it.
It was just a new rule to check it:
https://github.com/pasancario/telegraf/commit/717fe0aa209c325447c6f50c60c4efd6bebbf38f
@pasancario what if you just specify:
[[inputs.haproxy]]
servers = ["http://127.0.0.1:80"]
?
Hi,
I am trying to use Haproxy as a input plugin and trying to send Output to InfluxDB. Please let me know the fix for the below.
InfluxDB Version - 0.8
Input Plugin
# # Read metrics of haproxy, via socket or csv stats page
[[inputs.haproxy]]
# ## An array of address to gather stats about. Specify an ip on hostname
# ## with optional port. ie localhost, 10.10.3.33:1936, etc.
# # ## If no servers are specified, then default to 127.0.0.1:1936
servers = ["http://ccrc-hapxy-stg-01:1936"]
# ## Or you can also use local socket
# servers = ["socket:/var/lib/haproxy/stats"]
Below is the error stack trace i am getting.
telegraf-0.13.1-1]$ 2016/06/20 02:55:00 Database creation failed: json: cannot unmarshal number into Go value of type client.Response
2016/06/20 02:55:00 Starting Telegraf (version 0.13.1)
2016/06/20 02:55:00 Loaded outputs: influxdb
2016/06/20 02:55:00 Loaded inputs: diskio mem system haproxy cpu disk kernel processes swap
2016/06/20 02:55:00 Tags enabled: host=ccrc-metrics-stg-01.cisco.com
2016/06/20 02:55:00 Agent Config: Interval:10s, Debug:false, Quiet:false, Hostname:"ccrc-metrics-stg-01.cisco.com", Flush Interval:10s
2016/06/20 02:55:10 ERROR in input [kernel]: strconv.ParseInt: parsing "5424508880": value out of range
2016/06/20 02:55:10 ERROR in input [haproxy]: Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936': %!s(<nil>)
2016/06/20 02:55:20 ERROR in input [kernel]: strconv.ParseInt: parsing "5424514567": value out of range
2016/06/20 02:55:20 ERROR in input [haproxy]: Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936': %!s(<nil>)
2016/06/20 02:55:20 Output [influxdb] buffer fullness: 61 / 10000 metrics. Total gathered metrics: 61. Total dropped metrics: 0.
2016/06/20 02:55:20 Database creation failed: json: cannot unmarshal number into Go value of type client.Response
2016/06/20 02:55:20 Error writing to output [influxdb]: Could not write to any InfluxDB server in cluster
2016/06/20 02:55:30 ERROR in input [kernel]: strconv.ParseInt: parsing "5424519176": value out of range
2016/06/20 02:55:30 ERROR in input [haproxy]: Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936': %!s(<nil>)
2016/06/20 02:55:30 Output [influxdb] buffer fullness: 94 / 10000 metrics. Total gathered metrics: 94. Total dropped metrics: 0.
2016/06/20 02:55:30 Database creation failed: json: cannot unmarshal number into Go value of type client.Response
2016/06/20 02:55:30 Error writing to output [influxdb]: Could not write to any InfluxDB server in cluster
Thanks, Sigbert
@sparrc - Can you please let me know the fix for the above issue?
@SigbertUCE what is the url that your haproxy stats are available at?
@sparrc - http://ccrc-hapxy-stg-01:1936/?stats
There are 2 issues here.
- Database creation is failing first
- Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936/?stats': %!s(
)
[ccrccloudop@ccrc-metrics-stg-01 telegraf-0.13.1-1]$ 2016/06/21 15:30:31 Database creation failed: json: cannot unmarshal number into Go value of type client.Response
2016/06/21 15:30:31 Starting Telegraf (version 0.13.1)
2016/06/21 15:30:31 Loaded outputs: influxdb
2016/06/21 15:30:31 Loaded inputs: haproxy cpu disk diskio kernel swap mem processes system
2016/06/21 15:30:31 Tags enabled: host=ccrc-metrics-stg-01.cisco.com
2016/06/21 15:30:31 Agent Config: Interval:10s, Debug:false, Quiet:false, Hostname:"ccrc-metrics-stg-01.cisco.com", Flush Interval:10s
2016/06/21 15:30:40 ERROR in input [kernel]: strconv.ParseInt: parsing "5467407777": value out of range
2016/06/21 15:30:40 ERROR in input [haproxy]: Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936/?stats': %!s(
Thanks, Sigbert
if you're using influxdb 0.8 you'll need to backversion telegraf, probably back to 0.10 at least.
@sparrc - Tried downloading the below url but gives me 404. https://gowalker.org/github.com/tompao/telegraf
@sparrc - was trying to use the below(http://get.influxdb.org/telegraf/telegraf-0.10.0_linux_386.tar.gz)
try http://get.influxdb.org/telegraf/telegraf-0.10.2-1_linux_i386.tar.gz
@sparrc - Tried downgrading it to 0.10.2 version but no luck.Please let me know the fix for the same.
2016/06/22 03:23:02 Database creation failed: json: cannot unmarshal number into Go value of type client.Response
2016/06/22 03:23:02 Starting Telegraf (version 0.10.2)
2016/06/22 03:23:02 Loaded outputs: influxdb
2016/06/22 03:23:02 Loaded inputs: haproxy
2016/06/22 03:23:02 Tags enabled: host=ccrc-metrics-stg-01.cisco.com
2016/06/22 03:23:02 Agent Config: Interval:10s, Debug:false, Quiet:false, Hostname:"ccrc-metrics-stg-01.cisco.com", Flush Interval:10s
2016/06/22 03:23:10 Error in input [haproxy]: Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936/?stats': %!s(
2016/06/22 03:23:20 Error writing to output [influxdb]: Could not write to any InfluxDB server in cluster
2016/06/22 03:23:30 Error in input [haproxy]: Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936/?stats': %!s(
2016/06/22 03:23:30 Error writing to output [influxdb]: Could not write to any InfluxDB server in cluster
2016/06/22 03:23:40 Error in input [haproxy]: Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936/?stats': %!s(
2016/06/22 03:23:40 Error writing to output [influxdb]: Could not write to any InfluxDB server in cluster
2016/06/22 03:23:50 Error in input [haproxy]: Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936/?stats': %!s(
2016/06/22 03:23:50 Error writing to output [influxdb]: Could not write to any InfluxDB server in cluster
@sparrc - Any pointers on these issues will help me move forward.
@SigbertUCE I'm sorry but I have no idea how to fix that, it's not a problem I've seen and I don't have any way of reproducing. I was hoping someone in the community could help out.
I was dealing with the same issue. Think I've got it resolved by adding the uri for the stats to the server config in telegraf.conf.
Section in HA Proxy:
listen stats
bind *:1936
log global
maxconn 10
mode http
stats enable
stats uri /stats
timeout client 5000
timeout connect 5000
timeout server 5000
Section in telegraf.conf: [[inputs.haproxy]] servers = ["http://192.168.15.254:1936/stats;csv" ]
@mverleun - tried the same but to no avail.. FYI - i am using influxdb v0.8 & Telegraf v0.13.1
2016/07/18 02:41:20 Error writing to output [influxdb]: Could not write to any InfluxDB server in cluster
2016/07/18 02:41:30 Error in input [haproxy]: Unable to get valid stat result from 'http://****-hapxy-stg-01:1936/stats;csv': %!s(