Ingensi / dockbeat

Dockbeat - the elastic Beat for docker daemon monitoring
Other
286 stars 70 forks source link

No network stats #71

Closed hcoa closed 8 years ago

hcoa commented 8 years ago

We are running dockerbeat v1.0.0-beta2, and we've found that there are no network statistics, and no any error message. logs with debug level: https://gist.github.com/hcoa/335c1c26ec011adc4394 docker api version 1.20

marminthibaut commented 8 years ago

Can you send a docker inspect on the container that should have network stats?

I suspect that no one of your container has network. Dockerbeat sends one "net" event per network container (e.g. if you have 3 container, each has 2 networks, then you will have 6 "net" events published).

Thanks

sporokh commented 8 years ago

@marminthibaut Hello, We are running containers in the kubernetes, on CoreOS Stable (835.12.0) with Docker version:

Client:
 Version:      1.8.3
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   cedd534-dirty
 Built:        Tue Feb  2 13:28:10 UTC 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.8.3
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   cedd534-dirty
 Built:        Tue Feb  2 13:28:10 UTC 2016
 OS/Arch:      linux/amd64

For example docker inspect of some random container:

[
{
    "Id": "4f996e0dec492587338ab69de9ba23bca655893693b0fa95f5f9b395d2e85969",
    "Created": "2016-02-11T16:41:58.100142587Z",
    "Path": "/docker-entrypoint.sh",
    "Args": [
        "topbeat",
        "-e"
    ],
    "State": {
        "Running": true,
        "Paused": false,
        "Restarting": false,
        "OOMKilled": false,
        "Dead": false,
        "Pid": 16543,
        "ExitCode": 0,
        "Error": "",
        "StartedAt": "2016-02-11T16:41:58.197194088Z",
        "FinishedAt": "0001-01-01T00:00:00Z"
    },
    "Image": "ce7a6654758e31943f4928038e8059569f6516f0524307bdef810c1b2cb0fc66",
    "NetworkSettings": {
        "Bridge": "",
        "EndpointID": "",
        "Gateway": "",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "HairpinMode": false,
        "IPAddress": "",
        "IPPrefixLen": 0,
        "IPv6Gateway": "",
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "MacAddress": "",
        "NetworkID": "",
        "PortMapping": null,
        "Ports": null,
        "SandboxKey": "",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null
    },
    "ResolvConfPath": "/var/lib/docker/containers/eee3ad5759924b8147ce18078224202b42e2a2482739e3fc94dccb8c18cbc664/resolv.conf",
    "HostnamePath": "/var/lib/docker/containers/eee3ad5759924b8147ce18078224202b42e2a2482739e3fc94dccb8c18cbc664/hostname",
    "HostsPath": "/var/lib/kubelet/pods/596c22a2-d0de-11e5-a4e6-0cc47a12b058/etc-hosts",
    "LogPath": "/var/lib/docker/containers/4f996e0dec492587338ab69de9ba23bca655893693b0fa95f5f9b395d2e85969/4f996e0dec492587338ab69de9ba23bca655893693b0fa95f5f9b395d2e85969-json.log",
    "Name": "/k8s_topbeats.cf05cd3_topbeats-ixk2y_default_596c22a2-d0de-11e5-a4e6-0cc47a12b058_c7d3af61",
    "RestartCount": 0,
    "Driver": "overlay",
    "ExecDriver": "native-0.2",
    "MountLabel": "",
    "ProcessLabel": "",
    "AppArmorProfile": "",
    "ExecIDs": null,
    "HostConfig": {
        "Binds": [
            "/var/lib/kubelet/pods/596c22a2-d0de-11e5-a4e6-0cc47a12b058/volumes/kubernetes.io~secret/default-token-2g5kc:/var/run/secrets/kubernetes.io/serviceaccount:ro",
            "/var/lib/kubelet/pods/596c22a2-d0de-11e5-a4e6-0cc47a12b058/etc-hosts:/etc/hosts",
            "/var/lib/kubelet/pods/596c22a2-d0de-11e5-a4e6-0cc47a12b058/containers/topbeats/4f996e0dec492587338ab69de9ba23bca655893693b0fa95f5f9b395d2e85969:/dev/termination-log"
        ],
        "ContainerIDFile": "",
        "LxcConf": null,
        "Memory": 0,
        "MemorySwap": -1,
        "CpuShares": 2,
        "CpuPeriod": 0,
        "CpusetCpus": "",
        "CpusetMems": "",
        "CpuQuota": 0,
        "BlkioWeight": 0,
        "OomKillDisable": false,
        "MemorySwappiness": null,
        "Privileged": true,
        "PortBindings": null,
        "Links": null,
        "PublishAllPorts": false,
        "Dns": [
            "8.8.8.8"
        ],
        "DnsSearch": [
            "default.svc.certascale.local",
            "svc.certascale.local",
            "certascale.local"
        ],
        "ExtraHosts": null,
        "VolumesFrom": null,
        "Devices": null,
        "NetworkMode": "container:eee3ad5759924b8147ce18078224202b42e2a2482739e3fc94dccb8c18cbc664",
        "IpcMode": "container:eee3ad5759924b8147ce18078224202b42e2a2482739e3fc94dccb8c18cbc664",
        "PidMode": "",
        "UTSMode": "",
        "CapAdd": [
            "IPC_LOCK"
        ],
        "CapDrop": null,
        "GroupAdd": null,
        "RestartPolicy": {
            "Name": "",
            "MaximumRetryCount": 0
        },
        "SecurityOpt": null,
        "ReadonlyRootfs": false,
        "Ulimits": null,
        "LogConfig": {
            "Type": "json-file",
            "Config": {}
        },
        "CgroupParent": "",
        "ConsoleSize": [
            0,
            0
        ]
    },
    "GraphDriver": {
        "Name": "overlay",
        "Data": {
            "LowerDir": "/var/lib/docker/overlay/ce7a6654758e31943f4928038e8059569f6516f0524307bdef810c1b2cb0fc66/root",
            "MergedDir": "/var/lib/docker/overlay/4f996e0dec492587338ab69de9ba23bca655893693b0fa95f5f9b395d2e85969/merged",
            "UpperDir": "/var/lib/docker/overlay/4f996e0dec492587338ab69de9ba23bca655893693b0fa95f5f9b395d2e85969/upper",
            "WorkDir": "/var/lib/docker/overlay/4f996e0dec492587338ab69de9ba23bca655893693b0fa95f5f9b395d2e85969/work"
        }
    },
    "Mounts": [
        {
            "Source": "/var/lib/kubelet/pods/596c22a2-d0de-11e5-a4e6-0cc47a12b058/containers/topbeats/4f996e0dec492587338ab69de9ba23bca655893693b0fa95f5f9b395d2e85969",
            "Destination": "/dev/termination-log",
            "Mode": "",
            "RW": true
        },
        {
            "Source": "/var/lib/kubelet/pods/596c22a2-d0de-11e5-a4e6-0cc47a12b058/volumes/kubernetes.io~secret/default-token-2g5kc",
            "Destination": "/var/run/secrets/kubernetes.io/serviceaccount",
            "Mode": "ro",
            "RW": false
        },
        {
            "Source": "/var/lib/kubelet/pods/596c22a2-d0de-11e5-a4e6-0cc47a12b058/etc-hosts",
            "Destination": "/etc/hosts",
            "Mode": "",
            "RW": true
        }
    ],
    "Config": {
        "Hostname": "topbeats-ixk2y",
        "Domainname": "",
        "User": "",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "Tty": false,
        "OpenStdin": false,
        "StdinOnce": false,
        "Env": [

        ],
        "Cmd": [
            "topbeat",
            "-e"
        ],
        "Image": "quay.io/certascale/topbeats:latest",
        "Volumes": null,
        "WorkingDir": "",
        "Entrypoint": [
            "/docker-entrypoint.sh"
        ],
        "OnBuild": null,
        "Labels": {
            "io.kubernetes.pod.name": "default/topbeats-ixk2y",
            "io.kubernetes.pod.terminationGracePeriod": "30"
        }
    }
}
]

As I understand by your statement we should have some network in our container, which currently supported only in Docker version 1.91 and above. Are you talking about something similar to this?

        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "7f3d1ac6341607aaf57646870001f8e7529b0730e1d31a28e0106797ba54b3a1",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "3306/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "3306"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/7f3d1ac63416",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "3fa9f913d49404be43df75a7ea42e71c18c81163394eb09ea2efff4c2d0d06cd",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "",
                    "EndpointID": "3fa9f913d49404be43df75a7ea42e71c18c81163394eb09ea2efff4c2d0d06cd",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02"
marminthibaut commented 8 years ago

Dockerbeat beta2 uses the new specification introduced in the docker API 1.21: https://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/

In this API version, container stats now returns new network fields: https://docs.docker.com/engine/reference/api/docker_remote_api/#v1-21-api-changes

We should update the docker minimal version to display an error message at startup and write some compatibility documentation.

Sorry