Skip to content

Replicaset/Server stats are not own data, but read-preference's data #54

@naemono

Description

@naemono

Using the mongo client without :connect :direct option is returning the replSetGetStatus, and serverStatus information for whatever the read preference is set to, such as the master, and not your own information.

Example

local rs.status

> rs.status()
{
	"set" : "1b686e5c-7630-46e6-9d9e-80108b2f92e1",
	"date" : ISODate("2017-10-02T16:35:16.305Z"),
	"myState" : 2,
	"term" : NumberLong(2),
	"syncingTo" : "redacted",

output

# /opt/sensu/embedded/bin/ruby /etc/sensu/plugins/metrics-mongodb.rb --user redacted --password redacted | grep replicaset.state
80d05bce-8a92-47e7-8e1a-8d21d7032627.mongodb.metrics.replicaset.state 1 1506961990

https://gist.github.com/naemono/d9a7ef94b030d5e06b4b9dc378ba89aa

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions