remove trailing '_' from chart name when configuration doesn't specify job name
paulfantom committed
Jul 6, 2016 at 19:25 UTC
682ef4f6afa41d5c139d6e7d187c456c39679179
1 file changed
+10
-2
python.d/python_modules/base.py
+10
-2
@@ -330,7 +330,11 @@ class SimpleService(BaseService):
330
idx = 0
331
for name in self.order:
332
options = self.definitions[name]['options'] + [self.priority + idx, self.update_every]
333
- self.chart(self.__module__ + "_" + self.name + "." + name, *options)
333
+ if self.name == "":
334
+ type_id = self.__module__
335
+ else:
336
+ type_id = self.__module__ + "_" + self.name
337
+ self.chart(type_id + "." + name, *options)
338
# check if server has this datapoint
339
for line in self.definitions[name]['lines']:
340
if line[0] in data:
@@ -352,7 +356,11 @@ class SimpleService(BaseService):
356
357
updated = False
358
for chart in self.order:
355
- if self.begin(self.__module__ + "_" + str(self.name) + "." + chart, interval):
359
+ if str(self.name) == "":
360
+ type_id = self.__module__
361
+ else:
362
+ type_id = self.__module__ + "_" + self.name
363
+ if self.begin(type_id + "." + chart, interval):
364
updated = True
365
for dim in self.definitions[chart]['lines']:
366
try: