import datetime
import multiprocessing
+import os
import queue
import rrdtool
import signal
import time
from . import bus
+from . import locales
from . import plugins
from .constants import *
def __init__(self, debug=False):
self.debug = debug
+ # Reset timezone to UTC
+ # rrdtool is reading that from the environment
+ os.environ["TZ"] = "UTC"
+
# Enable debug logging when running in debug mode
if self.debug:
log.setLevel(logging.DEBUG)
log.debug(_("Collecty successfully initialized with %s plugins") \
% len(self.plugins))
+ log.debug(_("Supported locales: %s") % ", ".join(locales.get_supported_locales()))
+
def add_plugin(self, plugin_class):
# Try initialising a new plugin. If that fails, we will log the
# error and try to go on.
return plugin.generate_graph(template_name, *args, **kwargs)
+ def graph_info(self, template_name, *args, **kwargs):
+ plugin = self.get_plugin_from_template(template_name)
+ if not plugin:
+ raise RuntimeError("Could not find template %s" % template_name)
+
+ return plugin.graph_info(template_name, *args, **kwargs)
+
def create_worker_threads(self, num=None):
"""
Creates a number of worker threads