Changeset c9047b1 in trunk
- Timestamp:
- 2016-04-28T00:40:04Z (9 years ago)
- Branches:
- master
- Children:
- bde22ad1
- Parents:
- e187fba (diff), ea473cd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified docs/stats.rst ¶
re187fba rc9047b1 310 310 as described in :doc:`configuration`. 311 311 312 Once running, the stats gatherer will create a standard python "pickle" file313 in $BASEDIR/stats.pickle. Once a minute, the gatherer will pull stats314 information from every connected node and write them into the pickle. The315 picklewill contain a dictionary, in which node identifiers (known as "tubid"312 Once running, the stats gatherer will create a standard JSON file in 313 ``$BASEDIR/stats.json``. Once a minute, the gatherer will pull stats 314 information from every connected node and write them into the file. The file 315 will contain a dictionary, in which node identifiers (known as "tubid" 316 316 strings) are the keys, and the values are a dict with 'timestamp', 317 317 'nickname', and 'stats' keys. d[tubid][stats] will contain the stats 318 318 dictionary as made available at http://localhost:3456/statistics?t=json . The 319 picklefile will only contain the most recent update from each node.319 file will only contain the most recent update from each node. 320 320 321 321 Other tools can be built to examine these stats and render them into … … 336 336 Most of the plugins are designed to pull stats from a single Tahoe node, and 337 337 are configured with the e.g. http://localhost:3456/statistics?t=json URL. The 338 "tahoe_stats" plugin is designed to read from the picklefile created by the338 "tahoe_stats" plugin is designed to read from the JSON file created by the 339 339 stats-gatherer. Some plugins are to be used with the disk watcher, and a few 340 340 (like tahoe_nodememory) are designed to watch the node processes directly -
TabularUnified misc/operations_helpers/munin/tahoe-stats.plugin-conf ¶
re187fba rc9047b1 1 1 [tahoe_storage_allocated] 2 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats. pickle2 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats.json 3 3 [tahoe_storage_consumed] 4 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats. pickle4 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats.json 5 5 [tahoe_runtime_load_avg] 6 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats. pickle6 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats.json 7 7 [tahoe_runtime_load_peak] 8 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats. pickle8 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats.json 9 9 [tahoe_storage_bytes_added] 10 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats. pickle10 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats.json 11 11 [tahoe_storage_bytes_freed] 12 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats. pickle12 env.statsfile /home/robk/trees/tahoe/stats_gatherer/stats.json -
TabularUnified misc/operations_helpers/munin/tahoe_stats ¶
re187fba rc9047b1 2 2 3 3 import os 4 import pickle4 import json 5 5 import re 6 6 import sys … … 429 429 def open_stats(fname): 430 430 f = open(fname, 'rb') 431 stats = pickle.load(f)431 stats = json.load(f) 432 432 f.close() 433 433 return stats -
TabularUnified src/allmydata/stats.py ¶
re187fba rc9047b1 1 1 2 import json 2 3 import os 3 import pickle4 4 import pprint 5 5 import time … … 241 241 pprint.pprint(stats) 242 242 243 class PickleStatsGatherer(StdOutStatsGatherer):243 class JSONStatsGatherer(StdOutStatsGatherer): 244 244 # inherit from StdOutStatsGatherer for connect/disconnect notifications 245 245 … … 247 247 self.verbose = verbose 248 248 StatsGatherer.__init__(self, basedir) 249 self. picklefile = os.path.join(basedir, "stats.pickle")250 251 if os.path.exists(self. picklefile):252 f = open(self. picklefile, 'rb')249 self.jsonfile = os.path.join(basedir, "stats.json") 250 251 if os.path.exists(self.jsonfile): 252 f = open(self.jsonfile, 'rb') 253 253 try: 254 self.gathered_stats = pickle.load(f)254 self.gathered_stats = json.load(f) 255 255 except Exception: 256 print ("Error while attempting to load pickle file %s.\n" 257 "You may need to restore this file from a backup, or delete it if no backup is available.\n" % 258 quote_local_unicode_path(self.picklefile)) 256 print ("Error while attempting to load stats file %s.\n" 257 "You may need to restore this file from a backup," 258 " or delete it if no backup is available.\n" % 259 quote_local_unicode_path(self.jsonfile)) 259 260 raise 260 261 f.close() … … 267 268 s['nickname'] = nickname 268 269 s['stats'] = stats 269 self.dump_ pickle()270 271 def dump_ pickle(self):272 tmp = "%s.tmp" % (self. picklefile,)270 self.dump_json() 271 272 def dump_json(self): 273 tmp = "%s.tmp" % (self.jsonfile,) 273 274 f = open(tmp, 'wb') 274 pickle.dump(self.gathered_stats, f)275 json.dump(self.gathered_stats, f) 275 276 f.close() 276 if os.path.exists(self. picklefile):277 os.unlink(self. picklefile)278 os.rename(tmp, self. picklefile)277 if os.path.exists(self.jsonfile): 278 os.unlink(self.jsonfile) 279 os.rename(tmp, self.jsonfile) 279 280 280 281 class StatsGathererService(service.MultiService): … … 291 292 self.tub.setOption("expose-remote-exception-types", False) 292 293 293 self.stats_gatherer = PickleStatsGatherer(self.basedir, verbose)294 self.stats_gatherer = JSONStatsGatherer(self.basedir, verbose) 294 295 self.stats_gatherer.setServiceParent(self) 295 296
Note: See TracChangeset
for help on using the changeset viewer.