Skip to content

Commit

Permalink
Ensure carbon_max_metrics, log_max_size and influxdb_max_metrics are …
Browse files Browse the repository at this point in the history
…ints
  • Loading branch information
Emil Thelin committed Mar 13, 2015
1 parent de2bee5 commit 0b1d48b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions graphios.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ def configure():
sets up graphios config
"""
global debug
try:
cfg["log_max_size"] = int(cfg["log_max_size"])
except ValueError:
print "log_max_size needs to be a integer"
sys.exit(1)

log_handler = logging.handlers.RotatingFileHandler(
cfg["log_file"], maxBytes=cfg["log_max_size"], backupCount=4,
# encoding='bz2')
Expand Down
12 changes: 12 additions & 0 deletions graphios_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ def __init__(self, cfg):
except:
self.carbon_max_metrics = 200

try:
self.carbon_max_metrics = int(self.carbon_max_metrics)
except ValueError:
self.log.critical("carbon_max_metrics needs to be a integer")
sys.exit(1)

try:
cfg['use_service_desc']
self.use_service_desc = cfg['use_service_desc']
Expand Down Expand Up @@ -494,6 +500,12 @@ def __init__(self, cfg):
else:
self.influxdb_max_metrics = 250

try:
self.influxdb_max_metrics = int(self.influxdb_max_metrics)
except ValueError:
self.log.critical("influxdb_max_metrics needs to be a integer")
sys.exit(1)

def build_url(self, server):
""" Returns a url to specified InfluxDB-server """
test_port = server.split(':')
Expand Down

0 comments on commit 0b1d48b

Please sign in to comment.