Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting error - unmarshal object while running the couchdb exporter #295

Open
kunalpalan opened this issue May 7, 2024 · 8 comments
Open
Assignees

Comments

@kunalpalan
Copy link

kunalpalan commented May 7, 2024

Hi Gesellix,

I'm running the exporter using the below command
couchdb-prometheus-exporter --config=/etc/couchdb-exporter/config.ini

E0507 13:52:47.770990 1215732 exporter.go:118] error collecting couchdb stats: json: cannot unmarshal object into Go struct field NodeInfo.couchdb of type string

screencapture-192-168-57-250-9984-metrics-2024-05-07-14_32_53
screencapture-192-168-57-250-9984-metrics-2024-05-07-14_32_53.pdf

@gesellix
Copy link
Owner

gesellix commented May 7, 2024

Can you provide some more details about the CouchDB version you are using and whether it runs as single node or in a cluster?

@kunalpalan
Copy link
Author

Hi , we are using "couchdb":"Welcome","version":"3.3.2" and it runs as single node

@gesellix gesellix self-assigned this May 19, 2024
@gesellix
Copy link
Owner

@kunalpalan can you please check the couchdb info like shown below?

curl http://localhost:5984/

For me, the reponse looks like this:

{"couchdb":"Welcome","version":"3.3.2","git_sha":"11a234070","uuid":"8d375d33af396fd8d731de6df57a8e88","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}

Does your CouchDB instance run in a container?
Does the couchdb-prometheus-exporter run in a container, or by using a pre-built binary, or did you build/run it yourself?

I tried to reproduce the issue with the following setup:

docker swarm init
docker network create couchdb
docker run --rm -d --network couchdb --name couchdb -p 5984:5984 --env COUCHDB_USER=admin --env COUCHDB_PASSWORD=password couchdb:3.3.2
curl -X PUT --user admin:password http://localhost:5984/_users
docker run --rm -d --network couchdb --name couchdb-exporter -p 9984:9984 gesellix/couchdb-prometheus-exporter:v30.9.5 --couchdb.uri http://couchdb:5984 --couchdb.username admin --couchdb.password password
curl -s http://localhost:9984/metrics | grep couchdb_server_node_info
docker logs couchdb
docker logs couchdb-exporter

Cleanup of the setup above:

docker stop couchdb-exporter
docker stop couchdb
docker network rm couchdb

@kunalpalan
Copy link
Author

Hi
I used the pre-build binary not a container.
I used the below curl and got the output.
curl http://localhost:6984/

{"couchdb":"Welcome","version":"3.3.2","git_sha":"11a234070","uuid":"8ffb60e6bf8bbe82394c4f65adb7ceb8","features":["search","access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
image

@gesellix
Copy link
Owner

Can you share the couchdb-prometheus-exporter config, without the actual credentials?
Also, do the exporter logs show any errors when you perform requests on the exporter's /metrics endpoint?

@kunalpalan
Copy link
Author

Hi,
Pls find the below config.ini content

couchdb.username=admin
couchdb.password=example
couchdb.uri=http://192.168.10.10:6984/_node/_local/_stats
telemetry.address=192.168.10.10:9984
databases=_all_dbs
scrape.interval=3s

@gesellix
Copy link
Owner

Please change the couchdb.uri to couchdb.uri=http://192.168.10.10.6984. The couchdb-exporter will then navigate to the _stats and other required endpoints by itself.

@kunalpalan
Copy link
Author

kunalpalan commented May 23, 2024

  1. I have changed couchdb.uri=http://192.168.10.10.6984 , but i get below error

E0523 15:35:39.231336 3321696 exporter.go:118] Get "http://192.168.10.10.6984/_all_dbs": dial tcp: lookup 192.168.10.10.6984: no such host

  1. I have changed couchdb.uri=http://192.168.10.10:6984, but i get below error

[root@dchxdqcouch1 couchdb-exporter]# couchdb-prometheus-exporter --config=/etc/couchdb-exporter/config.ini
I0523 15:35:59.126794 3321712 couchdb-exporter.go:357] adopted logging config: {toStderr:true alsoToStderr:false verbosity:0 stderrThreshold:2 logDir:}
I0523 15:35:59.127275 3321712 exporter.go:109] Asynchronously scraping the CouchDB stats at an interval of 3s
I0523 15:35:59.127707 3321712 couchdb-exporter.go:296] Starting exporter version 30.9.5 at '192.168.10.10:9984' to read from CouchDB at 'http://192.168.10.10:6984'
I0523 15:35:59.128005 3321712 klog_logger.go:20] "-" level="info" msg="Listening on" address="192.168.10.10:9984"
I0523 15:35:59.128039 3321712 klog_logger.go:20] "-" level="info" msg="TLS is disabled." http2=false address="192.168.10.10:9984"
E0523 15:36:08.506508 3321712 exporter.go:118] error collecting couchdb stats: error reading database 'pfm_3_1046885_audit' stats: status 500 Internal Server Error (500): {"error":"error","reason":"all_dbs_active"}
E0523 15:38:21.343843 3321712 exporter.go:118] error collecting couchdb stats: error reading database 'pfm_3_1005206_audit' stats: status 500 Internal Server Error (500): {"error":"error","reason":"all_dbs_active"}
E0523 15:40:33.062100 3321712 exporter.go:118] Get "http://192.168.10.10:6984/_all_dbs": dial tcp 192.168.10.10:6984: connect: connection timed out
E0523 15:41:05.251134 3321712 exporter.go:118] error collecting couchdb stats: error reading database 'pfm_3_1017305_audit' stats: status 500 Internal Server Error (500): {"error":"internal_server_error","reason":"No DB shards could be opened.","ref":3085039011}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants