Skip to main content

Hello,

I have a problem with my command:

/usr/lib/centreon/plugins/centreon_haproxy_web.pl --plugin=apps::haproxy::web::plugin --mode=backend-usage --hostname=xxxxxx --port=8404 --proto=http --username='centreon' --password='xxxxxxx' --filter-name='.*' --verbose --urlpath=/haproxy?stats --credentials

I have this return:
UNKNOWN: Cannot decode response (add --debug option to display returned content)

When I do a --debug, I have the information that comes back, it connects well to the API but with a bad format, for example:

 

My HAproxy: HAProxy version 2.9.14-1ppa1~jammy

I relied on the recommendations: https://docs.centreon.com/fr/pp/integrations/plugin-packs/procedures/applications-haproxy-web/

thanks you :)

 

Hello :)

Could you show us more about the debug output? An user meet maybe a similar issue and reported it in github here if it may help you to find where the issue occurs.

Kind regards.


Hi, see my --debug info. The rest is long, there are all my backends after. do you have any idea?
Thanks

 

UNKNOWN: Cannot decode response (add --debug option to display returned content)
== Info:   Trying 10.1.94.104:8404...
== Info: Connected to lblan.dnpm.fr (10.1.94.104) port 8404 (#0)
=> Send header: GET /haproxy?stats HTTP/1.1
Host: lblan.dnpm.fr:8404
Accept:application/json
Content-Type:application/json

== Info: Mark bundle as not supporting multiuse
=> Recv header: HTTP/1.1 401 Unauthorized
=> Recv header: content-length: 112
=> Recv header: cache-control: no-cache
=> Recv header: content-type: text/html
=> Recv header: www-authenticate: Basic realm="HAProxy Statistics"
=> Recv header:
== Info: Ignoring the response-body
=> Recv data: <html><body><h1>401 Unauthorized</h1>
You need a valid user and password to access this content.
</body></html>
== Info: Connection #0 to host lblan.dnpm.fr left intact
== Info: Issue another request to this URL: 'http://lblan.dnpm.fr:8404/haproxy?stats'
== Info: Found bundle for host lblan.dnpm.fr: 0x55ad12a5f280 8serially]
== Info: Can not multiplex, even if we wanted to!
== Info: Re-using existing connection! (#0) with host lblan.dnpm.fr
== Info: Connected to lblan.dnpm.fr (10.1.94.104) port 8404 (#0)
== Info: Server auth using Basic with user 'centreon'
=> Send header: GET /haproxy?stats HTTP/1.1
Host: lblan.dnpm.fr:8404
Authorization: Basic Y2VudHJlb246Y2VudHJlb24=
Accept:application/json
Content-Type:application/json

== Info: Mark bundle as not supporting multiuse
=> Recv header: HTTP/1.1 200 OK
=> Recv header: cache-control: no-cache
=> Recv header: content-type: text/html
=> Recv header: refresh: 10
=> Recv header: transfer-encoding: chunked
=> Recv header:
=> Recv data: 3785
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Statistics Report for HAProxy</title>
<link rel="icon" href="data:,">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type="text/css"><!--
body { font-family: arial, helvetica, sans-serif; font-size: 12px; font-weight: normal; color: black; background: white;}
th,td { font-size: 10px;}
h1 { font-size: x-large; margin-bottom: 0.5em;}
h2 { font-family: helvetica, arial; font-size: x-large; font-weight: bold; font-style: italic; color: #6020a0; margin-top: 0em; margin-bottom: 0em;}
h3 { font-family: helvetica, arial; font-size: 16px; font-weight: bold; color: #b00040; background: #e8e8d0; margin-top: 0em; margin-bottom: 0em;}
li { margin-top: 0.25em; margin-right: 2em;}
.hr {margin-top: 0.25em; border-color: black; border-bottom-style: solid;}
.titre  {background: #20D0D0;color: #000000; font-weight: bold; text-align: center;}
.total  {background: #20D0D0;color: #ffff80;}
.frontend       {background: #e8e8d0;}
.socket {background: #d0d0d0;}
.backend        {background: #e8e8d0;}
.active_down            {background: #ff9090;}
.active_going_up                {background: #ffd020;}
.active_going_down      {background: #ffffa0;}
.active_up              {background: #c0ffc0;}
.active_nolb            {background: #20a0ff;}
.active_draining                {background: #20a0FF;}
.active_no_check                {background: #e0e0e0;}
.backup_down            {background: #ff9090;}
.backup_going_up                {background: #ff80ff;}
.backup_going_down      {background: #c060ff;}
.backup_up              {background: #b0d0ff;}
.backup_nolb            {background: #90b0e0;}
.backup_draining                {background: #cc9900;}
.backup_no_check                {background: #e0e0e0;}
.maintain       {background: #c07820;}
.rls      {letter-spacing: 0.2em; margin-right: 1px;}

a.px:link {color: #ffff40; text-decoration: none;}a.px:visited {color: #ffff40; text-decoration: none;}a.px:hover {color: #ffffff; text-decoration: none;}a.lfsb:link {color: #000000; text-decoration: none;}a.lfsb:visited {color: #000000; text-decoration: none;}a.lfsb:hover {color: #505050; text-decoration: none;}
table.tbl { border-collapse: collapse; border-style: none;}
table.tbl td { text-align: right; border-width: 1px 1px 1px 1px; border-style: solid solid solid solid; padding: 2px 3px; border-color: gray; white-space: nowrap;}
table.tbl td.ac { text-align: center;}
table.tbl th { border-width: 1px; border-style: solid solid solid solid; border-color: gray;}
table.tbl th.pxname { background: #b00040; color: #ffff40; font-weight: bold; border-style: solid solid none solid; padding: 2px 3px; white-space: nowrap;}
table.tbl th.empty { border-style: none; empty-cells: hide; background: white;}
table.tbl th.desc { background: white; border-style: solid solid none solid; text-align: left; padding: 2px 3px;}

table.lgd { border-collapse: collapse; border-width: 1px; border-style: none none none solid; border-color: black;}
table.lgd td { border-width: 1px; border-style: solid solid solid solid; border-color: gray; padding: 2px;}
table.lgd td.noborder { border-style: none; padding: 2px; white-space: nowrap;}
table.det { border-collapse: collapse; border-style: none; }
table.det th { text-align: left; border-width: 0px; padding: 0px 1px 0px 0px; font-style:normal;font-size:11px;font-weight:bold;font-family: sans-serif;}
table.det td { text-align: right; border-width: 0px; padding: 0px 0px 0px 4px; white-space: nowrap; font-style:normal;font-size:11px;font-weight:normal;}
u {text-decoration:none; border-bottom: 1px dotted black;}
div.tips {
 display:block;
 visibility:hidden;
 z-index:2147483647;
 position:absolute;
 padding:2px 4px 3px;
 background:#f0f060; color:#000000;
 border:1px solid #7040c0;
 white-space:nowrap;
 font-style:normal;font-size:11px;font-weight:normal;
 -moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;
 -moz-box-shadow:gray 2px 2px 3px;-webkit-box-shadow:gray 2px 2px 3px;box-shadow:gray 2px 2px 3px;
}
u:hover div.tips {visibility:visible;}
@media (prefers-color-scheme: dark) {
 body { font-family: arial, helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #e8e6e3; background: #131516;}
 h1 { color: #a265e0!important; }
 h2 { color: #a265e0; }
 h3 { color: #ff5190; background-color: #3e3e1f; }
 a { color: #3391ff; }
 input { background-color: #2f3437; }
 .hr { border-color: #8c8273; }
 .titre { background-color: #1aa6a6; color: #e8e6e3; }
 .frontend {background: #2f3437;}
 .socket        {background: #2a2d2f;}
 .backend {background: #2f3437;}
 .active_down {background: #760000;}
 .active_going_up {background: #b99200;}
 .active_going_down {background: #6c6c00;}
 .active_up {background: #165900;}
 .active_nolb {background: #006ab9;}
 .active_draining {background: #006ab9;}
 .active_no_check {background: #2a2d2f;}
 .backup_down {background: #760000;}
 .backup_going_up {background: #7f007f;}
 .backup_going_down {background: #580092;}
 .backup_up {background: #2e3234;}
 .backup_nolb {background: #1e3c6a;}
 .backup_draining {background: #a37a00;}
 .backup_no_check {background: #2a2d2f;}
 .maintain {background: #9a601a;}
 a.px:link {color: #d8d83b; text-decoration: none;}
 a.px:visited {color: #d8d83b; text-decoration: none;}
 a.px:hover {color: #ffffff; text-decoration: none;}
 a.lfsb:link {color: #e8e6e3; text-decoration: none;}
 a.lfsb:visited {color: #e8e6e3; text-decoration: none;}
 a.lfsb:hover {color: #b5afa6; text-decoration: none;}
 table.tbl th.empty { background-color: #181a1b; }
 table.tbl th.desc { background: #181a1b; }
 table.tbl th.pxname { background-color: #8d0033; color: #ffff46; }
 table.tbl th { border-color: #808080; }
 table.tbl td { border-color: #808080; }
 u {text-decoration:none; border-bottom: 1px dotted #e8e6e3;}
 div.tips {
  background:#8e8e0d;
  color:#e8e6e3;
  border-color: #4e2c86;
  -moz-box-shadow: #60686c 2px 2px 3px;
  -webkit-box-shadow: #60686c 2px 2px 3px;
  box-shadow: #60686c 2px 2px 3px;
 }
}
-->
</style></head>
<body><h1><a href="http://www.haproxy.org/" style="text-decoration: none;">HAProxy version 2.9.14-1ppa1~jammy, released 2025/01/29</a></h1>
<h2>Statistics Report for pid 293205</h2>
<hr width="100%" class="hr">
<h3>&gt; General process information</h3>
<table border=0><tr><td align="left" nowrap width="1%">
<p><b>pid = </b> 293205 (process #1, nbproc = 1, nbthread = 2)<br>
<b>uptime = </b> 2d 23h49m00s; warnings = 82<br>
<b>system limits:</b> memmax = unlimited; ulimit-n = 524287<br>
<b>maxsock = </b> 524287; <b>maxconn = </b> 262047; <b>reached = </b> 0; <b>maxpipes = </b> 0<br>
current conns = 3198; current pipes = 0/0; conn rate = 15/sec; bit rate = 10.632 Mbps<br>
Running tasks: 0/8722 (0 niced); idle = 96 %<br>
</td><td align="center" nowrap>
<table class="lgd"><tr>
<td class="active_up">&nbsp;</td><td class="noborder">active UP </td><td class="backup_up">&nbsp;</td><td class="noborder">backup UP </td></tr><tr>
<td class="active_going_down"></td><td class="noborder">active UP, going down </td><td class="backup_going_down"></td><td class="noborder">backup UP, going down </td></tr><tr>
<td class="active_going_up"></td><td class="noborder">active DOWN, going up </td><td class="backup_going_up"></td><td class="noborder">backup DOWN, going up </td></tr><tr>
<td class="active_down"></td><td class="noborder">active or backup DOWN &nbsp;</td><td class="active_no_check"></td><td class="noborder">not checked </td></tr><tr>
<td class="maintain"></td><td class="noborder" colspan="3">active or backup DOWN for maintenance (MAINT) &nbsp;</td></tr><tr>
<td class="active_draining"></td><td class="noborder" colspan="3">active or backup SOFT STOPPED for maintenance &nbsp;</td></tr></table>
Note: "NOLB"/"DRAIN" = UP with load-balancing disabled.</td><td align="left" valign="top" nowrap width="1%"><b>Display option:</b><ul style="margin-top: 0.25em;"><li><form method="GET">Scope : <input value="" name="scope" size="8" maxlength="20" tabindex="1"/></form>
<li><a href="/haproxy?stats;up">Hide 'DOWN' servers</a><br>
<li><a href="/haproxy?stats;norefresh">Disable refresh</a><br>
<li><a href="/haproxy?stats">Refresh now</a><br>
<li><a href="/haproxy?stats;csv;norefresh">CSV export</a><br>
<li><a href="/haproxy?stats;json;norefresh">JSON export</a> (<a href="/haproxy?stats;json-schema">schema</a>)<br>
</ul></td><td align="left" valign="top" nowrap width="1%"><b>External resources:</b><ul style="margin-top: 0.25em;">
<li><a href="http://www.haproxy.org/">Primary site</a><br>
<li><a href="http://www.haproxy.org/#down">Updates (v2.9)</a><br>
<li><a href="http://www.haproxy.org/#docs">Online manual</a><br>
</ul></td
=> Recv data: ></tr></table>

 



/usr/lib/centreon/plugins/centreon_haproxy_web.pl --plugin=apps::haproxy::web::plugin --mode=backend-usage --hostname=XX --port=8404 --proto=http --username='XX' --password='XX' --filter-name='.*' --verbose --urlpath='/;json' --credentials
 

 

 

Your demo link works fine from my centreon, but not mine


Reply