Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard URI for haproxy Stats #1019

Closed
pasancario opened this issue Apr 13, 2016 · 15 comments
Closed

Standard URI for haproxy Stats #1019

pasancario opened this issue Apr 13, 2016 · 15 comments

Comments

@pasancario
Copy link

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()

pasancario added a commit to pasancario/telegraf that referenced this issue Apr 13, 2016
@pasancario
Copy link
Author

I've created a fork in my local repository, and ammend it.

It was just a new rule to check it:

pasancario@717fe0a

@sparrc
Copy link
Contributor

sparrc commented Apr 20, 2016

@pasancario what if you just specify:

 [[inputs.haproxy]]
      servers = ["http://127.0.0.1:80"]

?

@SigbertUCE
Copy link

SigbertUCE commented Jun 20, 2016

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

@SigbertUCE
Copy link

@sparrc - Can you please let me know the fix for the above issue?

@sparrc
Copy link
Contributor

sparrc commented Jun 21, 2016

@SigbertUCE what is the url that your haproxy stats are available at?

@SigbertUCE
Copy link

@sparrc - http://ccrc-hapxy-stg-01:1936/?stats

There are 2 issues here.

  1. Database creation is failing first
  2. 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()
2016/06/21 15:30:50 ERROR in input [kernel]: strconv.ParseInt: parsing "5467413123": value out of range
2016/06/21 15:30:50 ERROR in input [haproxy]: Unable to get valid stat result from 'http://ccrc-hapxy-stg-01:1936/?stats': %!s()

Thanks,
Sigbert

@sparrc
Copy link
Contributor

sparrc commented Jun 21, 2016

if you're using influxdb 0.8 you'll need to backversion telegraf, probably back to 0.10 at least.

@SigbertUCE
Copy link

@sparrc - Tried downloading the below url but gives me 404.
https://gowalker.org/github.com/tompao/telegraf

@SigbertUCE
Copy link

@sparrc - was trying to use the below(http://get.influxdb.org/telegraf/telegraf-0.10.0_linux_386.tar.gz)

@sparrc
Copy link
Contributor

sparrc commented Jun 22, 2016

@SigbertUCE
Copy link

@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:10 Gathered metrics, (10s interval), from 1 inputs in 6.864881ms
2016/06/22 03:23:20 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 Gathered metrics, (10s interval), from 1 inputs in 8.524488ms
2016/06/22 03:23:20 ERROR: 404 page not found

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 Gathered metrics, (10s interval), from 1 inputs in 15.101773ms
2016/06/22 03:23:30 ERROR: 404 page not found

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 Gathered metrics, (10s interval), from 1 inputs in 6.362713ms
2016/06/22 03:23:40 ERROR: 404 page not found

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 Gathered metrics, (10s interval), from 1 inputs in 2.918683ms
2016/06/22 03:23:50 ERROR: 404 page not found

2016/06/22 03:23:50 Error writing to output [influxdb]: Could not write to any InfluxDB server in cluster

@SigbertUCE
Copy link

@sparrc - Any pointers on these issues will help me move forward.

@sparrc
Copy link
Contributor

sparrc commented Jun 23, 2016

@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.

@mverleun
Copy link

mverleun commented Jul 17, 2016

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" ]

@SigbertUCE
Copy link

@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()
2016/07/18 02:41:30 Gathered metrics, (10s interval), from 1 inputs in 9.803881ms
2016/07/18 02:41:30 ERROR: 404 page not found

@sparrc sparrc closed this as completed in 0be69b8 Jul 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants