dcu / mongodb_exporter

MongoDB exporter for prometheus.io
MIT License
353 stars 216 forks source link

Failed to get replSet status. oplog_status.go, Failed to get local.oplog_rs collection stats. #100

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hello,

I have a local running instance of mongodb with prometheus

#prom yml
scrape_configs:
  - job_name: 'mongodb'
    static_configs:
      - targets: ['localhost:9001']

However when I run the mongodb_exporter, I am getting this:

$ ./mongodb_exporter-darwin-amd64 Listening on :9001 (scheme=HTTP, secured=no, clientValidation=no) E0604 13:01:13.175465 2063 replset_status.go:232] Failed to get replSet status. E0604 13:01:13.176202 2063 oplog_status.go:127] Failed to get local.oplog_rs collection stats.

Data is being inserted

> db.people.find({"name": "Ale"}).count()
236520
> db.people.find({"name": "Ale"}).count()
240247

Many Thanks

Aidy

ghost commented 6 years ago
db.getSiblingDB("admin").createUser({
    user: "mongodb_exporter",
    pwd: "s3cr3tpassw0rd",
    roles: [
        { role: "clusterMonitor", db: "admin" },
        { role: "read", db: "local" }
    ]
})

Set environment variable MONGODB_URL before starting the exporter: export MONGODB_URL=mongodb://mongodb_exporter:s3cr3tpassw0rd@localhost:27017