Пример #1
0
    def start(self):

        if self._is_started:
            return

        # deep copy vodka plugin config and prepare to pass
        # to vodka as it's own copy with type and name keys
        # removed

        vodka_config = copy.deepcopy(self.config)
        if "name" in vodka_config:
            del vodka_config["name"]
        if "type" in vodka_config:
            del vodka_config["type"]

        self._is_started = True
        vodka.run(vodka_config, self.vaping.config)

        if graphsrv:
            # if graphsrv is installed proceed to generate
            # target configurations for it from probe config

            for node in self.vaping.config.get("probes", []):
                probe = vaping.plugin.get_probe(node, self.vaping)
                probe_to_graphsrv(probe)
Пример #2
0
def serve(config):
    """
    Serves (runs) the vodka application
    """

    cfg = vodka.config.Config(read=config)
    vodka.run(cfg, cfg)
Пример #3
0
    def start(self):
        vodka.run(self.config, self.vaping.config)

        if graphsrv:
            # if graphsrv is installed proceed to generate
            # target configurations for it from probe config

            # valid probe types to setup targets for
            valid_types = [vaping.plugins.fping.FPing]
            for node in self.vaping.config.get("probes", []):
                probe = vaping.plugin.get_probe(node, self.vaping)
                for typ in valid_types:
                    if isinstance(probe, typ):
                        for k, v in list(probe.config.items()):
                            if isinstance(v, dict) and "hosts" in v:
                                r = {}
                                for host in v.get("hosts"):
                                    if isinstance(host, dict):
                                        r[host["host"]] = host
                                    else:
                                        r[host] = {"host": host}
                                graphsrv.group.add(probe.name, k, r)
                        break

        self._is_started = True
Пример #4
0
    def start(self):
        if self._is_started:
            return
        vodka.run(self.pluginmgr_config, self.vaping.config)

        if graphsrv:
            # if graphsrv is installed proceed to generate
            # target configurations for it from probe config

            for node in self.vaping.config.get("probes", []):
                probe = vaping.plugin.get_probe(node, self.vaping)
                probe_to_graphsrv(probe)

        self._is_started = True
Пример #5
0
    def start(self):
        if self._is_started:
            return
        vodka.run(self.config, self.vaping.config)

        if graphsrv:
            # if graphsrv is installed proceed to generate
            # target configurations for it from probe config

            for node in self.vaping.config.get("probes", []):
                probe = vaping.plugin.get_probe(node, self.vaping)
                probe_to_graphsrv(probe)

        self._is_started = True
Пример #6
0
    def start(self):
        if self._is_started:
            return
        vodka.run(self.pluginmgr_config, self.vaping.config)

        if graphsrv:
            # if graphsrv is installed proceed to generate
            # target configurations for it from probe config

            for node in self.vaping.config.get("probes", []):
                probe = vaping.plugin.get_probe(node, self.vaping)
                for k, v in list(probe.pluginmgr_config.items()):
                    if isinstance(v, dict) and "hosts" in v:
                        r = {}
                        for host in v.get("hosts"):
                            if isinstance(host, dict):
                                r[host["host"]] = host
                            else:
                                r[host] = {"host": host}
                        graphsrv.group.add(probe.name, k, r, **v)
                        break

        self._is_started = True
Пример #7
0
import os
import vodka

from vodka.plugins.wsgi import WSGIPlugin
vodka.run(
    os.environ.get("VODKA_CONFIG_DIR", ".")
)
application = WSGIPlugin.wsgi_application
Пример #8
0
Файл: wsgi.py Проект: 20c/vodka
import os
import vodka
import vodka.config

import vodka.load_entrypoints

from vodka.plugins.wsgi import WSGIPlugin


config = vodka.config.Config()
config.read(config_dir=os.environ.get("VODKA_HOME", "."))

vodka.run(config, config)

application = WSGIPlugin.wsgi_application