示例#1
0
文件: web.py 项目: salgo/cloudydave
def graphs(testhost):

    cd = CloudyDave()

    uniques = cd.reportAgo()

    fields = ['testhost', 'test/key', 'startdate',
              'starttime', 'enddate', 'endtime']
    query_fields = ['fromhost', 'testhost', 'test/key']
    params = {}
    query = {}
    data = None

    if request.method == 'POST':
        for key in fields:
            if request.form[key] != '':
                params[key] = request.form[key]
                if key in query_fields:
                    query[key] = request.form[key]

        if 'test/key' in query:
            test, key = query['test/key'].split('/')
            query['key'] = key
            query['test'] = test
            del query['test/key']

        if 'startdate' in params and 'starttime' in params:
            startdt = parse_form_date(params['startdate'], params['starttime'])

        if 'enddate' in params and 'endtime' in params:
            enddt = parse_form_date(params['enddate'], params['endtime'])

        data = cd.graphQuery(startdt, enddt, **query)

    else:
        enddt = datetime.utcnow()
        startdt = enddt - timedelta(minutes=60)

        params['startdate'] = startdt.strftime("%m/%d/%Y")
        params['starttime'] = startdt.strftime("%H:%M")
        params['enddate'] = enddt.strftime("%m/%d/%Y")
        params['endtime'] = enddt.strftime("%H:%M")

    return render_template('graphs.html', testkeys=uniques['test/key'],
                           params=params, data=data, testhost=testhost)
示例#2
0
文件: web.py 项目: salgo/cloudydave
def index():

    cd = CloudyDave()
    uniques = cd.reportAgo()

    return render_template('index.html', nodes=uniques['testhost'])
示例#3
0
from CloudyDave import CloudyDave

cd = CloudyDave()
domain = cd.getDomain()

#rs = domain.select("SELECT * FROM " + domain.name + " WHERE testhost = 'starbuck.salgo.net' AND timestamp > '0' AND test = 'http' ORDER BY timestamp DESC")
#for item in rs:
#    print item

rs = domain.select("SELECT * FROM " + domain.name)
for item in rs:
    print "deleting", item
    domain.delete_item(item)
示例#4
0
文件: check.py 项目: salgo/cloudydave
from CloudyDave import CloudyDave

cd = CloudyDave()
cd.runChecks()
示例#5
0
from CloudyDave import CloudyDave
from config import notify


cd = CloudyDave()
domain = cd.getDomain()

# We intend to use the notify domain so init that
cd.notifyInit()

for testhost in notify:
    for test in notify[testhost]:
        cd.notifyCheck(testhost, test)
示例#6
0
from CloudyDave import CloudyDave
from sys import argv
from datetime import datetime

cd = CloudyDave()
domain = cd.getDomain()

# Fudge together a simple command line query thing.

query, limit = cd.commandArgs(argv)
query = "SELECT * FROM " + domain.name + " WHERE " + query + " ORDER BY timestamp DESC"
rs = domain.select(query)

for item in rs:
    dt = datetime.fromtimestamp(int(item["timestamp"]))
    date = dt.isoformat()

    print "{},{}".format(date, item["value"])