3 # graph operations-per-second from a set of storage servers.
5 # the OPERATION value should come from the following list:
6 # allocate: allocate_buckets, first step to upload an immutable file
7 # write: write data to an immutable share
8 # close: finish writing to an immutable share
9 # cancel: abandon a partial immutable share
10 # get: get_buckets, first step to download an immutable file
11 # read: read data from an immutable share
12 # writev: slot_testv_and_readv_and_writev, modify/create a directory
13 # readv: read a directory (or mutable file)
15 # To use this, create a symlink from
16 # /etc/munin/plugins/tahoe_server_operations_OPERATION to this script. For
19 # ln -s /usr/share/doc/allmydata-tahoe/munin/tahoe_server_operations_ \
20 # /etc/munin/plugins/tahoe_server_operations_allocate
22 # Also, you will need to put a list of node statistics URLs in the plugin's
23 # environment, by adding a stanza like the following to a file in
24 # /etc/munin/plugin-conf.d/, such as /etc/munin/plugin-conf.d/tahoe_operations:
26 # [tahoe_server_operations*]
27 # env.url_storage1 http://localhost:9011/statistics?t=json
28 # env.url_storage2 http://localhost:9012/statistics?t=json
29 # env.url_storage3 http://localhost:9013/statistics?t=json
30 # env.url_storage4 http://localhost:9014/statistics?t=json
32 # of course, these URLs must match the webports you have configured into the
40 for k,v in os.environ.items():
41 if k.startswith("url_"):
42 nodename = k[len("url_"):]
43 node_urls.append( (nodename, v) )
46 my_name = os.path.basename(sys.argv[0])
47 PREFIX = "tahoe_server_operations_"
48 assert my_name.startswith(PREFIX)
49 operation = my_name[len(PREFIX):]
52 """graph_title Tahoe Server '%(operation)s' Operations
53 graph_vlabel ops per second
55 graph_info This graph shows how many '%(operation)s' operations take place on the storage server
56 """ % {'operation': operation}
58 for nodename, url in node_urls:
59 configinfo += "%s.label %s\n" % (nodename, nodename)
60 configinfo += "%s.type DERIVE\n" % (nodename,)
61 configinfo += "%s.min 0\n" % (nodename,)
62 configinfo += "%s.draw LINE2\n" % (nodename,)
66 if sys.argv[1] == "config":
67 print configinfo.rstrip()
70 for nodename, url in node_urls:
71 data = simplejson.loads(urllib.urlopen(url).read())
72 key = "storage_server.%s" % operation
73 value = data["counters"][key]
74 print "%s.value %s" % (nodename, value)