Projet

Général

Profil

Révision 1f23e26d

ID1f23e26d954035ac6a5c6b0b88a327a9ad0f4c8a
Parent f6fb7233
Enfant 65a40bb6

Ajouté par Eliot Horowitz il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/mongo_ops
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

  
19
def doData():
20
    ss = getServerStatus()
21
    for k,v in ss["opcounters"].iteritems():
22
        print( str(k) + ".value " + str(v) )
23

  
24
def doConfig():
25

  
26
    print "graph_title MongoDB ops"
27
    print "graph_args --base 1000 -l 0"
28
    print "graph_vlabel ops / ${graph_period}"
29
    print "graph_category MongoDB"
30
    print "graph_total total"
31

  
32
    for k in getServerStatus()["opcounters"]:
33
        print k + ".label " + k
34
        print k + ".min 0"
35
        print k + ".type COUNTER"
36
        print k + ".max 500000"
37
        print k + ".draw LINE1"
38

  
39
if __name__ == "__main__":
40
    if len(sys.argv) > 1 and sys.argv[1] == "config":
41
        doConfig()
42
    else:
43
        doData()
44

  
45

  

Formats disponibles : Unified diff