Metricbeat couchdb module not working

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.

Hi @Allan_Johns :slightly_smiling_face:

Couchdb module uses the REST API and v1 and v2 are almost identical.

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

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

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

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 :wink:

Thanks!

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

PR opened with fix https://github.com/elastic/beats/pull/16455

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