mzupan/nagios-plugin-mongodb

Permission Problem in mongodb 5.0

ruben-herold opened this issue · 1 comments

hi,

i try:

python3 /tmp/check_mongodb.py -a admin -u admin -p $adminpw -H "[$IPV6_Hostname]" -A replication_lag_percent -P 27017

I got:

CRITICAL - General MongoDB Error: not authorized on local to execute command { find: "system.namespaces", filter: { name: "local.oplog.$main" }, limit: 1, singleBatch: true, lsid: { id: UUID("1bcb0767-2f73-44ae-ace3-332f2378368b") }, $clusterTime: { clusterTime: Timestamp(1657633819, 1), signature: { hash: BinData(0, A4D4BEFFFEB4558DCAFE1BA0D1935F9F3C818952), keyId: 7119121417987162113 } }, $db: "local", $readPreference: { mode: "primaryPreferred" } }, full error: {'ok': 0.0, 'errmsg': 'not authorized on local to execute command { find: "system.namespaces", filter: { name: "local.oplog.$main" }, limit: 1, singleBatch: true, lsid: { id: UUID("1bcb0767-2f73-44ae-ace3-332f2378368b") }, $clusterTime: { clusterTime: Timestamp(1657633819, 1), signature: { hash: BinData(0, A4D4BEFFFEB4558DCAFE1BA0D1935F9F3C818952), keyId: 7119121417987162113 } }, $db: "local", $readPreference: { mode: "primaryPreferred" } }', 'code': 13, 'codeName': 'Unauthorized', '$clusterTime': {'clusterTime': Timestamp(1657633819, 1), 'signature': {'hash': b'\xa4\xd4\xbe\xff\xfe\xb4U\x8d\xca\xfe\x1b\xa0\xd1\x93_\x9f<\x81\x89R', 'keyId': 7119121417987162113}}, 'operationTime': Timestamp(1657633819, 1)}

The admin user looks like:

{
  users: [
    {
      _id: 'admin.admin',
      userId: UUID("298fb75d-889d-493e-8ac0-13621342dba9"),
      user: 'admin',
      db: 'admin',
      roles: [
        { role: 'readWriteAnyDatabase', db: 'admin' },
        { role: 'root', db: 'admin' },
        { role: 'userAdminAnyDatabase', db: 'admin' }
      ],
      mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
    },
    {
      _id: 'admin.nagios',
      userId: UUID("5b0ae07b-2c3f-429f-92df-addb4a47cb81"),
      user: 'nagios',
      db: 'admin',
      roles: [
        { role: 'readAnyDatabase', db: 'admin' },
        { role: 'clusterAdmin', db: 'admin' }
      ],
      mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
    }
  ],
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1657633939, i: 1 }),
    signature: {
      hash: Binary(Buffer.from("17c447b8bba8d582392c605616f6eb53006c5837", "hex"), 0),
      keyId: Long("7119121417987162113")
    }
  },
  operationTime: Timestamp({ t: 1657633939, i: 1 })
}


Hello
I have the same problem, did you find a solution ?
In fact ihave this message on all actions: "Username/Password incorrect"
What are the credentials on your account ?
Thank's