# Marvel refusing to load : "Cannot read property 'cluster\_name' of undefined"

**URL:** <https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-monitoring\
**Created:** [March 17, 2016, 12:47am UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640 "2016-03-17T00:47:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [March 17, 2016, 12:47am UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/1 "2016-03-17T00:47:25Z")

</div>

Hi there,

I just installed Marvel for the first time on a production cluster running Kibana 4.4.2, ES 2.2.1. Followed the installation instructions, but when I try to load Marvel, I get:

```auto
Marvel: Error 400 Bad Request: Cannot read property 'cluster_name' of undefined

```

Calling `/api/marvel/v1/clusters` returns the same:

```auto
{
  statusCode: 400,
  error: "Bad Request",
  message: "Cannot read property 'cluster_name' of undefined"
}

```

`cluster.name` is defined in `elasticsearch.yml` and shows (as `cluster_name`) with a `curl localhost:9200`.

So I'm not quite sure what's going on. The Marvel agent is definitely running, and I have the Marvel indices created (I already tried deleting them and recreating them):

```auto
.marvel-es-2016.03.16
.marvel-es-2016.03.17
.marvel-es-data

```

I also tried stopping all the nodes and restarting them. Ideas?

Thanks!

---

<div class="post-metadata">

**Author:** ![pickypg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pickypg/32/62409_2.png) [@pickypg](https://discuss.elastic.co/u/pickypg)\
**Post date:** [March 21, 2016, 8:13pm UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/2 "2016-03-21T20:13:07Z")

</div>

Hi Julien,

Can you show the output of

```auto
curl localhost:9200/_cat/indices/.marvel*?v

```

I'm wondering if your `.marvel-es-data` index is not actually being populated. Can you verify that you master node(s) have all been restarted after installing Marvel? You can verify this by running:

```auto
curl localhost:9200/_cat/plugins?v

```

Any node not listing Marvel has not been restarted (or it wasn't installed).

---

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [March 21, 2016, 8:45pm UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/3 "2016-03-21T20:45:36Z")

</div>

Hey Chris,

Here is the output :

```auto
$ curl localhost:9200/_cat/indices/.marvel*?v
health status index pri rep docs.count docs.deleted store.size pri.store.size
green open .marvel-es-data 1 1 10 1470 28.6kb 14.3kb
green open .marvel-es-2016.03.21 1 1 1835434 3908 594.9mb 290.7mb

```

And :

```auto
$ curl localhost:9200/_cat/plugins?v
name component version type url
IP1 license 2.2.1 j
IP1 marvel-agent 2.2.1 j
IP2 license 2.2.1 j
IP2 marvel-agent 2.2.1 j
IP3 license 2.2.1 j
IP3 marvel-agent 2.2.1 j

```

Everything looks ok, though I’m not sure what the doc count is supposed to be in `.marvel-es-data`.

---

<div class="post-metadata">

**Author:** ![pickypg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pickypg/32/62409_2.png) [@pickypg](https://discuss.elastic.co/u/pickypg)\
**Post date:** [March 21, 2016, 9:12pm UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/4 "2016-03-21T21:12:36Z")

</div>

Alright, so you've got some data and your nodes all appear to have it running.

Can you fetch the results from the `.marvel-es-data` index so that we can see what's going on in there?

```auto
curl -XGET localhost:9200/.marvel-es-data/cluster_info/_search?pretty -o cluster_info.json

```

I assume that this will be kind of large or it will be empty. One or the other. Assuming it's large, can you copy/paste the output of it into a [GitHub gist](https://gist.github.com/), then link to it. If it's empty, then just let me know that too.

Thanks

---

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [March 22, 2016, 12:41am UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/5 "2016-03-22T00:41:36Z")

</div>

Hey Chris,

It was mostly empty:

```auto
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : ".marvel-es-data",
      "_type" : "cluster_info",
      "_id" : "qbRu5dJtRGKQcurrMduJlQ",
      "_score" : 1.0
    } ]
  }
}

```

Though looking at [elasticsearch-head](https://mobz.github.io/elasticsearch-head/), in the browser section, I can see that there are 9 "node" documents, all fairly similar in terms of fields:

```auto
{
  "_index": ".marvel-es-data",
  "_type": "node",
  "_id": "tai6pwhESQaofOuLLe9Hmg",
  "_version": 328,
  "_score": 1
}

```

Thanks for helping me debug this by the way, I really appreciate it 🙂

---

<div class="post-metadata">

**Author:** ![pickypg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pickypg/32/62409_2.png) [@pickypg](https://discuss.elastic.co/u/pickypg)\
**Post date:** [March 22, 2016, 3:00pm UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/6 "2016-03-22T15:00:44Z")

</div>

Hmm. This definitely looks wrong. Even the `_id` of that document looks wrong to be honest.

For reference, [here's my own with the license part removed](https://gist.github.com/pickypg/a72b0e65c175f9ce14c2). You will probably immediately see where `cluster_name` comes from and hence the error you're seeing.

Do you have any global templates in play? Can you list the response for

```auto
curl -XGET localhost:9200/_template?pretty -o templates.json

```

Thanks.

---

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [March 22, 2016, 3:18pm UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/7 "2016-03-22T15:18:23Z")

</div>

Ha... Good catch! I do have a [global template](https://gist.github.com/calexicoz/f7a13682a82b55775c6d). This cluster stores timeseries, so the default template is optimized for space and performance (no source in particular).

Unfortunately, the index names don't have a clear pattern I can use, except that they don't start with `.`. Is there a simple pattern I can use to include all indices except the `.xxx` ones?

---

<div class="post-metadata">

**Author:** ![pickypg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pickypg/32/62409_2.png) [@pickypg](https://discuss.elastic.co/u/pickypg)\
**Post date:** [March 22, 2016, 4:12pm UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/8 "2016-03-22T16:12:07Z")

</div>

Hi Julien,

Unfortunately not. At least not yet! There's no "exclusionary" part of templates, so [I created an issue for it](https://github.com/elastic/elasticsearch/issues/17247). However, this is definitely the issue. Would it be possible to list that template manually for your indices? I realize that may be a nuisance, but it will allow Marvel indices (and Kibana ones for that matter) to work.

Hopefully we can add a way to hide indices from the templates to avoid this problem.

As an aside about your global template:

```auto
        "dynamic_templates" : [ {
          "string_fields" : {
            "mapping" : {
              "index" : "not_analyzed",
              "doc_values" : true,
              "type" : "string"
            },
            "match_mapping_type" : "string",
            "match" : "*"
          }
        } ],
        "properties" : {
          "@timestamp" : {
            "doc_values" : true,
            "type" : "date"
          }
        },

```

As-of ES 2.0, `doc_values` defaults to true for everything except `analyzed` strings, so you can drop the `"doc_values" : true` from your mappings.

---

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [March 23, 2016, 1:03am UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/9 "2016-03-23T01:03:21Z")

</div>

Hey Chris,

Thanks for all the help! I'll figure something out for the templates. I'm just happy to have found the root cause 🙂

I'll update again once I have everything working.

Cheers!

---

<div class="post-metadata">

**Author:** ![Julien\_Lancien](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Julien\_Lancien](https://discuss.elastic.co/u/Julien_Lancien)\
**Post date:** [March 28, 2016, 8:56pm UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/10 "2016-03-28T20:56:07Z")

</div>

Alright, it took me a minute, but I finally got everything working : deleted my wildcard template and used specific templates instead. Marvel now works as expected.

Thanks again.

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:44pm UTC](https://discuss.elastic.co/t/marvel-refusing-to-load-cannot-read-property-cluster-name-of-undefined/44640/11 "2017-07-06T13:44:44Z")

</div>


