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

mongo_lock throws an error #12

Open
ebeyrent opened this issue Jan 16, 2014 · 4 comments
Open

mongo_lock throws an error #12

ebeyrent opened this issue Jan 16, 2014 · 4 comments

Comments

@ebeyrent
Copy link

I am running mongo 2.4.8, and with the latest code from this repo, I get a key error when running the mongo_lock plugin:

$ ./mongo_lock
Traceback (most recent call last):
File "./mongo_lock", line 54, in
doData()
File "./mongo_lock", line 34, in doData
print name + ".value " + str( 100 * getServerStatus()["globalLock"]["ratio"] )
KeyError: 'ratio'

@danvaida
Copy link

@meersjo
Copy link

meersjo commented Apr 10, 2014

@ebeyrent I've forked this some time ago, merged in some of the other forks and added some more stuff. Can't guarantee I'll keep developing on it, but feel free to have a look :-p

@jrborbars
Copy link

Seems to be easy to solve.
The command "curl http://127.0.0.1:28017/_status" doesn't return any "ratio" in "globalLock" variable, but returns lockTime and totalTime. The ratio (I think that this is the question) is lock/total. The only change is in the doData() function below.

def doData():
lock = getServerStatus()["globalLock"]["lockTime"]
total = getServerStatus()["globalLock"]["totalTime"]
print name + ".value " + str( 100.000 * lock / total)

I will send a pull request soon.
Best regards,

jrborbars added a commit to jrborbars/mongo-munin that referenced this issue Jan 15, 2015
Update that solves the erh#12
The ["globalLock"]["ratio"] doesn't exist anymore, only ["globalLock"]["lockTime"] and ["globalLock"]["totalTime"].
@gregpolevoy
Copy link

Just a quick patch for the similar issue. It just happened that we got these plugins on mongo router, which has mongos process and does not return indexCounters on db.serverStatus() call:

OLD:
def get():
return getServerStatus()["indexCounters"]

NEW:
def get():
if getServerStatus()["process"] == "mongos":
print "This is mongo router. Please use this script on mongod servers ONLY"
exit()
return 0

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

5 participants