Remove support for reading configuration files
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 May 2015 17:16:33 +0000 (17:16 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 5 May 2015 17:16:33 +0000 (17:16 +0000)
We are trying for a zero-conf approach here because we
assume that a system is constantly changing and therefore
is a static configuration almost a hundred percent useless.

example.conf [deleted file]
src/collecty/daemon.py
src/collectyd

diff --git a/example.conf b/example.conf
deleted file mode 100644 (file)
index 6136dee..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Example configuration file for collecty
-#
-
-[cpu.rrd]
-plugin=cpu
-
-[load.rrd]
-plugin=load
-
-[mem.rrd]
-plugin=mem
index 6d6769b..00a4431 100644 (file)
@@ -21,8 +21,6 @@
 
 import signal
 
-import ConfigParser as configparser
-
 import plugins
 
 from constants import *
@@ -36,7 +34,6 @@ class Collecty(object):
        SUBMIT_INTERVAL = 300
 
        def __init__(self, debug=False):
-               self.config = configparser.ConfigParser()
                self.data_sources = []
 
                # Indicates whether this process should be running or not.
@@ -65,29 +62,6 @@ class Collecty(object):
 
                        self.data_sources += ret
 
-       def read_config(self, config):
-               self.config.read(config)
-               
-               for section in self.config.sections():
-                       try:
-                               data_source = self.config.get(section, "data_source")
-                               data_source = plugins.find(data_source)
-                       except configparser.NoOptionError:
-                               raise ConfigError, "Syntax error in configuration: plugin option is missing."
-                       except:
-                               raise Exception, "Plugin configuration error: Maybe plugin wasn't found? %s" % data_source
-
-                       kwargs = {}
-                       for (key, value) in self.config.items(section):
-                               if key == "plugin":
-                                       continue
-
-                       kwargs[key] = value
-                       kwargs["file"] = section
-
-                       ds = data_source(self, **kwargs)
-                       self.data_sources.append(ds)
-
        def run(self):
                # Register signal handlers.
                self.register_signal_handler()
index 32caafa..4813811 100755 (executable)
@@ -25,10 +25,10 @@ import sys
 import collecty
 
 # Parse command line options.
-op = optparse.OptionParser(usage="usage: %prog [options] <configfile1> ... <configfileN>")
+op = optparse.OptionParser(usage="usage: %prog [options]")
 op.add_option("-d", "--debug", action="store_true", default=False,
                help="Enable debug logging.")
-(options, configfiles) = op.parse_args()
+(options, args) = op.parse_args()
 
 # Initialize the settings for this Collecty instance.
 settings = {
@@ -38,10 +38,6 @@ settings = {
 # Initialize the application.
 c = collecty.Collecty(**settings)
 
-# Read all configuration files.
-for configfile in configfiles:
-       c.read_config(configfile)
-
 # Run.
 c.run()