28
28
STORAGE_SCHEMAS_CONFIG = join(settings.CONF_DIR, 'storage-schemas.conf')
29
STORAGE_AGGREGATION_CONFIG = join(settings.CONF_DIR, 'storage-aggregation.conf')
29
30
STORAGE_LISTS_DIR = join(settings.CONF_DIR, 'lists')
31
32
def getFilesystemPath(metric):
146
147
schemaList.append(defaultSchema)
147
148
return schemaList
151
def loadAggregationSchemas():
152
# NOTE: This abuses the Schema classes above, and should probably be refactored.
154
config = OrderedConfigParser()
157
config.read(STORAGE_AGGREGATION_CONFIG)
159
log.msg("%s not found, ignoring." % STORAGE_AGGREGATION_CONFIG)
161
for section in config.sections():
162
options = dict( config.items(section) )
163
matchAll = options.get('match-all')
164
pattern = options.get('pattern')
165
listName = options.get('list')
167
xFilesFactor = options.get('xfilesfactor')
168
aggregationMethod = options.get('aggregationmethod')
171
if xFilesFactor is not None:
172
xFilesFactor = float(xFilesFactor)
173
assert 0 <= xFilesFactor <= 1
174
if aggregationMethod is not None:
175
assert aggregationMethod in whisper.aggregationMethods
177
log.msg("Invalid schemas found in %s." % section )
180
archives = (xFilesFactor, aggregationMethod)
183
mySchema = DefaultSchema(section, archives)
186
mySchema = PatternSchema(section, pattern, archives)
189
mySchema = ListSchema(section, listName, archives)
191
schemaList.append(mySchema)
193
schemaList.append(defaultAggregation)
149
196
defaultArchive = Archive(60, 60 * 24 * 7) #default retention for unclassified data (7 days of minutely data)
150
197
defaultSchema = DefaultSchema('default', [defaultArchive])
198
defaultAggregation = DefaultSchema('default', (None, None))