Projet

Général

Profil

Révision 17f78427

ID17f784270ae966ee9a13e9f5104a5b8f925b639e
Parent ef851f0c
Enfant d4320aea, 5b2396a9

Ajouté par Lars Kruse il y a plus de 7 ans

Whitespace cleanup

  • remove trailing whitespace
  • remove empty lines at the end of files

Voir les différences:

plugins/arangodb/arangodb_
1 1
#!/usr/bin/python
2 2

  
3 3
"""
4
Plugin to monitor ArangoDB  servers. It works with the new server statistics 
4
Plugin to monitor ArangoDB  servers. It works with the new server statistics
5 5
interface of ArangoDB 1.3. Not every value seems senseful, but there are
6 6
nice graphs generated...
7 7

  
......
30 30
Links possible:
31 31
        arangodb_conn                   HTTP client connections
32 32
        arangodb_time_total		Total request/queue/connection time
33
        arangodb_bytes_total		Total sent/received bytes 
33
        arangodb_bytes_total		Total sent/received bytes
34 34

  
35 35

  
36 36
Configuration:
37 37
        - No configuration required. Just enable the admin interface of ArangoDB.
38 38

  
39
Thanks to the authors of other Python munin plugins. I've used some of 
40
them as inspiring example. 
39
Thanks to the authors of other Python munin plugins. I've used some of
40
them as inspiring example.
41 41

  
42 42
Possible todos:
43 43
        - support of munin-like configuration parameters
44 44
        - add more statistics
45
        
45

  
46 46
"""
47 47

  
48 48
from os.path import basename
......
57 57

  
58 58
def getServerStatus(group):
59 59
    raw = urllib2.urlopen( "http://127.0.0.1:8529/_admin/statistics" ).read()
60
    
60

  
61 61
    return json.loads( raw )[group]
62 62

  
63 63
def doData(plugin_name):
......
66 66

  
67 67
    elif plugin_name== 'arangodb_time_total':
68 68
        data = getServerStatus('client')
69
        timeTotal = data['totalTime']['sum'] 
70
        timeConnection = data['connectionTime']['sum'] 
71
        timeRequest = data['requestTime']['sum'] 
72
        timeQueue = data['queueTime']['sum'] 
73
         
69
        timeTotal = data['totalTime']['sum']
70
        timeConnection = data['connectionTime']['sum']
71
        timeRequest = data['requestTime']['sum']
72
        timeQueue = data['queueTime']['sum']
73

  
74 74
        print "total.value " + str(int(round(timeTotal)))
75 75
        print "connection.value " + str(int(round(timeConnection)))
76 76
        print "request.value " + str(int(round(timeRequest)))
77 77
        print "queue.value " + str(int(round(timeQueue)))
78
        
78

  
79 79
    elif plugin_name== 'arangodb_bytes_total':
80 80
        data = getServerStatus('client')
81 81
        bytesReceived = data['bytesReceived']['sum']
82 82
        bytesSent = data['bytesSent']['sum']
83 83
        print "received.value " + str(int(round(bytesReceived)))
84 84
        print "sent.value " + str(int(round(bytesSent)))
85
        
85

  
86 86
    else:
87 87
        pass
88
    
88

  
89 89
def doConfig(plugin_name):
90 90
    if plugin_name == 'arangodb_conn':
91 91
        print "graph_title ArangoDB current connections"
......
103 103
        print "connection.label connection"
104 104
        print "request.label request"
105 105
        print "queue.label queue"
106
        
106

  
107 107
    elif plugin_name == 'arangodb_bytes_total':
108 108
        print "graph_title ArangoDB total bytes"
109 109
        print "graph_args --base 1024"
......
125 125

  
126 126
    else:
127 127
        pass
128
     
128

  
129 129

  
130 130

  
131 131
plugin_name = basename(sys.argv[0])

Formats disponibles : Unified diff