Skip to content

Instantly share code, notes, and snippets.

@mleinart
mleinart / hf-batch.patch
Created June 15, 2012 01:42
High frequency batching patch for carbon
diff -uirb /home/sandello/carbon-0.9.9/lib/carbon/conf.py /opt/graphite/lib/carbon/conf.py
--- /home/sandello/carbon-0.9.9/lib/carbon/conf.py 2011-10-05 12:30:07.000000000 +0400
+++ /opt/graphite/lib/carbon/conf.py 2011-11-14 03:25:08.736500223 +0400
@@ -32,8 +32,10 @@
MAX_CACHE_SIZE=float('inf'),
MAX_UPDATES_PER_SECOND=1000,
MAX_CREATES_PER_MINUTE=float('inf'),
+ HF_METRICS_PREFIX='',
+ HF_METRICS_BATCH_SIZE=100,
LINE_RECEIVER_INTERFACE='0.0.0.0',
@mleinart
mleinart / pctSavedGraphs.patch
Created May 24, 2012 05:26
Fix to percent containing metrics in saved graphs
diff --git a/webapp/content/js/composer.js b/webapp/content/js/composer.js
index 8e73a5c..734a381 100644
--- a/webapp/content/js/composer.js
+++ b/webapp/content/js/composer.js
@@ -205,7 +205,7 @@ ParameterizedURL.prototype = {
setQueryString: function (qs) {
/* Use the given query string (and update this.params to match) */
- this.queryString = qs.replace(/#/,"%23");
+ this.queryString = qs.replace(/%/,"%25").replace(/#/,"%23");
@mleinart
mleinart / admin.py
Created May 23, 2012 19:10
accounts/admin.py
from django.contrib import admin
from graphite.account.models import Profile,MyGraph
admin.site.register(Profile)
admin.site.register(MyGraph)
@mleinart
mleinart / local_settings-path_additions.py
Created May 10, 2012 16:18
Additional settings to change paths around in Graphite 0.9.9
# Filesystem layout (all directores should end in a /)
WEB_DIR = dirname( abspath(__file__) ) + '/'
WEBAPP_DIR = dirname( dirname(WEB_DIR) ) + '/'
GRAPHITE_ROOT = dirname( dirname(WEBAPP_DIR) ) + '/'
CONTENT_DIR = WEBAPP_DIR + 'content/'
CSS_DIR = CONTENT_DIR + 'css/'
THIRDPARTY_DIR = WEB_DIR + 'thirdparty/'
CONF_DIR = os.environ.get('GRAPHITE_CONF_DIR', GRAPHITE_ROOT + 'conf/')
STORAGE_DIR = os.environ.get('GRAPHITE_STORAGE_DIR', GRAPHITE_ROOT + 'storage/')
@mleinart
mleinart / gist:2559530
Created April 30, 2012 15:58
Sample metadata in graphite SVG
<script>
<![CDATA[
metadata = {
"area": {
"xmin": 39.195507812499997,
"ymin": 33.96875,
"ymax": 623.794921875,
"xmax": 1122
},
"series": [
@mleinart
mleinart / whisper-path-migrate.sh
Created April 25, 2012 08:15
Script to migrate Graphite Whisper data from one dir to another
#!/bin/bash
## Adjustments
PATH=/bin:/usr/bin:/sbin:/usr/sbin
CARBON_SCRIPT=/etc/init.d/carbon-cache
CARBON_CONF=/etc/carbon/carbon.conf
RSYNC_OPTIONS='-av --ignore-existing'
WHISPER_BIN=/usr/bin
execute_cutover () {
@mleinart
mleinart / derived-value-migrate.py
Created April 20, 2012 15:13
Modify data in existing whisper files to be derived from existing counter values
#!/usr/bin/env python
import sys, time, whisper, shutil
from optparse import OptionParser
now = int( time.time() )
option_parser = OptionParser(
usage='''%prog path from''')
@mleinart
mleinart / carbon_link_pool_example.py
Created April 19, 2012 21:16
Example test usage of CarbonLinkPool
@mleinart
mleinart / whisper-resize-filtered.py
Created April 19, 2012 18:34
Whisper-resize with a filter option
#!/usr/bin/env python
import sys, os, time, traceback
import whisper
from optparse import OptionParser
now = int(time.time())
option_parser = OptionParser(
usage='''%prog path timePerPoint:timeToStore [timePerPoint:timeToStore]*
@mleinart
mleinart / asPercent-0.9.9.patch
Created February 28, 2012 16:08
asPercent patch for graphite 0.9.9
=== modified file 'webapp/graphite/render/functions.py'
--- webapp/graphite/render/functions.py 2011-10-04 21:06:09 +0000
+++ webapp/graphite/render/functions.py 2012-02-28 16:05:35 +0000
@@ -225,44 +225,49 @@
series[i] = value
return seriesList
-def asPercent(requestContext, seriesList1, seriesList2orNumber):
+def asPercent(requestContext, seriesList, total=None):
"""