Giter Club home page Giter Club logo

Comments (8)

discostur avatar discostur commented on July 22, 2024 2

@ivanpedersen thanks for your help, it is working now!

from haproxy_exporter.

ivanpedersen avatar ivanpedersen commented on July 22, 2024

I've got this figured out and it turns out my first assumptions was way off... What I got in the first row was actually [<!DOCTYPE html>] from the pFsense login page rather than the csv export.

In case anyone is interested, I eventually solved this by adding an additional frontend and backend to my pFsense/HAProxy config so that the specific stats path gets redirected to the internal port 2200 on localhost where the stats are available.

Stats config that can be exported from pFsense.

listen HAProxyLocalStats
	bind 127.0.0.1:2200 name localstats
	mode http
	stats enable
	stats refresh 10
	stats admin if TRUE
	stats uri /haproxy/haproxy_stats.php?haproxystats=1
	timeout client 5000
	timeout connect 5000
	timeout server 5000

from haproxy_exporter.

matthiasr avatar matthiasr commented on July 22, 2024

from haproxy_exporter.

ivanpedersen avatar ivanpedersen commented on July 22, 2024

I tried with user and password but it didn't work for some reason, I've not really looked into why...
I've not tried to intall it directly on the pFsense box, It would mean to install go and compile locally since docker is still experimental on FreeBSD.
Running the exporter on another host makes most sense for me.

from haproxy_exporter.

discostur avatar discostur commented on July 22, 2024

@ivanpedersen i have the same problem as you and i first tried to get haproxy stats via curl / wget but that didn't work out. regarding the pfsense documentation, you can't just send basic auth, but you need to configure cookies and csfr:

https://doc.pfsense.org/index.php/Remote_Config_Backup

But as i said, that didn't work for me. I then tried as you said, and configured additional frontend / backend, but that didn't work either:

listen HAProxyLocalStats
	bind 127.0.0.1:2200 name localstats
	mode http
	stats enable
	stats refresh 10
	stats admin if TRUE
	stats uri /haproxy/haproxy_stats.php?haproxystats=1
	timeout client 5000
	timeout connect 5000
	timeout server 5000


frontend haproxy_stats
	bind			EXTERNAL_IP:2200 name EXTERNAL_IP:2200   
	mode			http
	log			global
	option			http-keep-alive
	timeout client		30000
	default_backend haproxy_stats_http_ipvANY


backend haproxy_stats_http_ipvANY
	mode			http
	log			global
	timeout connect		30000
	timeout server		30000
	retries			3
	server			haproxy_stats_0 127.0.0.1:2200 check inter 1000  
	server			haproxy_stats_1 ::1:2200 check inter 1000

Can you please share your exact config?

from haproxy_exporter.

ivanpedersen avatar ivanpedersen commented on July 22, 2024

@discostur I have a shared frontend with some ssl redirect and acme stuff (removed from the config below),the relevant stuff should be the below:

  bind 127.0.0.1:2200 name localstats
  mode http
  stats enable
  stats refresh 10
  stats admin if TRUE
  stats uri /haproxy/haproxy_stats.php?haproxystats=1
  timeout client 5000
  timeout connect 5000
  timeout server 5000

frontend WAN_HTTP-merged
  bind      WAN_IP:80 name WAN_IP:80   
  bind      LAN_IP:80 name LAN_IP:80   
  mode      http
  log     global
  option      http-keep-alive
  timeout client    30000
  acl     haproxy_csv_acl path_beg -i /haproxy/haproxy_stats.php
  use_backend haproxy_csv_http_ipvANY  if  haproxy_csv_acl

backend haproxy_csv_http_ipvANY
  mode      http
  log     global
  timeout connect   30000
  timeout server    7200000
  retries     3
  server      haproxy_csv 127.0.0.1:2200 check inter 1000 ```

from haproxy_exporter.

jaretclifton avatar jaretclifton commented on July 22, 2024

Doesn't this allow external users who stumble on this haproxy site to remove hosts from your pool?

from haproxy_exporter.

ivanpedersen avatar ivanpedersen commented on July 22, 2024

@jaretclifton does it? That sounds bad :)
Care to elaborate?

from haproxy_exporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.