Projet

Général

Profil

Révision 237bf058

ID237bf0581b245f3a94dbbe2807ca90bc864e2e6c
Parent 9045f18d
Enfant 346b8c3a

Ajouté par Eliot Horowitz il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/mongo_lock
1
#!/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

  
43

  

Formats disponibles : Unified diff