2

I need to be able to dynamically discover the configured retention levels in place for a metric or set of metrics from arbitrary Graphite/Carbon services. The existing Graphite API does not seem to expose this information.

Is there a sanctioned way of retrieving this information through the HTTP API short of hacking the Graphite source or otherwise exposing the carbon.conf file?

Machavity
  • 30,841
  • 27
  • 92
  • 100
glycoslave
  • 368
  • 2
  • 7

1 Answers1

1

Yes, you can. You'll be hacking the source to make this happen. Rudimentary Python knowledge would be essential.

  1. Target metric- alpha.beta.charlie
  2. Default metric storage- /opt/graphite/storage/whisper.
  3. Metric file- /opt/graphite/storage/whisper/alpha/beta/charlie.wsp.
  4. Along with the whisper package, comes a script- bin/whisper-info.py.
  5. Do /whisper-info.py /opt/graphite/storage/whisper/alpha/beta/charlie.wsp.

You will get this-

maxRetention: 31536000
xFilesFactor: 0.0
aggregationMethod: sum
fileSize: 1261468

Archive 0
retention: 31536000
secondsPerPoint: 300
points: 105120
size: 1261440
offset: 28

You'll want part of this to be dispalyed dynamically via the webapp. For that, declare a custom method in graphite-web/webapp/graphite/render/functions.py. To make it 'appear' in the webapp GUI, you'll have to make an entry in graphite-web/webapp/content/js/composer_widgets.js.

As far as the function is concerned, you can invoke whisper.info(path) method of the whisper library, or you can 'run' bin/whisper-info.py on the file, parse the output and display it as a graph.

erbdex
  • 1,899
  • 3
  • 22
  • 40