Skip to content

Commit

Permalink
Fixed picky complaining by flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
standaloneSA committed Sep 23, 2015
1 parent 23ef040 commit 677f399
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
40 changes: 20 additions & 20 deletions graphios.py
Expand Up @@ -110,25 +110,25 @@

class GraphiosMetric(object):
def __init__(self):
self.LABEL = '' # The name in the perfdata from nagios
self.VALUE = '' # The measured value of that metric
self.UOM = '' # The unit of measure for the metric
self.DATATYPE = '' # HOSTPERFDATA|SERVICEPERFDATA
self.METRICTYPE = 'gauge' # gauge|counter|timer etc..
self.TIMET = '' # Epoc time the measurement was taken
self.HOSTNAME = '' # name of th host measured
self.SERVICEDESC = '' # nagios configured service description
self.PERFDATA = '' # the space-delimited raw perfdata
self.SERVICECHECKCOMMAND = '' # literal check command syntax
self.HOSTCHECKCOMMAND = '' # literal check command syntax
self.HOSTSTATE = '' # current state afa nagios is concerned
self.HOSTSTATETYPE = '' # HARD|SOFT
self.SERVICESTATE = '' # current state afa nagios is concerned
self.SERVICESTATETYPE = '' # HARD|SOFT
self.METRICBASEPATH = cfg["metric_base_path"] # Establishes a root base path
self.GRAPHITEPREFIX = '' # graphios prefix
self.GRAPHITEPOSTFIX = '' # graphios suffix
self.VALID = False # if this metric is valid
self.LABEL = '' # The name in the perfdata from nagios
self.VALUE = '' # The measured value of that metric
self.UOM = '' # The unit of measure for the metric
self.DATATYPE = '' # HOSTPERFDATA|SERVICEPERFDATA
self.METRICTYPE = 'gauge' # gauge|counter|timer etc..
self.TIMET = '' # Epoc time the measurement was taken
self.HOSTNAME = '' # name of th host measured
self.SERVICEDESC = '' # nagios configured service description
self.PERFDATA = '' # the space-delimited raw perfdata
self.SERVICECHECKCOMMAND = '' # literal check command syntax
self.HOSTCHECKCOMMAND = '' # literal check command syntax
self.HOSTSTATE = '' # current state afa nagios is concerned
self.HOSTSTATETYPE = '' # HARD|SOFT
self.SERVICESTATE = '' # current state afa nagios is concerned
self.SERVICESTATETYPE = '' # HARD|SOFT
self.METRICBASEPATH = '' # Establishes a root base path
self.GRAPHITEPREFIX = '' # graphios prefix
self.GRAPHITEPOSTFIX = '' # graphios suffix
self.VALID = False # if this metric is valid

def validate(self):
# because we eliminated all whitespace, there shouldn't be any quotes
Expand All @@ -150,7 +150,7 @@ def validate(self):
# not using service descriptions
if (
# We should keep this logic and not check for a
# base path here. Just because there's a base path
# base path here. Just because there's a base path
# doesn't mean the metric should be considered valid
self.GRAPHITEPREFIX == "" and
self.GRAPHITEPOSTFIX == ""
Expand Down
7 changes: 4 additions & 3 deletions graphios_backends.py
Expand Up @@ -426,8 +426,9 @@ def convert(self, metrics):
# Converts the metric object list into a list of statsd tuples
out_list = []
for m in metrics:
path = '%s.%s.%s.%s.%s' % (m.METRICBASEPATH, m.GRAPHITEPREFIX, m.HOSTNAME,
m.GRAPHITEPOSTFIX, m.LABEL)
path = '%s.%s.%s.%s.%s' % (m.METRICBASEPATH, m.GRAPHITEPREFIX,
m.HOSTNAME, m.GRAPHITEPOSTFIX,
m.LABEL)
path = re.sub(r'\.$', '', path) # fix paths that end in dot
path = re.sub(r'\.\.', '.', path) # fix paths with empty values
mtype = self.set_type(m) # gauge|counter|timer|set
Expand Down Expand Up @@ -533,7 +534,7 @@ def build_path(self, m):

if m.GRAPHITEPREFIX != "":
path += "%s.%s." % m.GRAPHITEPREFIX

path += "%s." % m.HOSTNAME

if m.SERVICEDESC != "":
Expand Down

0 comments on commit 677f399

Please sign in to comment.