예제 #1
0
    def default(self, *p, **params):
        if len(p) < 2:
            return ""
        hostId = int(p[0]) if p[0].isdigit() else hosts.uiShortnameToHostId(p[0])
        hostUiName = p[0] if not p[0].isdigit() else hosts.hostIdToUiShortname(p[0])
        name = p[1]
        interval = {}

        if 'interval' in params:
            interval['interval'] = str(params['interval'])+' days'
        elif 'from' in params and 'to' in params:
            interval['from'] = params['from']
            interval['to'] = params['to']
        else:
            days = int(cherrypy.request.cookie['days'].value) if 'days' in cherrypy.request.cookie else 8
            interval['from'] = (datetime.datetime.now() - datetime.timedelta(days=days)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now() + datetime.timedelta(days=1)).strftime('%Y-%m-%d')

        data = tabledata.getTableData(hostId, name, interval)

        graph_table_size = flotgraph.SizeGraph ("graphtablesize","right")
        graph_table_size.addSeries("Table Size","size")
        for p in data['table_size']:
            graph_table_size.addPoint("size", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_index_size = flotgraph.SizeGraph ("graphindexsize","right")
        graph_index_size.addSeries("Index Size", "size")
        for p in data['index_size']:
            graph_index_size.addPoint("size", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_seq_scans = flotgraph.Graph ("graphseqscans","right")
        graph_seq_scans.addSeries("Sequential Scans","count")
        for p in data['seq_scans']:
            graph_seq_scans.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_index_scans = flotgraph.Graph ("graphindexscans","right")
        graph_index_scans.addSeries("Index Scans","count")
        for p in data['index_scans']:
            graph_index_scans.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_t_ins = flotgraph.Graph ("gtupins","right")
        graph_t_ins.addSeries("Inserts","count",'#FF0000')
        for p in data['ins']:
            graph_t_ins.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_t_upd = flotgraph.Graph ("gtupupd","right")
        graph_t_upd.addSeries("Updates","count",'#FF8800')
        graph_t_upd.addSeries("Hot Updates","hotcount",'#885500')
        for p in data['upd']:
            graph_t_upd.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        for p in data['hot']:
            graph_t_upd.addPoint("hotcount", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_t_del = flotgraph.Graph ("gtupdel","right")
        graph_t_del.addSeries("Deletes","count")
        for p in data['del']:
            graph_t_del.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])


        data = tabledata.getTableIOData(hostId, name, interval)

        graph_index_iob = flotgraph.Graph ("graphindexiob","right")
        graph_index_iob.addSeries("Index_hit","ihit")
        for p in data['index_hit']:
            graph_index_iob.addPoint("ihit", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_index_iod = flotgraph.Graph ("graphindexiod","right")
        graph_index_iod.addSeries("Index_read","iread",'#FF0000')
        for p in data['index_read']:
            graph_index_iod.addPoint("iread", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_heap_iod = flotgraph.Graph ("graphheapiod","right")
        graph_heap_iod.addSeries("Heap_read","hread",'#FF0000')
        for p in data['heap_read']:
            graph_heap_iod.addPoint("hread", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_heap_iob = flotgraph.Graph ("graphheapiob","right")
        graph_heap_iob.addSeries("Heap_hit","hhit")
        for p in data['heap_hit']:
            graph_heap_iob.addPoint("hhit", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        tpl = tplE.env.get_template('table_detail.html')
        return tpl.render(name=name,
                          schema_name=name[:name.find('.')],
                          host=hostId,
                          interval=interval,
                          hostuiname = hostUiName,
                          hostname = hosts.getHosts()[hostId]['uilongname'],
                          graphtablesize=graph_table_size.render(),
                          graphindexsize=graph_index_size.render(),
                          graphseqscans=graph_seq_scans.render(),
                          graphindexscans=graph_index_scans.render(),

                          graphindexiod=graph_index_iod.render(),
                          graphindexiob=graph_index_iob.render(),
                          graphheapiod=graph_heap_iod.render(),
                          graphheapiob=graph_heap_iob.render(),

                          gtupins=graph_t_ins.render(),
                          gtupupd=graph_t_upd.render(),
                          gtupdel=graph_t_del.render(),

                          target='World')
예제 #2
0
    def default(self, *p, **params):
        if len(p) < 2:
            return ""

        host = p[0]
        name = p[1]

        data = tabledata.getTableData(host, name)

        graph_table_size = flotgraph.SizeGraph("graphtablesize", "right")
        graph_table_size.addSeries("Table Size", "size")
        for p in data["table_size"]:
            graph_table_size.addPoint("size", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_index_size = flotgraph.SizeGraph("graphindexsize", "right")
        graph_index_size.addSeries("Index Size", "size")
        for p in data["index_size"]:
            graph_index_size.addPoint("size", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_seq_scans = flotgraph.Graph("graphseqscans", "right")
        graph_seq_scans.addSeries("Sequential Scans", "count")
        for p in data["seq_scans"]:
            graph_seq_scans.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_index_scans = flotgraph.Graph("graphindexscans", "right")
        graph_index_scans.addSeries("Index Scans", "count")
        for p in data["index_scans"]:
            graph_index_scans.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_t_ins = flotgraph.Graph("gtupins", "right")
        graph_t_ins.addSeries("Inserts", "count", "#FF0000")
        for p in data["ins"]:
            graph_t_ins.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_t_upd = flotgraph.Graph("gtupupd", "right")
        graph_t_upd.addSeries("Updates", "count", "#FF8800")
        graph_t_upd.addSeries("Hot Updates", "hotcount", "#885500")
        for p in data["upd"]:
            graph_t_upd.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        for p in data["hot"]:
            graph_t_upd.addPoint("hotcount", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_t_del = flotgraph.Graph("gtupdel", "right")
        graph_t_del.addSeries("Deletes", "count")
        for p in data["del"]:
            graph_t_del.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        data = tabledata.getTableIOData(host, name)

        graph_index_iob = flotgraph.Graph("graphindexiob", "right")
        graph_index_iob.addSeries("Index_hit", "ihit")
        for p in data["index_hit"]:
            graph_index_iob.addPoint("ihit", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_index_iod = flotgraph.Graph("graphindexiod", "right")
        graph_index_iod.addSeries("Index_read", "iread", "#FF0000")
        for p in data["index_read"]:
            graph_index_iod.addPoint("iread", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_heap_iod = flotgraph.Graph("graphheapiod", "right")
        graph_heap_iod.addSeries("Heap_read", "hread", "#FF0000")
        for p in data["heap_read"]:
            graph_heap_iod.addPoint("hread", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_heap_iob = flotgraph.Graph("graphheapiob", "right")
        graph_heap_iob.addSeries("Heap_hit", "hhit")
        for p in data["heap_hit"]:
            graph_heap_iob.addPoint("hhit", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        tpl = tplE.env.get_template("table_detail.html")
        return tpl.render(
            name=name,
            host=host,
            graphtablesize=graph_table_size.render(),
            graphindexsize=graph_index_size.render(),
            graphseqscans=graph_seq_scans.render(),
            graphindexscans=graph_index_scans.render(),
            graphindexiod=graph_index_iod.render(),
            graphindexiob=graph_index_iob.render(),
            graphheapiod=graph_heap_iod.render(),
            graphheapiob=graph_heap_iob.render(),
            gtupins=graph_t_ins.render(),
            gtupupd=graph_t_upd.render(),
            gtupdel=graph_t_del.render(),
            target="World",
        )
예제 #3
0
    def default(self, *p, **params):
        if len(p) < 2:
            return ""

        host = p[0]
        name = p[1]

        if 'interval' in params:
            interval = {}
            interval['interval'] = str(params['interval'])+' days'
        elif 'from' in params and 'to' in params:
            interval = {}
            interval['from'] = params['from']
            interval['to'] = params['to']
        else:
            interval = {}
            interval['from'] = (datetime.datetime.now() - datetime.timedelta(days=14)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now() + datetime.timedelta(days=1)).strftime('%Y-%m-%d')

        data = tabledata.getTableData(host, name, interval)

        graph_table_size = flotgraph.SizeGraph ("graphtablesize","right")
        graph_table_size.addSeries("Table Size","size")
        for p in data['table_size']:
            graph_table_size.addPoint("size", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_index_size = flotgraph.SizeGraph ("graphindexsize","right")
        graph_index_size.addSeries("Index Size", "size")
        for p in data['index_size']:
            graph_index_size.addPoint("size", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_seq_scans = flotgraph.Graph ("graphseqscans","right")
        graph_seq_scans.addSeries("Sequential Scans","count")
        for p in data['seq_scans']:
            graph_seq_scans.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_index_scans = flotgraph.Graph ("graphindexscans","right")
        graph_index_scans.addSeries("Index Scans","count")
        for p in data['index_scans']:
            graph_index_scans.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_t_ins = flotgraph.Graph ("gtupins","right")
        graph_t_ins.addSeries("Inserts","count",'#FF0000')
        for p in data['ins']:
            graph_t_ins.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_t_upd = flotgraph.Graph ("gtupupd","right")
        graph_t_upd.addSeries("Updates","count",'#FF8800')
        graph_t_upd.addSeries("Hot Updates","hotcount",'#885500')
        for p in data['upd']:
            graph_t_upd.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        for p in data['hot']:
            graph_t_upd.addPoint("hotcount", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_t_del = flotgraph.Graph ("gtupdel","right")
        graph_t_del.addSeries("Deletes","count")
        for p in data['del']:
            graph_t_del.addPoint("count", int(time.mktime(p[0].timetuple()) * 1000) , p[1])


        data = tabledata.getTableIOData(host, name)

        graph_index_iob = flotgraph.Graph ("graphindexiob","right")
        graph_index_iob.addSeries("Index_hit","ihit")
        for p in data['index_hit']:
            graph_index_iob.addPoint("ihit", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_index_iod = flotgraph.Graph ("graphindexiod","right")
        graph_index_iod.addSeries("Index_read","iread",'#FF0000')
        for p in data['index_read']:
            graph_index_iod.addPoint("iread", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_heap_iod = flotgraph.Graph ("graphheapiod","right")
        graph_heap_iod.addSeries("Heap_read","hread",'#FF0000')
        for p in data['heap_read']:
            graph_heap_iod.addPoint("hread", int(time.mktime(p[0].timetuple()) * 1000) , p[1])

        graph_heap_iob = flotgraph.Graph ("graphheapiob","right")
        graph_heap_iob.addSeries("Heap_hit","hhit")
        for p in data['heap_hit']:
            graph_heap_iob.addPoint("hhit", int(time.mktime(p[0].timetuple()) * 1000) , p[1])


        tpl = tplE.env.get_template('table_detail.html')
        return tpl.render(name=name,host=host,interval=interval,
                          hostname = hosts.getHostData()[int(host)]['settings']['uiLongName'],
                          graphtablesize=graph_table_size.render(),
                          graphindexsize=graph_index_size.render(),
                          graphseqscans=graph_seq_scans.render(),
                          graphindexscans=graph_index_scans.render(),

                          graphindexiod=graph_index_iod.render(),
                          graphindexiob=graph_index_iob.render(),
                          graphheapiod=graph_heap_iod.render(),
                          graphheapiob=graph_heap_iob.render(),

                          gtupins=graph_t_ins.render(),
                          gtupupd=graph_t_upd.render(),
                          gtupdel=graph_t_del.render(),

                          target='World')
예제 #4
0
    def default(self, *p, **params):
        if len(p) < 2:
            return ""

        host = p[0]
        name = p[1]

        if 'interval' in params:
            interval = {}
            interval['interval'] = str(params['interval']) + ' days'
        elif 'from' in params and 'to' in params:
            interval = {}
            interval['from'] = params['from']
            interval['to'] = params['to']
        else:
            interval = {}
            interval['from'] = (
                datetime.datetime.now() -
                datetime.timedelta(days=14)).strftime('%Y-%m-%d')
            interval['to'] = (datetime.datetime.now() +
                              datetime.timedelta(days=1)).strftime('%Y-%m-%d')

        data = tabledata.getTableData(host, name, interval)

        graph_table_size = flotgraph.SizeGraph("graphtablesize", "right")
        graph_table_size.addSeries("Table Size", "size")
        for p in data['table_size']:
            graph_table_size.addPoint(
                "size", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_index_size = flotgraph.SizeGraph("graphindexsize", "right")
        graph_index_size.addSeries("Index Size", "size")
        for p in data['index_size']:
            graph_index_size.addPoint(
                "size", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_seq_scans = flotgraph.Graph("graphseqscans", "right")
        graph_seq_scans.addSeries("Sequential Scans", "count")
        for p in data['seq_scans']:
            graph_seq_scans.addPoint("count",
                                     int(time.mktime(p[0].timetuple()) * 1000),
                                     p[1])

        graph_index_scans = flotgraph.Graph("graphindexscans", "right")
        graph_index_scans.addSeries("Index Scans", "count")
        for p in data['index_scans']:
            graph_index_scans.addPoint(
                "count", int(time.mktime(p[0].timetuple()) * 1000), p[1])

        graph_t_ins = flotgraph.Graph("gtupins", "right")
        graph_t_ins.addSeries("Inserts", "count", '#FF0000')
        for p in data['ins']:
            graph_t_ins.addPoint("count",
                                 int(time.mktime(p[0].timetuple()) * 1000),
                                 p[1])

        graph_t_upd = flotgraph.Graph("gtupupd", "right")
        graph_t_upd.addSeries("Updates", "count", '#FF8800')
        graph_t_upd.addSeries("Hot Updates", "hotcount", '#885500')
        for p in data['upd']:
            graph_t_upd.addPoint("count",
                                 int(time.mktime(p[0].timetuple()) * 1000),
                                 p[1])

        for p in data['hot']:
            graph_t_upd.addPoint("hotcount",
                                 int(time.mktime(p[0].timetuple()) * 1000),
                                 p[1])

        graph_t_del = flotgraph.Graph("gtupdel", "right")
        graph_t_del.addSeries("Deletes", "count")
        for p in data['del']:
            graph_t_del.addPoint("count",
                                 int(time.mktime(p[0].timetuple()) * 1000),
                                 p[1])

        data = tabledata.getTableIOData(host, name)

        graph_index_iob = flotgraph.Graph("graphindexiob", "right")
        graph_index_iob.addSeries("Index_hit", "ihit")
        for p in data['index_hit']:
            graph_index_iob.addPoint("ihit",
                                     int(time.mktime(p[0].timetuple()) * 1000),
                                     p[1])

        graph_index_iod = flotgraph.Graph("graphindexiod", "right")
        graph_index_iod.addSeries("Index_read", "iread", '#FF0000')
        for p in data['index_read']:
            graph_index_iod.addPoint("iread",
                                     int(time.mktime(p[0].timetuple()) * 1000),
                                     p[1])

        graph_heap_iod = flotgraph.Graph("graphheapiod", "right")
        graph_heap_iod.addSeries("Heap_read", "hread", '#FF0000')
        for p in data['heap_read']:
            graph_heap_iod.addPoint("hread",
                                    int(time.mktime(p[0].timetuple()) * 1000),
                                    p[1])

        graph_heap_iob = flotgraph.Graph("graphheapiob", "right")
        graph_heap_iob.addSeries("Heap_hit", "hhit")
        for p in data['heap_hit']:
            graph_heap_iob.addPoint("hhit",
                                    int(time.mktime(p[0].timetuple()) * 1000),
                                    p[1])

        tpl = tplE.env.get_template('table_detail.html')
        return tpl.render(
            name=name,
            host=host,
            interval=interval,
            hostname=hosts.getHostData()[int(host)]['settings']['uiLongName'],
            graphtablesize=graph_table_size.render(),
            graphindexsize=graph_index_size.render(),
            graphseqscans=graph_seq_scans.render(),
            graphindexscans=graph_index_scans.render(),
            graphindexiod=graph_index_iod.render(),
            graphindexiob=graph_index_iob.render(),
            graphheapiod=graph_heap_iod.render(),
            graphheapiob=graph_heap_iob.render(),
            gtupins=graph_t_ins.render(),
            gtupupd=graph_t_upd.render(),
            gtupdel=graph_t_del.render(),
            target='World')