Beispiel #1
0
def test_haproxy_default_metrics_from_stats_page_basic_auth(version):
    with run_service("haproxy", buildargs={"HAPROXY_VERSION":
                                           version}) as service_container:
        host = container_ip(service_container)
        with Agent.run(f"""
           monitors:
           - type: haproxy
             username: a_username
             password: a_password
             url: http://{host}:8081/stats?stats;csv
             proxies: ["FRONTEND", "200s"]
           """) as agent:
            assert ensure_always(
                p(
                    datapoints_have_some_or_all_dims,
                    agent.fake_services,
                    {
                        "proxy_name": "200s",
                        "service_name": "FRONTEND"
                    },
                ),
                10,
            )
            assert any_metric_found(agent.fake_services,
                                    ["haproxy_response_2xx"])
def test_haproxy_default_metrics_from_stats_page_proxies_to_monitor_frontend_200s(
        version):
    with run_service("haproxy", buildargs={"HAPROXY_VERSION":
                                           version}) as service_container:
        host = container_ip(service_container)
        with Agent.run(f"""
           monitors:
           - type: haproxy
             url: http://{host}:8080/stats?stats;csv
             proxies: ["FRONTEND", "200s"]
           """) as agent:
            assert ensure_always(
                p(
                    datapoints_have_some_or_all_dims,
                    agent.fake_services,
                    {
                        "proxy_name": "200s",
                        "service_name": "FRONTEND"
                    },
                ),
                10,
            )
            assert not has_log_message(agent.output.lower(),
                                       "error"), "error found in agent output!"
            assert any_metric_found(agent.fake_services,
                                    ["haproxy_response_2xx"])