Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / mongodb / mongo_lock @ d112f623

Historique | Voir | Annoter | Télécharger (758 octets)

1 237bf058 Eliot Horowitz
#!/usr/bin/python
2
3
## GENERATED FILE - DO NOT EDIT
4
5
import urllib2
6
import sys
7
8
try:
9
    import json
10
except ImportError:
11
    import simplejson as json
12
13
14
def getServerStatus():
15
    raw = urllib2.urlopen( "http://127.0.0.1:28017/_status" ).read()
16
    return json.loads( raw )["serverStatus"]
17
18
name = "locked"
19
20
def doData():
21
    print name + ".value " + str( 100 * getServerStatus()["globalLock"]["ratio"] )
22
23
def doConfig():
24
25
    print "graph_title MongoDB write lock percentage"
26
    print "graph_args --base 1000 -l 0 "
27
    print "graph_vlabel percentage"
28
    print "graph_category MongoDB"
29
30
    print name + ".label " + name
31
32
33
34
35
36
37
if __name__ == "__main__":
38
    if len(sys.argv) > 1 and sys.argv[1] == "config":
39
        doConfig()
40
    else:
41
        doData()
42