diff --git a/src/cloudwatch/modules/dimensionhandler.py b/src/cloudwatch/modules/dimensionhandler.py old mode 100755 new mode 100644 index ee54ea3..9b8d96c --- a/src/cloudwatch/modules/dimensionhandler.py +++ b/src/cloudwatch/modules/dimensionhandler.py @@ -15,6 +15,7 @@ def __init__(self, config_helper, vl): self.vl = vl self.dimension_handlers["InstanceId"] = Dimension_InstanceId(self.config, self.vl) self.dimension_handlers["PluginInstance"] = Dimension_PluginInstance(self.config, self.vl) + self.dimension_handlers["Hostname"] = Dimension_Hostname(self.config, self.vl) for h in self.dimension_handlers: self.dimension_handlers[h].register_plugin() diff --git a/src/cloudwatch/modules/dimensionplugins/__init__.py b/src/cloudwatch/modules/dimensionplugins/__init__.py old mode 100755 new mode 100644 diff --git a/src/cloudwatch/modules/dimensionplugins/generic_dimensions.py b/src/cloudwatch/modules/dimensionplugins/generic_dimensions.py old mode 100755 new mode 100644 index 7c0e0d5..8909487 --- a/src/cloudwatch/modules/dimensionplugins/generic_dimensions.py +++ b/src/cloudwatch/modules/dimensionplugins/generic_dimensions.py @@ -2,14 +2,16 @@ This is the file containing generic dimension plugin classes """ +import os from . import DimensionPlugin -def dimension_get_instance_id(dimension, args): - dimension[args['name']] = args['value'] - """ This InstanceId Dimension coming from configured host instance """ + +def dimension_get_instance_id(dimension, args): + dimension[args['name']] = args['value'] + class Dimension_InstanceId(DimensionPlugin): def register_plugin(self): self.func = dimension_get_instance_id @@ -19,12 +21,13 @@ def register_plugin(self): } -def dimension_get_plugin_instance(dimension, args): - dimension[args['name']] = args['value'] - """ This PluginInstance Dimension coming from collectd value plugin instance """ + +def dimension_get_plugin_instance(dimension, args): + dimension[args['name']] = args['value'] + class Dimension_PluginInstance(DimensionPlugin): def register_plugin(self): self.func = dimension_get_plugin_instance @@ -33,3 +36,18 @@ def register_plugin(self): 'value': self.vl.plugin_instance } + +""" +Hostname Dimension report the hostname value +""" + +def dimension_get_hostname(dimension, args): + dimension[args['name']] = args['value'] + +class Dimension_Hostname(DimensionPlugin): + def register_plugin(self): + self.func = dimension_get_hostname + self.args = { + 'name': "Hostname", + 'value': os.uname()[1] + }