Exemple #1
0
def test_couchbase_in_k8s(agent_image, minikube, k8s_observer,
                          k8s_test_timeout, k8s_namespace):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "couchbase-k8s.yaml")
    build_opts = {
        "buildargs": {
            "COUCHBASE_VERSION": "enterprise-5.1.0"
        },
        "tag": "couchbase:test"
    }
    minikube.build_image("couchbase", build_opts)
    monitors = [{
        "type":
        "collectd/couchbase",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "collectTarget":
        "NODE",
        "username":
        "******",
        "password":
        "******",
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
def test_activemq_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                         k8s_namespace):
    yaml = SCRIPT_DIR / "activemq-k8s.yaml"
    build_opts = {"tag": "activemq:k8s-test"}
    minikube.build_image("activemq", build_opts)
    monitors = [{
        "type":
        "collectd/activemq",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "serviceURL":
        "service:jmx:rmi:///jndi/rmi://{{.Host}}:{{.Port}}/jmxrmi",
        "username":
        "******",
        "password":
        "******",
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
Exemple #3
0
def test_etcd_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                     k8s_namespace):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "etcd-k8s.yaml")
    monitors = [{
        "type":
        "collectd/etcd",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "clusterName":
        "etcd-cluster",
        "skipSSLValidation":
        True,
        "enhancedMetrics":
        True,
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
def test_jenkins_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                        k8s_namespace):
    yaml = SCRIPT_DIR / "jenkins-k8s.yaml"
    build_opts = {
        "buildargs": {
            "JENKINS_VERSION": "2.60.3-alpine",
            "JENKINS_PORT": "8080"
        },
        "tag": "jenkins:test"
    }
    minikube.build_image("jenkins", build_opts)
    monitors = [{
        "type":
        "collectd/jenkins",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "metricsKey":
        "33DD8B2F1FD645B814993275703F_EE1FD4D4E204446D5F3200E0F6-C55AC14E",
        "enhancedMetrics":
        True,
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
Exemple #5
0
def test_kong_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                     k8s_namespace, kong_version):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "kong-k8s.yaml")
    dockerfile_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                  "../../../test-services/kong")
    build_opts = {
        "tag": "kong:k8s-test",
        "buildargs": {
            "KONG_VERSION": kong_version
        }
    }
    minikube.build_image(dockerfile_dir, build_opts)
    monitors = [{
        "type":
        "collectd/kong",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace)
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
def test_rabbitmq_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                         k8s_namespace):
    yaml = SCRIPT_DIR / "rabbitmq-k8s.yaml"
    monitors = [{
        "type":
        "collectd/rabbitmq",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "collectChannels":
        True,
        "collectConnections":
        True,
        "collectExchanges":
        True,
        "collectNodes":
        True,
        "collectQueues":
        True,
        "username":
        "******",
        "password":
        "******",
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
Exemple #7
0
def test_mongodb_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                        k8s_namespace):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "mongodb-k8s.yaml")
    monitors = [
        {
            "type":
            "collectd/mongodb",
            "discoveryRule":
            get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
            "databases": ["admin"],
            "username":
            "******",
            "password":
            "******"
        },
    ]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout)
def test_mysql_in_k8s(agent_image, minikube, k8s_observer, k8s_yaml,
                      k8s_test_timeout, k8s_namespace):
    yaml = DIR / k8s_yaml
    monitors = [{
        "type":
        "collectd/mysql",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "databases": [{
            "name": "mysql",
            "username": "******",
            "password": "******"
        }],
        "username":
        "******",
        "password":
        "******",
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
def test_elasticsearch_in_k8s(agent_image, minikube, k8s_observer,
                              k8s_test_timeout, k8s_namespace):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "elasticsearch-k8s.yaml")
    dockerfile_dir = os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        "../../../test-services/elasticsearch/6.4.2")
    build_opts = {"tag": "elasticsearch:k8s-test"}
    minikube.build_image(dockerfile_dir, build_opts)
    monitors = [{
        "type":
        "collectd/elasticsearch",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "detailedMetrics":
        True,
        "username":
        "******",
        "password":
        "******",
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
def test_jenkins_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                        k8s_namespace):
    dockerfile_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                  "../../../test-services/jenkins")
    build_opts = {
        "buildargs": {
            "JENKINS_VERSION": "2.60.3-alpine",
            "JENKINS_PORT": "8080"
        },
        "tag": "jenkins:test"
    }
    minikube.build_image(dockerfile_dir, build_opts)
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "jenkins-k8s.yaml")
    monitors = [{
        "type":
        "collectd/jenkins",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "metricsKey":
        "33DD8B2F1FD645B814993275703F_EE1FD4D4E204446D5F3200E0F6-C55AC14E",
        "enhancedMetrics":
        True
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout)
Exemple #11
0
def test_apache_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                       k8s_namespace):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "apache-k8s.yaml")
    monitors = [{
        "type":
        "collectd/apache",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "url":
        'http://{{.Host}}:{{.Port}}/mod_status?auto',
        "username":
        "******",
        "password":
        "******"
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout)
Exemple #12
0
def test_haproxy_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                        k8s_namespace):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "haproxy-k8s.yaml")
    monitors = [
        {
            "type":
            "collectd/haproxy",
            "discoveryRule":
            get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
            "enhancedMetrics":
            True
        },
    ]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout)
def test_consul_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                       k8s_namespace):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "consul-k8s.yaml")
    monitors = [{
        "type":
        "collectd/consul",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "aclToken":
        "testing123",
        "signalFxAccessToken":
        "testing123",
        "enhancedMetrics":
        True,
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
Exemple #14
0
def test_cassandra_in_k8s(agent_image, minikube, k8s_observer,
                          k8s_test_timeout, k8s_namespace):
    yaml = SCRIPT_DIR / "cassandra-k8s.yaml"
    monitors = [{
        "type":
        "collectd/cassandra",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "username":
        "******",
        "password":
        "******",
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
def test_spark_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                      k8s_namespace):
    yaml = SCRIPT_DIR / "spark-k8s.yaml"
    monitors = [{
        "type":
        "collectd/spark",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "clusterType":
        "Standalone",
        "isMaster":
        True,
        "collectApplicationMetrics":
        True,
        "enhancedMetrics":
        True,
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
def test_elasticsearch_in_k8s(agent_image, minikube, k8s_observer,
                              k8s_test_timeout, k8s_namespace):
    if minikube.version.startswith("v1.7."):
        pytest.skip(
            "required env var \"discovery.type\" for elasticsearch not supported in K8S v1.7.x."
        )
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "elasticsearch-k8s.yaml")
    monitors = [
        {
            "type":
            "collectd/elasticsearch",
            "discoveryRule":
            get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
            "detailedMetrics":
            True,
            "username":
            "******",
            "password":
            "******"
        },
    ]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout)
Exemple #17
0
def test_activemq_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout,
                         k8s_namespace):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "activemq-k8s.yaml")
    monitors = [{
        "type":
        "collectd/activemq",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "serviceURL":
        'service:jmx:rmi:///jndi/rmi://{{.Host}}:{{.Port}}/jmxrmi',
        "username":
        "******",
        "password":
        "******"
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout)
Exemple #18
0
def test_vmem():
    expected_metrics = []
    if sys.platform == "linux":
        expected_metrics.extend([
            "vmpage_io.swap.in",
            "vmpage_io.swap.out",
            "vmpage_number.free_pages",
            "vmpage_number.mapped",
            "vmpage_io.memory.in",
            "vmpage_io.memory.out",
            "vmpage_faults.majflt",
            "vmpage_faults.minflt",
        ])
    elif sys.platform == "win32" or sys.platform == "cygwin":
        expected_metrics.extend([
            "vmpage.swap.in_per_second", "vmpage.swap.out_per_second",
            "vmpage.swap.total_per_second"
        ])
    expected_dims = get_monitor_dims_from_selfdescribe("vmem")
    with Agent.run("""
    monitors:
      - type: vmem
    """) as agent:
        assert wait_for(p(has_any_metric_or_dim, agent.fake_services,
                          expected_metrics, expected_dims),
                        timeout_seconds=60
                        ), "timed out waiting for metrics and/or dimensions!"
        assert not has_log_message(agent.output.lower(),
                                   "error"), "error found in agent output!"
def test_postgresql_in_k8s(agent_image, minikube, k8s_observer,
                           k8s_test_timeout, k8s_namespace):
    yaml = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                        "postgresql-k8s.yaml")
    monitors = [{
        "type":
        "collectd/postgresql",
        "discoveryRule":
        get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace),
        "databases": [{
            "name": "test",
            "username": "******",
            "password": "******"
        }],
        "username":
        "******",
        "password":
        "******",
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
        passwords=["test_pwd"],
    )
Exemple #20
0
def test_load():
    expected_metrics = get_monitor_metrics_from_selfdescribe("collectd/load")
    expected_dims = get_monitor_dims_from_selfdescribe("collectd/load")
    with run_agent("""
    monitors:
      - type: collectd/load
    """) as [backend, get_output, _]:
        assert has_any_metric_or_dim(backend, expected_metrics, expected_dims, timeout=60), \
            "timed out waiting for metrics and/or dimensions!"
        assert not has_log_message(get_output().lower(), "error"), "error found in agent output!"
def test_kubernetes_volumes_in_k8s(agent_image, minikube, k8s_test_timeout, k8s_namespace):
    monitors = [{"type": "kubernetes-volumes", "kubeletAPI": {"skipVerify": True, "authType": "serviceAccount"}}]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        expected_metrics=get_monitor_metrics_from_selfdescribe(monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
def test_docker_in_k8s(agent_image, minikube, k8s_test_timeout, k8s_namespace):
    monitors = [{"type": "collectd/docker", "dockerURL": "unix:///var/run/docker.sock", "collectNetworkStats": True}]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        expected_metrics=get_monitor_metrics_from_selfdescribe(monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
Exemple #23
0
def test_cadvisor_in_k8s(agent_image, minikube, k8s_test_timeout, k8s_namespace):
    monitors = [
        {"type": "cadvisor"}
    ]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        expected_metrics=get_monitor_metrics_from_selfdescribe(monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout)
Exemple #24
0
def test_netio():
    expected_metrics = get_monitor_metrics_from_selfdescribe("net-io")
    expected_dims = get_monitor_dims_from_selfdescribe("net-io")
    with run_agent("""
    monitors:
      - type: net-io
    """) as [backend, get_output, _]:
        assert wait_for(p(has_any_metric_or_dim, backend, expected_metrics,
                          expected_dims),
                        timeout_seconds=60
                        ), "timed out waiting for metrics and/or dimensions!"
        assert not has_log_message(get_output().lower(),
                                   "error"), "error found in agent output!"
Exemple #25
0
def test_cadvisor_in_k8s(agent_image, minikube, k8s_test_timeout, k8s_namespace):
    if semver.match(minikube.k8s_version.lstrip("v"), ">=1.12.0"):
        pytest.skip("cadvisor web removed from kubelet in v1.12.0")
    monitors = [{"type": "cadvisor", "cadvisorURL": "http://localhost:4194"}]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        expected_metrics=get_monitor_metrics_from_selfdescribe(monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
Exemple #26
0
def test_interface():
    expected_metrics = get_monitor_metrics_from_selfdescribe("collectd/interface")
    expected_dims = get_monitor_dims_from_selfdescribe("collectd/interface")
    with Agent.run(
        """
    monitors:
      - type: collectd/interface
    """
    ) as agent:
        assert wait_for(
            p(has_any_metric_or_dim, agent.fake_services, expected_metrics, expected_dims), timeout_seconds=60
        ), "timed out waiting for metrics and/or dimensions!"
        assert not has_log_message(agent.output.lower(), "error"), "error found in agent output!"
def test_redis_in_k8s(agent_image, minikube, k8s_observer, k8s_test_timeout, k8s_namespace):
    yaml = SCRIPT_DIR / "redis-k8s.yaml"
    monitors = [
        {"type": "collectd/redis", "discoveryRule": get_discovery_rule(yaml, k8s_observer, namespace=k8s_namespace)}
    ]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        yamls=[yaml],
        observer=k8s_observer,
        expected_metrics=get_monitor_metrics_from_selfdescribe(monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )
def test_protocols():
    """
    Test that we get any datapoints without any errors
    """
    expected_metrics = get_monitor_metrics_from_selfdescribe("collectd/protocols")
    expected_dims = get_monitor_dims_from_selfdescribe("collectd/protocols")
    with run_agent(
        """
    monitors:
      - type: collectd/protocols
    """
    ) as [backend, get_output, _]:
        assert wait_for(
            p(has_any_metric_or_dim, backend, expected_metrics, expected_dims), timeout_seconds=60
        ), "timed out waiting for metrics and/or dimensions!"
        assert not has_log_message(get_output().lower(), "error"), "error found in agent output!"
Exemple #29
0
def test_signalfx_metadata():
    expected_metrics = get_monitor_metrics_from_selfdescribe(
        "collectd/signalfx-metadata")
    expected_dims = get_monitor_dims_from_selfdescribe(
        "collectd/signalfx-metadata")
    with run_agent("""
    monitors:
      - type: collectd/signalfx-metadata
        procFSPath: /proc
        etcPath: /etc
        persistencePath: /var/run/signalfx-agent
      - type: collectd/cpu
    """) as [backend, get_output, _]:
        assert has_any_metric_or_dim(backend, expected_metrics, expected_dims, timeout=60), \
            "timed out waiting for metrics and/or dimensions!"
        assert not has_log_message(get_output().lower(),
                                   "error"), "error found in agent output!"
def test_kubernetes_cluster_in_k8s(agent_image, minikube, k8s_test_timeout,
                                   k8s_namespace):
    monitors = [{
        "type": "kubernetes-cluster",
        "kubernetesAPI": {
            "authType": "serviceAccount"
        }
    }]
    run_k8s_monitors_test(
        agent_image,
        minikube,
        monitors,
        namespace=k8s_namespace,
        expected_metrics=get_monitor_metrics_from_selfdescribe(
            monitors[0]["type"]),
        expected_dims=get_monitor_dims_from_selfdescribe(monitors[0]["type"]),
        test_timeout=k8s_test_timeout,
    )