Test datasource of type elasticsearch (metricbeat) schows error

Hello,

I am new to grafana and elasticsearch. When I try to create a new datasource with type elasticsearch for a metricbeat index it schows “error” (see uploaded Screen). I’m running Grafana in a docker container and I use volumes to persist the data. (see the output of “docker inspect grafana” and the docker-compose.yml)

I’ve tried to find more Information about what causes the error with no success.

Please advise me where I can find a detailed message.

Many thanks!


docker inspect Output

[
{
“Id”: “81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b”,
“Created”: “2017-07-07T16:11:55.054223103Z”,
“Path”: “/run.sh”,
“Args”: ,
“State”: {
“Status”: “running”,
“Running”: true,
“Paused”: false,
“Restarting”: false,
“OOMKilled”: false,
“Dead”: false,
“Pid”: 30849,
“ExitCode”: 0,
“Error”: “”,
“StartedAt”: “2017-07-07T16:38:09.841982333Z”,
“FinishedAt”: “2017-07-07T16:38:01.127944712Z”
},
“Image”: “sha256:f79ce49a1309030d441be938fd340d8501051e643973910c0e49bba5ae69470b”,
“ResolvConfPath”: “/var/lib/docker/containers/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b/resolv.conf”,
“HostnamePath”: “/var/lib/docker/containers/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b/hostname”,
“HostsPath”: “/var/lib/docker/containers/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b/hosts”,
“LogPath”: “/var/lib/docker/containers/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b-json.log”,
“Name”: “/grafana”,
“RestartCount”: 0,
“Driver”: “aufs”,
“MountLabel”: “”,
“ProcessLabel”: “”,
“AppArmorProfile”: “”,
“ExecIDs”: null,
“HostConfig”: {
“Binds”: [
“/home/dockeruser/dockprom/volumes4docker/grafana/etc:/etc/grafana:rw”,
“/home/dockeruser/dockprom/volumes4docker/grafana:/var/lib/grafana:rw”,
“/home/dockeruser/dockprom/volumes4docker/grafana/log:/var/log/grafana:rw”
],
“ContainerIDFile”: “”,
“LogConfig”: {
“Type”: “json-file”,
“Config”: {}
},
“NetworkMode”: “dockprom_monitor-net”,
“PortBindings”: {
“3000/tcp”: [
{
“HostIp”: “”,
“HostPort”: “3000”
}
]
},
“RestartPolicy”: {
“Name”: “unless-stopped”,
“MaximumRetryCount”: 0
},
“AutoRemove”: false,
“VolumeDriver”: “”,
“VolumesFrom”: ,
“CapAdd”: null,
“CapDrop”: null,
“Dns”: null,
“DnsOptions”: null,
“DnsSearch”: null,
“ExtraHosts”: null,
“GroupAdd”: null,
“IpcMode”: “”,
“Cgroup”: “”,
“Links”: null,
“OomScoreAdj”: 0,
“PidMode”: “”,
“Privileged”: false,
“PublishAllPorts”: false,
“ReadonlyRootfs”: false,
“SecurityOpt”: null,
“UTSMode”: “”,
“UsernsMode”: “”,
“ShmSize”: 67108864,
“Runtime”: “runc”,
“ConsoleSize”: [
0,
0
],
“Isolation”: “”,
“CpuShares”: 0,
“Memory”: 0,
“NanoCpus”: 0,
“CgroupParent”: “”,
“BlkioWeight”: 0,
“BlkioWeightDevice”: null,
“BlkioDeviceReadBps”: null,
“BlkioDeviceWriteBps”: null,
“BlkioDeviceReadIOps”: null,
“BlkioDeviceWriteIOps”: null,
“CpuPeriod”: 0,
“CpuQuota”: 0,
“CpuRealtimePeriod”: 0,
“CpuRealtimeRuntime”: 0,
“CpusetCpus”: “”,
“CpusetMems”: “”,
“Devices”: null,
“DiskQuota”: 0,
“KernelMemory”: 0,
“MemoryReservation”: 0,
“MemorySwap”: 0,
“MemorySwappiness”: -1,
“OomKillDisable”: false,
“PidsLimit”: 0,
“Ulimits”: null,
“CpuCount”: 0,
“CpuPercent”: 0,
“IOMaximumIOps”: 0,
“IOMaximumBandwidth”: 0
},
“GraphDriver”: {
“Name”: “aufs”,
“Data”: null
},
“Mounts”: [
{
“Type”: “bind”,
“Source”: “/home/dockeruser/dockprom/volumes4docker/grafana/etc”,
“Destination”: “/etc/grafana”,
“Mode”: “rw”,
“RW”: true,
“Propagation”: “”
},
{
“Type”: “bind”,
“Source”: “/home/dockeruser/dockprom/volumes4docker/grafana”,
“Destination”: “/var/lib/grafana”,
“Mode”: “rw”,
“RW”: true,
“Propagation”: “”
},
{
“Type”: “bind”,
“Source”: “/home/dockeruser/dockprom/volumes4docker/grafana/log”,
“Destination”: “/var/log/grafana”,
“Mode”: “rw”,
“RW”: true,
“Propagation”: “”
}
],
“Config”: {
“Hostname”: “81eee0fc62b8”,
“Domainname”: “”,
“User”: “”,
“AttachStdin”: false,
“AttachStdout”: false,
“AttachStderr”: false,
“ExposedPorts”: {
“3000/tcp”: {}
},
“Tty”: false,
“OpenStdin”: false,
“StdinOnce”: false,
“Env”: [
“GF_SECURITY_ADMIN_USER=admin”,
“GF_SECURITY_ADMIN_PASSWORD=changeme”,
“GF_USERS_ALLOW_SIGN_UP=false”,
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”
],
“Cmd”: null,
“Image”: “grafana/grafana”,
“Volumes”: {
“/etc/grafana”: {},
“/var/lib/grafana”: {},
“/var/log/grafana”: {}
},
“WorkingDir”: “”,
“Entrypoint”: [
“/run.sh”
],
“OnBuild”: null,
“Labels”: {
“com.docker.compose.config-hash”: “c25843470ce14a3ff42c3e6568b61dec8c4d8cd0aebef0d6a47daa0d77dd9f2e”,
“com.docker.compose.container-number”: “1”,
“com.docker.compose.oneoff”: “False”,
“com.docker.compose.project”: “dockprom”,
“com.docker.compose.service”: “grafana”,
“com.docker.compose.version”: “1.14.0”,
“org.label-schema.group”: “monitoring”
}
},
“NetworkSettings”: {
“Bridge”: “”,
“SandboxID”: “66536a797dec4df9b9dd51789a83405b93f72596d9955cd927ff9d77e30b3886”,
“HairpinMode”: false,
“LinkLocalIPv6Address”: “”,
“LinkLocalIPv6PrefixLen”: 0,
“Ports”: {
“3000/tcp”: [
{
“HostIp”: “0.0.0.0”,
“HostPort”: “3000”
}
]
},
“SandboxKey”: “/var/run/docker/netns/66536a797dec”,
“SecondaryIPAddresses”: null,
“SecondaryIPv6Addresses”: null,
“EndpointID”: “”,
“Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“IPAddress”: “”,
“IPPrefixLen”: 0,
“IPv6Gateway”: “”,
“MacAddress”: “”,
“Networks”: {
“dockprom_monitor-net”: {
“IPAMConfig”: null,
“Links”: null,
“Aliases”: [
“81eee0fc62b8”,
“grafana”
],
“NetworkID”: “a941cd8b55a5da3a2077215472983b4dcd7c60000f5b997174ca7871efb054d2”,
“EndpointID”: “dc3ff2298153ed1ea8f268ab0b18f8a6c29263d5fa1e0a0d7127eb52d21b58ad”,
“Gateway”: “172.18.0.1”,
“IPAddress”: “172.18.0.6”,
“IPPrefixLen”: 16,
“IPv6Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“MacAddress”: “02:42:ac:12:00:06”
}
}
}
}
]


docker-compose.yaml

[
{
“Id”: “81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b”,
“Created”: “2017-07-07T16:11:55.054223103Z”,
“Path”: “/run.sh”,
“Args”: ,
“State”: {
“Status”: “running”,
“Running”: true,
“Paused”: false,
“Restarting”: false,
“OOMKilled”: false,
“Dead”: false,
“Pid”: 30849,
“ExitCode”: 0,
“Error”: “”,
“StartedAt”: “2017-07-07T16:38:09.841982333Z”,
“FinishedAt”: “2017-07-07T16:38:01.127944712Z”
},
“Image”: “sha256:f79ce49a1309030d441be938fd340d8501051e643973910c0e49bba5ae69470b”,
“ResolvConfPath”: “/var/lib/docker/containers/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b/resolv.conf”,
“HostnamePath”: “/var/lib/docker/containers/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b/hostname”,
“HostsPath”: “/var/lib/docker/containers/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b/hosts”,
“LogPath”: “/var/lib/docker/containers/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b/81eee0fc62b8683400ba6e8bc19c8f044f965cfb194b3b75d84cd27eed65066b-json.log”,
“Name”: “/grafana”,
“RestartCount”: 0,
“Driver”: “aufs”,
“MountLabel”: “”,
“ProcessLabel”: “”,
“AppArmorProfile”: “”,
“ExecIDs”: null,
“HostConfig”: {
“Binds”: [
“/home/dockeruser/dockprom/volumes4docker/grafana/etc:/etc/grafana:rw”,
“/home/dockeruser/dockprom/volumes4docker/grafana:/var/lib/grafana:rw”,
“/home/dockeruser/dockprom/volumes4docker/grafana/log:/var/log/grafana:rw”
],
“ContainerIDFile”: “”,
“LogConfig”: {
“Type”: “json-file”,
“Config”: {}
},
“NetworkMode”: “dockprom_monitor-net”,
“PortBindings”: {
“3000/tcp”: [
{
“HostIp”: “”,
“HostPort”: “3000”
}
]
},
“RestartPolicy”: {
“Name”: “unless-stopped”,
“MaximumRetryCount”: 0
},
“AutoRemove”: false,
“VolumeDriver”: “”,
“VolumesFrom”: ,
“CapAdd”: null,
“CapDrop”: null,
“Dns”: null,
“DnsOptions”: null,
“DnsSearch”: null,
“ExtraHosts”: null,
“GroupAdd”: null,
“IpcMode”: “”,
“Cgroup”: “”,
“Links”: null,
“OomScoreAdj”: 0,
“PidMode”: “”,
“Privileged”: false,
“PublishAllPorts”: false,
“ReadonlyRootfs”: false,
“SecurityOpt”: null,
“UTSMode”: “”,
“UsernsMode”: “”,
“ShmSize”: 67108864,
“Runtime”: “runc”,
“ConsoleSize”: [
0,
0
],
“Isolation”: “”,
“CpuShares”: 0,
“Memory”: 0,
“NanoCpus”: 0,
“CgroupParent”: “”,
“BlkioWeight”: 0,
“BlkioWeightDevice”: null,
“BlkioDeviceReadBps”: null,
“BlkioDeviceWriteBps”: null,
“BlkioDeviceReadIOps”: null,
“BlkioDeviceWriteIOps”: null,
“CpuPeriod”: 0,
“CpuQuota”: 0,
“CpuRealtimePeriod”: 0,
“CpuRealtimeRuntime”: 0,
“CpusetCpus”: “”,
“CpusetMems”: “”,
“Devices”: null,
“DiskQuota”: 0,
“KernelMemory”: 0,
“MemoryReservation”: 0,
“MemorySwap”: 0,
“MemorySwappiness”: -1,
“OomKillDisable”: false,
“PidsLimit”: 0,
“Ulimits”: null,
“CpuCount”: 0,
“CpuPercent”: 0,
“IOMaximumIOps”: 0,
“IOMaximumBandwidth”: 0
},
“GraphDriver”: {
“Name”: “aufs”,
“Data”: null
},
“Mounts”: [
{
“Type”: “bind”,
“Source”: “/home/dockeruser/dockprom/volumes4docker/grafana/etc”,
“Destination”: “/etc/grafana”,
“Mode”: “rw”,
“RW”: true,
“Propagation”: “”
},
{
“Type”: “bind”,
“Source”: “/home/dockeruser/dockprom/volumes4docker/grafana”,
“Destination”: “/var/lib/grafana”,
“Mode”: “rw”,
“RW”: true,
“Propagation”: “”
},
{
“Type”: “bind”,
“Source”: “/home/dockeruser/dockprom/volumes4docker/grafana/log”,
“Destination”: “/var/log/grafana”,
“Mode”: “rw”,
“RW”: true,
“Propagation”: “”
}
],
“Config”: {
“Hostname”: “81eee0fc62b8”,
“Domainname”: “”,
“User”: “”,
“AttachStdin”: false,
“AttachStdout”: false,
“AttachStderr”: false,
“ExposedPorts”: {
“3000/tcp”: {}
},
“Tty”: false,
“OpenStdin”: false,
“StdinOnce”: false,
“Env”: [
“GF_SECURITY_ADMIN_USER=admin”,
“GF_SECURITY_ADMIN_PASSWORD=changeme”,
“GF_USERS_ALLOW_SIGN_UP=false”,
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”
],
“Cmd”: null,
“Image”: “grafana/grafana”,
“Volumes”: {
“/etc/grafana”: {},
“/var/lib/grafana”: {},
“/var/log/grafana”: {}
},
“WorkingDir”: “”,
“Entrypoint”: [
“/run.sh”
],
“OnBuild”: null,
“Labels”: {
“com.docker.compose.config-hash”: “c25843470ce14a3ff42c3e6568b61dec8c4d8cd0aebef0d6a47daa0d77dd9f2e”,
“com.docker.compose.container-number”: “1”,
“com.docker.compose.oneoff”: “False”,
“com.docker.compose.project”: “dockprom”,
“com.docker.compose.service”: “grafana”,
“com.docker.compose.version”: “1.14.0”,
“org.label-schema.group”: “monitoring”
}
},
“NetworkSettings”: {
“Bridge”: “”,
“SandboxID”: “66536a797dec4df9b9dd51789a83405b93f72596d9955cd927ff9d77e30b3886”,
“HairpinMode”: false,
“LinkLocalIPv6Address”: “”,
“LinkLocalIPv6PrefixLen”: 0,
“Ports”: {
“3000/tcp”: [
{
“HostIp”: “0.0.0.0”,
“HostPort”: “3000”
}
]
},
“SandboxKey”: “/var/run/docker/netns/66536a797dec”,
“SecondaryIPAddresses”: null,
“SecondaryIPv6Addresses”: null,
“EndpointID”: “”,
“Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“IPAddress”: “”,
“IPPrefixLen”: 0,
“IPv6Gateway”: “”,
“MacAddress”: “”,
“Networks”: {
“dockprom_monitor-net”: {
“IPAMConfig”: null,
“Links”: null,
“Aliases”: [
“81eee0fc62b8”,
“grafana”
],
“NetworkID”: “a941cd8b55a5da3a2077215472983b4dcd7c60000f5b997174ca7871efb054d2”,
“EndpointID”: “dc3ff2298153ed1ea8f268ab0b18f8a6c29263d5fa1e0a0d7127eb52d21b58ad”,
“Gateway”: “172.18.0.1”,
“IPAddress”: “172.18.0.6”,
“IPPrefixLen”: 16,
“IPv6Gateway”: “”,
“GlobalIPv6Address”: “”,
“GlobalIPv6PrefixLen”: 0,
“MacAddress”: “02:42:ac:12:00:06”
}
}
}
}
]

  1. Change the access mode to proxy instead of direct to start with unless you have good reasons for using direct mode.

  2. Make sure you can ping the address to your elasticsearch server.

  3. Check the actual error in the Chrome Dev Tools console.

Chrome Dev Tools console states that I have a cross domain problem.

XMLHttpRequest cannot load http://:9200/metricbeat-2017.07.10/_mapping. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://:3000’ is therefore not allowed access.

After configuring elasticsearch HTTP settings for cors “Save Test” the datasource works fine.

Thanks for the advise.

1 Like