def main():
    parser = ArgumentParser(description="Run Graph Explorer")
    parser.add_argument("configfile", metavar="CONFIG_FILENAME", type=str)
    parser.add_argument("--debug", type=bool)
    args = parser.parse_args()

    config.init(args.configfile)
    
    c = ConfigValidator(obj=config)
    if not c.validate():
        print "Configuration errors (%s):" % args.configfile
        for (key, err) in c.errors.items():
            print key,
            for e in err:
                print "\n    %s" % e
        sys.exit(1)

    app_dir = os.path.dirname(__file__)
    if app_dir:
        os.chdir(app_dir)

    debug(args.debug)
    run('graph_explorer.app',
        reloader=True,
        host=config.listen_host,
        port=config.listen_port,
        server=PasteServer)
Exemple #2
0
def main():
    parser = ArgumentParser(description="Update Graph Explorer metrics")
    parser.add_argument("configfile", metavar="CONFIG_FILENAME", type=str)
    args = parser.parse_args()

    config.init(args.configfile)

    logger = make_logger('update_metrics', config)
    os.chdir(os.path.dirname(os.path.abspath(__file__)))

    try:
        backend = Backend(config, logger)
        s_metrics = structured_metrics.StructuredMetrics(config, logger)
        errors = s_metrics.load_plugins()
        if len(errors) > 0:
            logger.warn('errors encountered while loading plugins:')
            for e in errors:
                print '\t%s' % e
        logger.info("fetching/saving metrics from graphite...")
        backend.download_metrics_json()
        logger.info("generating structured metrics data...")
        backend.update_data(s_metrics)
        logger.info("success!")
    except Exception, e:  # pylint: disable=W0703
        logger.error("sorry, something went wrong: %s", e)
        from traceback import print_exc
        print_exc()
        sys.exit(2)
def main():
    parser = ArgumentParser(description="Run Graph Explorer")
    parser.add_argument("configfile", metavar="CONFIG_FILENAME", type=str)
    parser.add_argument("--debug", type=bool)
    args = parser.parse_args()

    config.init(args.configfile)
    config.valid_or_die()

    # tmp disabled. breaks config loading
    # app_dir = os.path.dirname(__file__)
    # if app_dir:
    #    os.chdir(app_dir)

    debug(args.debug)
    run("graph_explorer.app", reloader=True, host=config.listen_host, port=config.listen_port, server=PasteServer)
def main():
    parser = ArgumentParser(description="Run Graph Explorer")
    parser.add_argument("configfile", metavar="CONFIG_FILENAME", type=str)
    parser.add_argument("--debug", type=bool)
    args = parser.parse_args()

    config.init(args.configfile)
    config.valid_or_die()

    # tmp disabled. breaks config loading
    #app_dir = os.path.dirname(__file__)
    #if app_dir:
    #    os.chdir(app_dir)

    debug(args.debug)
    run('graph_explorer.app',
        reloader=True,
        host=config.listen_host,
        port=config.listen_port,
        server=PasteServer)
#!/usr/bin/python2
from graph_explorer.alerting import msg_codes, Db, Result, get_worst
from graph_explorer.alerting.emailoutput import EmailOutput
from graph_explorer import structured_metrics
from graph_explorer import config, preferences
import os
from argparse import ArgumentParser
import time

parser = ArgumentParser(description="Process alerting rules")
parser.add_argument("configfile", metavar="CONFIG_FILENAME", type=str)
args = parser.parse_args()

config.init(args.configfile)
config.valid_or_die()

if not config.alerting:
    print "alerting disabled in config"
    os.exit(0)

start_timestamp = int(time.time())
success = True

s_metrics = structured_metrics.StructuredMetrics(config)
db = Db(config.alerting_db)
rules = db.get_rules()

output = EmailOutput(config)


def submit_maybe(result):
very convenient to verify the working of plugins etc.
"""

import sys
from pprint import pprint
import logging

from graph_explorer import structured_metrics
from graph_explorer import config
from graph_explorer.log import make_logger

if len(sys.argv) < 3:
    print "check_update_metric.py <config file> <metric1> [<metric2> [<metric3...]]"
    sys.exit(1)

config.init(sys.argv[1])
config.valid_or_die()


logger = make_logger('check_update_metric', config)
logger.setLevel(logging.WARN)

s_metrics = structured_metrics.StructuredMetrics(config, logger)
errors = s_metrics.load_plugins()
if len(errors) > 0:
    print 'errors encountered while loading plugins:'
    for e in errors:
        print '\t%s' % e
for v in s_metrics.list_metrics(sys.argv[2:]).values():
    pprint(v)
from graph_explorer.alerting import msg_codes, Db, Result
from graph_explorer.alerting.emailoutput import EmailOutput
from graph_explorer import structured_metrics
from graph_explorer import config, preferences
import os
from argparse import ArgumentParser

app_dir = os.path.dirname(__file__)
if app_dir:
    os.chdir(app_dir)

parser = ArgumentParser(description="Process alerting rules")
parser.add_argument("configfile", metavar="CONFIG_FILENAME", type=str)
args = parser.parse_args()

config.init(args.configfile)
config.valid_or_die()


if not config.alerting:
    print "alerting disabled in config"
    os.exit(0)

s_metrics = structured_metrics.StructuredMetrics(config)
db = Db(config.alerting_db)
rules = db.get_rules()

output = EmailOutput(config)


def submit_maybe(result):