示例#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
文件: bartender.py 项目: 20c/vodka
def serve(config):
    """
    Serves (runs) the vodka application
    """

    cfg = vodka.config.Config(read=config)
    vodka.run(cfg, cfg)
示例#3
0
文件: vodka.py 项目: wfleurant/vaping
    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
文件: vodka.py 项目: lineman60/vaping
    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
文件: vodka.py 项目: 20c/vaping
    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
文件: uwsgi_app.py 项目: 20c/graphsrv
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