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

add(plugin): HAProxy Web Stats #5385

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

thibaults-centreon
Copy link
Contributor

Ref CTOR-680

Description

This plugin allows to monitor Haproxy (including OSS/free versions) using the HAProxy "stats" page. It only supports the 'json' format, the csv format is not compatible.

It provides 2 modes with type 3 counters:

  • "backends" with associated "servers"
  • "frontends" with associated "listeners"

It also provides a gerneric service discovery mode ("list-objects") that can be used for both frontends & backends discovery

./centreon_plugins.pl --plugin=apps::haproxy::web::plugin  --hostname='demo.haproxy.org' --port='80' --urlpath='/;json' --mode=frontend-usage --add-listeners --verbose 
OK: Frontend 'http-in' frontend status: OPEN, current session rate: 1/s, max session rate: 729/s, current sessions: 71, total sessions: 5182210, max sessions: 100, traffic in: 104.58 b/s, traffic out: 3.79 Kb/s, denied requests: 399251, denied responses: 0, error requests: 114523 - listeners are ok | 'http-in#frontend.session.current.rate.countpersecond'=1;;;0; 'http-in#frontend.session.max.rate.countpersecond'=729;;;0; 'http-in#frontend.sessions.current.count'=71;;;0; 'http-in#frontend.sessions.total.count'=5182210;;;0; 'http-in#frontend.sessions.maximum.count'=100;;;0; 'http-in#frontend.traffic.in.bitpersecond'=104.58b/s;;;0; 'http-in#frontend.traffic.out.bitpersecond'=3789.15b/s;;;0; 'http-in#frontend.requests.denied.count'=399251;;;0; 'http-in#frontend.responses.denied.count'=0;;;0; 'http-in#frontend.requests.error.count'=114523;;;0; 'IPv4-direct#listener.sessions.current.count'=69;;;0; 'IPv4-direct#listener.requests.denied.count'=335998;;;0; 'IPv4-direct#listener.responses.denied.count'=0;;;0; 'IPv4-direct#listener.requests.error.count'=86039;;;0; 'listener.traffic.in.bitpersecond'=65.06b/s;;;0; 'IPv4-direct#listener.traffic.out.bitpersecond'=2896.17b/s;;;0; 'IPv4-cached#listener.sessions.current.count'=0;;;0; 'IPv4-cached#listener.requests.denied.count'=31803;;;0; 'IPv4-cached#listener.responses.denied.count'=0;;;0; 'IPv4-cached#listener.requests.error.count'=9075;;;0; 'listener.traffic.in.bitpersecond'=19.67b/s;;;0; 'IPv4-cached#listener.traffic.out.bitpersecond'=37.26b/s;;;0; 'IPv6-direct#listener.sessions.current.count'=0;;;0; 'IPv6-direct#listener.requests.denied.count'=0;;;0; 'IPv6-direct#listener.responses.denied.count'=0;;;0; 'IPv6-direct#listener.requests.error.count'=0;;;0; 'listener.traffic.in.bitpersecond'=0.00b/s;;;0; 'IPv6-direct#listener.traffic.out.bitpersecond'=0.00b/s;;;0; 'local#listener.sessions.current.count'=0;;;0; 'local#listener.requests.denied.count'=0;;;0; 'local#listener.responses.denied.count'=0;;;0; 'local#listener.requests.error.count'=0;;;0; 'listener.traffic.in.bitpersecond'=0.00b/s;;;0; 'local#listener.traffic.out.bitpersecond'=0.00b/s;;;0; 'local-https#listener.sessions.current.count'=2;;;0; 'local-https#listener.requests.denied.count'=31450;;;0; 'local-https#listener.responses.denied.count'=0;;;0; 'local-https#listener.requests.error.count'=19409;;;0; 'listener.traffic.in.bitpersecond'=19.85b/s;;;0; 'local-https#listener.traffic.out.bitpersecond'=855.73b/s;;;0;
Frontend 'http-in':
    frontend status: OPEN, current session rate: 1/s, max session rate: 729/s, current sessions: 71, total sessions: 5182210, max sessions: 100, traffic in: 104.58 b/s, traffic out: 3.79 Kb/s, denied requests: 399251, denied responses: 0, error requests: 114523
    Listener 'IPv4-direct' status: OPEN, current sessions: 69, denied requests: 335998, denied responses: 0, error requests: 86039, traffic in: 65.06 b/s, traffic out: 2.90 Kb/s
    Listener 'IPv4-cached' status: OPEN, current sessions: 0, denied requests: 31803, denied responses: 0, error requests: 9075, traffic in: 19.67 b/s, traffic out: 37.26 b/s
    Listener 'IPv6-direct' status: OPEN, current sessions: 0, denied requests: 0, denied responses: 0, error requests: 0, traffic in: 0.00 b/s, traffic out: 0.00 b/s
    Listener 'local' status: OPEN, current sessions: 0, denied requests: 0, denied responses: 0, error requests: 0, traffic in: 0.00 b/s, traffic out: 0.00 b/s
    Listener 'local-https' status: OPEN, current sessions: 2, denied requests: 31450, denied responses: 0, error requests: 19409, traffic in: 19.85 b/s, traffic out: 855.73 b/s

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Functionality enhancement or optimization (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

How this pull request can be tested ?

An online demo is available here: http://demo.haproxy.org/;json

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (develop).
  • I have provide data or shown output displaying the result of this code in the plugin area concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant