# Metricbeat couchdb module not working

**URL:** https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094
**Category:** Beats
**Created:** [February 12, 2020, 11:37pm UTC](https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094 "2020-02-12T23:37:43Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Allan\_Johns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allan_johns/32/2387_2.png) [@Allan\_Johns](https://discuss.elastic.co/u/Allan_Johns)
#### Post date: [February 12, 2020, 11:37pm UTC](https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094/1 "2020-02-12T23:37:43Z")

</div>

I'm using metricbeat-7.5.2 to monitor couchdb-2.3.1.

I get the following error in the docs in elastic written by metricbeat:

error in http fetch: HTTP error 404 in : 404 Object Not Found

I cannot get any further info, setting loglevel to debug doesn't show anything more in the metricbeat logs.

It's not a connection error - is metricbeat perhaps not using this newer couch's API correctly? The metricbeat couchdb module docs do say that they are tested with couchdb-1.7, but this is quite an old version.

---

<div class="post-metadata">

### Author: ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)
#### Post date: [February 13, 2020, 10:23am UTC](https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094/2 "2020-02-13T10:23:08Z")

</div>

Hi @Allan_Johns 🙂

Couchdb module uses the REST API and v1 and v2 are [almost identical](https://blog.couchdb.org/2016/08/17/migrating-to-couchdb-2-0/).

In that 1% of difference is the endpoint of stats, which is now prefixed with the node name. If your config host looks like `localhost:5984`, the module tries to fetch data from `localhost:5984/_stats` and you receive a `404 database not found` because of the sometimes confusing way that Couchdb handles responses .

If you change your host to `[ip]:5984/_node/[node-name]/_stats` it should work. The node name is something specific to your couchdb 2 cluster, by default is something like `nonode@nohost`

I hope this helps

---

<div class="post-metadata">

### Author: ![Allan\_Johns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allan_johns/32/2387_2.png) [@Allan\_Johns](https://discuss.elastic.co/u/Allan_Johns)
#### Post date: [February 13, 2020, 10:06pm UTC](https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094/3 "2020-02-13T22:06:31Z")

</div>

Hi Mario,

This worked but now there is another issue. All the couchdb.server.\* fields are coming out as zero. When I check the couch node directly, the fields in the json response definitely are not zero.

I assume this is due to some schema mismatch - perhaps the response from couch 2.x differs from 1.x and metricbeat is setting to zero those fields that it doesn't find in the response?

Thanks for your help. Also, note that I set 'hosts' entry to 'localhost:5984/\_node/\_local/\_stats' and that is working.

Thx  
Allan

---

<div class="post-metadata">

### Author: ![Allan\_Johns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allan_johns/32/2387_2.png) [@Allan\_Johns](https://discuss.elastic.co/u/Allan_Johns)
#### Post date: [February 13, 2020, 10:12pm UTC](https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094/4 "2020-02-13T22:12:03Z")

</div>

Btw looking at the couch 1.6 \_stats docs, it does seem like the metricbeat doc schema matches the 1.6 response. In 2.x, the response is similar, but rather than numeric values such as couchdb.database\_reads, the equivalent field is couchdb.database\_reads.value.

Hth  
Allan

---

<div class="post-metadata">

### Author: ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)
#### Post date: [February 14, 2020, 12:17pm UTC](https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094/5 "2020-02-14T12:17:52Z")

</div>

Yeap, you are right. I did a quick test when you open this thread and I saw that my values "matched" the ones coming out from the JSON in the server (because my empty server was also giving me zeros).

Can you open a Github issue to request this, please? This way someone on beats can try to schedule some time to update it. You are more than welcome if you want to open a PR to add v2, of course 😉

Thanks!

---

<div class="post-metadata">

### Author: ![Allan\_Johns](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/allan_johns/32/2387_2.png) [@Allan\_Johns](https://discuss.elastic.co/u/Allan_Johns)
#### Post date: [February 14, 2020, 8:48pm UTC](https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094/6 "2020-02-14T20:48:19Z")

</div>

Thanks for your help. I'd put in a PR but alas I don't know Go and don't have the time to get acquainted just now!

Ticket: [https://github.com/elastic/beats/issues/16352](https://github.com/elastic/beats/issues/16352)

---

<div class="post-metadata">

### Author: ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)
#### Post date: [February 20, 2020, 3:23pm UTC](https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094/7 "2020-02-20T15:23:29Z")

</div>

PR opened with fix [https://github.com/elastic/beats/pull/16455](https://github.com/elastic/beats/pull/16455)

---

<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: [March 19, 2020, 5:23pm UTC](https://discuss.elastic.co/t/metricbeat-couchdb-module-not-working/219094/8 "2020-03-19T17:23:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
