Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hostname dimension #3

Merged
merged 2 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cloudwatch/modules/dimensionhandler.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Empty file modified src/cloudwatch/modules/dimensionplugins/__init__.py
100755 → 100644
Empty file.
30 changes: 24 additions & 6 deletions src/cloudwatch/modules/dimensionplugins/generic_dimensions.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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]
}