cargomedia / bipbip

UNMAINTAINED. Gather services data and store in CopperEgg/IDERA
MIT License
4 stars 7 forks source link

[mongodb] Query DBs status and stats only for master and primary members #173

Closed kris-lab closed 7 years ago

kris-lab commented 7 years ago

Since WiredTiger/mongo@3.0 there is no possibility to list databases and stats for databases on secondary members.

Only partial data is collected

I, [2017-01-27T10:36:43.914870 #18952]  INFO -- : Starting plugin mongodb with config {"hostname"=>"0.0.0.0", "port"=>27018, "user"=>"xxx", "password"=>"xxx"}
E, [2017-01-27T10:38:44.022819 #18952] ERROR -- mongodb rep1-db7.mongodb.xxx.net::mongodb::0_0_0_0: Measurement timeout of 120.0 seconds reached.
E, [2017-01-27T10:40:44.023639 #18952] ERROR -- mongodb rep1-db7.mongodb.xxx.net::mongodb::0_0_0_0: Measurement timeout of 120.0 seconds reached.
kris-lab commented 7 years ago
rep1:STARTUP2> db.adminCommand({serverStatus:1})
{
 (...)
    "repl" : {
        "setName" : "rep1",
        "setVersion" : 14,
        "ismaster" : true,
        "secondary" : false,
        "hosts" : [
            "rep1-db5.mongodb.xxx.net:27018",
            "rep1-db6.mongodb.xxx.net:27018",
            "rep1-db7.mongodb.xxx.net:27018"
        ],
        "arbiters" : [
            "rep1-arbiter3.mongodb.xxx.net:27018"
        ],
        "primary" : "rep1-db6.mongodb.xxx.net:27018",
        "me" : "rep1-db7.mongodb.xxx.net:27018",
        "rbid" : 2086099880
    },
 (...)
}
kris-lab commented 7 years ago

@njam please review

njam commented 7 years ago

Seems strange that we can't collect slow queries on secondaries. But since we plan to move to managed mongodb anyway it's not a big issue.

Is it okay to not set some fields for bipbip and Copperegg?

otherwise lgtm

kris-lab commented 7 years ago

Is it okay to not set some fields for bipbip and Copperegg?

seems to be ok! It runs like that for the moment.

Seems strange that we can't collect slow queries on secondaries. But since we plan to move to managed mongodb anyway it's not a big issue.

agree, it looks like the slave/secondary doesn't allow to browse any specific data. Maybe if you cannot really read, then slow queries metric doesn't make sense anyway. I am wondering how it works if you actually wanna read data from secondaries. Not sure if this is supported in 3.0+, should I investigate?

kris-lab commented 7 years ago

@njam also WiredTiger does not include backgroundFlushing section in servers status. It is because it has own and very detailed object with stats.

{
    (...)
    "storageEngine" : {
        "name" : "wiredTiger"
    },
    "wiredTiger" : {
            (many stats)
        }
    (...)
}
njam commented 7 years ago

We never read from secondaries so far. Let's keep it simple and remove unsupported stats for now?

kris-lab commented 7 years ago

@njam please re-review

njam commented 7 years ago

lgtm