Ad Widget

Collapse

Discussion thread for official Zabbix Template HAProxy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • max.ch.88
    Senior Member
    • Oct 2018
    • 206

    #16
    Originally posted by metal
    I am using Zabbix 4.4.8

    Any idea why backend(s) session information is not available in the template HAProxy, for example:
    Session rate(Current|Max)
    Sessions (Current|Max|Total|LbTot|Last)
    Bytes (In|Out)

    It is essential to have these metrics for backend(s).

    These are available for frontend, but not backend, any idea how I can add these items to "(TCP) backend discovery"

    thanks
    You could create the item prototypes in the discovery rule using existing items as an example. Or you could create ZBXNEXT with a description of required but missed items in the template.

    Comment

    • metal
      Member
      • Nov 2019
      • 42

      #17
      I think Incoming and Outgoing traffic is wrong, such that it is displayed in Units Bps, and multiplied by 8, this is wrong. The actual value from the stats page is in Bytes already... So there is no need to multiply it by 8, unless the Units is changed to bps, then the multiplication preprocessor by 8 can be kept...
      Last edited by metal; 14-05-2020, 19:25.

      Comment

      • metal
        Member
        • Nov 2019
        • 42

        #18
        Ok, I analyzed the JSON output, I think it is simpler than I thought!

        I added some missing backend discovery items, below are the mods, also the modified template template is attached, hope that zabbix team considers this template, I just need confirmation from zabbix people to see if incoming/outgoing traffic is being correctly read from the stats page because the stats page shows bytes, and in the template it is multiplied by 8, while the item unit is in Bps and this is wrong so I kept the multiplication by 8 and changed the unit to bps:

        HTML Code:
        BACKEND discovery
        =================
        HAProxy Backend {#PXNAME}: Incoming traffic
        haproxy.backend.bin[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].bin.first()
        Preprocessor: Custom multiplier = 8
        Preprocessor: Change per second
        Type of information = Numeric (float)
        Units = bps
        
        HAProxy Backend {#PXNAME}: Outgoing traffic
        haproxy.backend.bout[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].bout.first()
        Preprocessor: Custom multiplier = 8
        Preprocessor: Change per second
        Type of information = Numeric (float)
        Units = bps
        
        HAProxy Backend {#PXNAME}: Session limits
        haproxy.backend.slim[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].slim.first()
        Preprocessor: Discard unchanged with heartbeat = 1h
        Type of information = Numeric (unsigned)
        
        HAProxy Backend {#PXNAME}: Sessions rate
        haproxy.backend.rate[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].rate.first()
        Type of information = Numeric (unsigned)
        
        
        TCP BACKEND discovery
        =====================
        HAProxy TCP Backend {#PXNAME}: Incoming traffic
        haproxy.backend_tcp.bin[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].bin.first()
        Preprocessor: Custom multiplier = 8
        Preprocessor: Change per second
        Type of information = Numeric (float)
        Units = bps
        
        HAProxy TCP Backend {#PXNAME}: Outgoing traffic
        haproxy.backend_tcp.bout[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].bout.first()
        Preprocessor: Custom multiplier = 8
        Preprocessor: Change per second
        Type of information = Numeric (float)
        Units = bps
        
        HAProxy TCP Backend {#PXNAME}: Session limits
        haproxy.backend_tcp.slim[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].slim.first()
        Preprocessor: Discard unchanged with heartbeat = 1h
        Type of information = Numeric (unsigned)
        
        HAProxy TCP Backend {#PXNAME}: Sessions rate
        haproxy.backend_tcp.rate[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].rate.first()
        Type of information = Numeric (unsigned)
        
        
        Servers discovery
        =================
        HAProxy {#PXNAME} {#SVNAME}: Incoming traffic
        haproxy.server.bin[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].bin.first()
        Preprocessor: Custom multiplier = 8
        Preprocessor: Change per second
        Type of information = Numeric (float)
        Units = bps
        
        HAProxy {#PXNAME} {#SVNAME}: Outgoing traffic
        haproxy.server.bout[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].bout.first()
        Preprocessor: Custom multiplier = 8
        Preprocessor: Change per second
        Type of information = Numeric (float)
        Units = bps
        
        HAProxy {#PXNAME} {#SVNAME}: Session limits
        haproxy.server.slim[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].slim.first()
        Preprocessor: Discard unchanged with heartbeat = 1h
        Type of information = Numeric (unsigned)
        
        HAProxy {#PXNAME} {#SVNAME}: Sessions rate
        haproxy.server.rate[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].rate.first()
        Type of information = Numeric (unsigned)
        
        
        TCP Servers discovery
        =====================
        HAProxy {#PXNAME} {#SVNAME}: Incoming traffic
        haproxy.server_tcp.bin[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].bin.first()
        Preprocessor: Custom multiplier = 8
        Preprocessor: Change per second
        Type of information = Numeric (float)
        Units = bps
        
        HAProxy {#PXNAME} {#SVNAME}: Outgoing traffic
        haproxy.server_tcp.bout[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].bout.first()
        Preprocessor: Custom multiplier = 8
        Preprocessor: Change per second
        Type of information = Numeric (float)
        Units = bps
        
        HAProxy {#PXNAME} {#SVNAME}: Session limits
        haproxy.server_tcp.slim[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].slim.first()
        Preprocessor: Discard unchanged with heartbeat = 1h
        Type of information = Numeric (unsigned)
        
        HAProxy {#PXNAME} {#SVNAME}: Sessions rate
        haproxy.server_tcp.rate[{#PXNAME}:{#SVNAME}]
        Preprocessor: JSONPath = $.[?(@.pxname == '{#PXNAME}' && @.svname == '{#SVNAME}')].rate.first()
        Type of information = Numeric (unsigned)
        Attached Files

        Comment

        • kmjha
          Junior Member
          • May 2020
          • 1

          #19
          I need help regarding the API configuration in zabbix.
          i am just monitor one server URL through API configuration in zabbix. please post the steps for this.

          Comment

          • max.ch.88
            Senior Member
            • Oct 2018
            • 206

            #20
            Originally posted by metal
            I think Incoming and Outgoing traffic is wrong, such that it is displayed in Units Bps, and multiplied by 8, this is wrong. The actual value from the stats page is in Bytes already... So there is no need to multiply it by 8, unless the Units is changed to bps, then the multiplication preprocessor by 8 can be kept...
            I suppose it's a custom template. The official templates for HAProxy use bps https://git.zabbix.com/projects/ZBX/.../templates/app
            Last edited by max.ch.88; 20-05-2020, 16:35.

            Comment

            • disconnected
              Junior Member
              • Jun 2020
              • 1

              #21
              Hellow!
              I'm used template v. 2020-04-17T09:24:27Z for Zabbix 5.0.0 and HaProxy 1.5.18. During discovery process an errors appears: "Cannot accurately apply filter: no value received for macro "{#MODE}" json path '$.mode'." This error is similar for all discovered dependent items. When i analyse master item (web.page.get) i really cannot see "mode" in server reply.
              I try to use template for HTTP and Zabbix agent and get the same errors.
              Please help me to solve this problem.

              Comment

              • Kyo_O
                Junior Member
                • Jun 2020
                • 1

                #22
                Hello,

                I'm running zabbix_server (Zabbix) 4.4.9 Revision 691355e610 25 May 2020 and using the "App HAProxy by Zabbix agent" templaye in version 2020-04-17T09:24:27Z with HA proxy server 1.5.18 révision 9.el7

                I'm dissapointed because i get an endless error on all discovery rules, it always says "unable to send request, wrong type of discovery rule"

                Moreover, i also get an error on "HAProxy: Get stats" item as you can see on screenshot and of course those which it depends on "HAProxy: Get stats page: HAProxy: Uptime" and "HAProxy: Get stats page: HAProxy: Version"

                Click image for larger version

Name:	1.png
Views:	2417
Size:	22.6 KB
ID:	403772
                Click image for larger version

Name:	2.png
Views:	2382
Size:	22.5 KB
ID:	403773

                I correctly set frontend stats parameters as this:

                bind *:8404
                stats enable
                stats uri /stats
                stats refresh 10s

                I get a correct file when requesting CSV stats on HA proxy server using curl from zabbix server

                Templates macros are OK and matches host proprerties

                By the way i can still get a correct response value from service status & response time items

                Click image for larger version

Name:	3.png
Views:	2411
Size:	11.9 KB
ID:	403774

                I tried to delete the first preprocessing step of the "HAProxy: Get stats" item just to see, i don't get my error message anymore but there's an empty valeur returned in "last data" view for it

                Also, when i fill the CSV content value directly in the first preprocessing step manual test it seems to be a correct processing of data end value printed

                Finaly, i tried to replace the value web.page.get of the "HAProxy: Get stats" item with the real server CSV stats URL value or HOST.CONN by 127.0.0.1 but still get the same error

                Any help would be appreciated
                Attached Files

                Comment


                • Kyo_O
                  Kyo_O commented
                  Editing a comment
                  Hi,

                  Please forget about it, all my troubles went away since i ugraded my old zabbix agent from 2.4.7 to new zabbix agent "2" 4.4.9 on the HA proxy servers.

                  Thanks anyway
              • mstrasser
                Junior Member
                • Jul 2020
                • 3

                #23
                Hi,

                we have a loadbalancer with multiple haproxy instances which means we also have multiple haproxy stats pages.
                Each of them is reachable with a different port.
                Is it possible to check more ports with the current state of this template?

                Thanks

                br,
                mstrasser

                Comment

                • max.ch.88
                  Senior Member
                  • Oct 2018
                  • 206

                  #24
                  Originally posted by mstrasser
                  Hi,

                  we have a loadbalancer with multiple haproxy instances which means we also have multiple haproxy stats pages.
                  Each of them is reachable with a different port.
                  Is it possible to check more ports with the current state of this template?

                  Thanks

                  br,
                  mstrasser
                  Hi. Yes, you can create a separated host for each HAproxy instance and define the port in host macro {$HAPROXY.STATS.PORT}.

                  Comment

                  • max.ch.88
                    Senior Member
                    • Oct 2018
                    • 206

                    #25
                    Originally posted by disconnected
                    Hellow!
                    I'm used template v. 2020-04-17T09:24:27Z for Zabbix 5.0.0 and HaProxy 1.5.18. During discovery process an errors appears: "Cannot accurately apply filter: no value received for macro "{#MODE}" json path '$.mode'." This error is similar for all discovered dependent items. When i analyse master item (web.page.get) i really cannot see "mode" in server reply.
                    I try to use template for HTTP and Zabbix agent and get the same errors.
                    Please help me to solve this problem.
                    Hi. I can suggest only to upgrade your HAproxy. Template App HAProxy was tested for HAproxy 1.8 and later.

                    Comment

                    • mstrasser
                      Junior Member
                      • Jul 2020
                      • 3

                      #26
                      Originally posted by max.ch.88

                      Hi. Yes, you can create a separated host for each HAproxy instance and define the port in host macro {$HAPROXY.STATS.PORT}.
                      Hi thanks for the answer.
                      the haproxy instances run on the same host and the stats page are reachable with the same ip but different port.

                      in meantime i solved my problem.
                      i cloned the original template
                      removed the duplicated macros
                      and change the keys.

                      i have to clone the cloned template for each haproxy stats port but with the search and replace of a text editor its easy to change the template fast.

                      Maybe there is a better solution!

                      Comment

                      • max.ch.88
                        Senior Member
                        • Oct 2018
                        • 206

                        #27
                        Originally posted by mstrasser

                        Hi thanks for the answer.
                        the haproxy instances run on the same host and the stats page are reachable with the same ip but different port.

                        in meantime i solved my problem.
                        i cloned the original template
                        removed the duplicated macros
                        and change the keys.

                        i have to clone the cloned template for each haproxy stats port but with the search and replace of a text editor its easy to change the template fast.

                        Maybe there is a better solution!
                        I meant you need to create separated hosts in Zabbix. With the same IP in interfaces field and the linked template. Just override {$HAPROXY.STATS.PORT} macro in each host. Then you don't need to clone and edit the template.

                        Comment

                        • mstrasser
                          Junior Member
                          • Jul 2020
                          • 3

                          #28
                          yeah thx max,

                          it is also more readable when i do it that way

                          Comment

                          • TrapoSAMA
                            Junior Member
                            • Aug 2020
                            • 16

                            #29
                            Hi!

                            Somebody has worked this template in zabbix5 with HA 2.0 or 2.2?

                            Thx

                            Comment

                            • TrapoSAMA
                              Junior Member
                              • Aug 2020
                              • 16

                              #30
                              Originally posted by TrapoSAMA
                              Hi!

                              Somebody has worked this template in zabbix5 with HA 2.0 or 2.2?

                              Thx
                              my conf is:

                              frontend stats
                              bind :8080 ssl crt /etc/haproxy/certificate.pem alpn h2,http/1.1 npn spdy/2
                              bind-process 1
                              option http-use-htx
                              http-request use-service prometheus-exporter if { path /metrics }
                              maxconn 10
                              stats enable
                              stats uri /
                              stats realm Haproxy\ Statistics
                              #stats hide-version
                              stats auth adminassword
                              stats refresh 15s
                              stats admin if TRUE

                              Comment

                              Working...