Beispiel #1
0
def get_firehose_template(data_source: str) -> Template:
    """Get template for firehose"""

    return Template(
        name="firehose",
        query='SHOW TAG VALUES WITH KEY = "delivery_stream_name" WHERE $timeFilter',
        dataSource=data_source,
        label="Firehose",
        refresh=2,
        allValue="",
        sort=5,
        multi=True,
        includeAll=True,
        hide=0,
    )
Beispiel #2
0
 def template(self, name, frame=None, type='query', query='', **kw):
     kw['dataSource'] = getattr(kw, 'dataSource', '') or self.dataSource
     if frame and not query:
         query = frame.gen_target
     self.templates += [Template(name=name, type=type, query=query, **kw)]
     return self
from grafanalib.core import (Alert, AlertCondition, Dashboard, Graph,
                             GaugePanel, GreaterThan, OP_AND, OPS_FORMAT, Row,
                             RTYPE_SUM, SECONDS_FORMAT, PERCENT_FORMAT,
                             BYTES_FORMAT, PERCENT_UNIT_FORMAT, SHORT_FORMAT,
                             single_y_axis, Target, Template, Templating,
                             TimeRange, YAxes, YAxis)

DATASOURCE = "Chronosphere Prometheus"

Environment = Template(
    name='environment',
    label='Environment',
    query='label_values(aws_ec_cpuutilization_average, environment)',
    type='query',
    includeAll=False,
    multi=False,
)

Cluster = Template(
    name='cluster',
    label='Cluster',
    query=
    'label_values(aws_ec_curr_items_average{environment="$environment"}, dimension_cache_cluster_id)',
    type='query',
    includeAll=False,
    multi=False,
    regex='/^(.*?)(-[\d]+)*$/')

dashboard = Dashboard(
    title="SRE Elasticache Drilldowns",
    templating=Templating(list=[Environment, Cluster]),
    Dashboard,
    Graph,
    GridPos,
    Repeat,
    RowPanel,
    SHORT_FORMAT,
    Target,
    Template,
    Templating,
    YAxes,
    YAxis,
)

chip_template = Template(default="All",
                         name="chip",
                         label="Chip",
                         query="label_values(chip)",
                         includeAll=True)

template_list = [
    Template(default="",
             name="instance",
             label="Machine",
             query="label_values(instance)"),
    chip_template,
]

dashboard = Dashboard(
    title="Temperature",
    templating=Templating(template_list),
    panels=[
from grafanalib.core import Dashboard, Graph, Row, Target, Template, Templating, YAxes, YAxis
from grr_grafanalib_dashboards.util import add_data_source
from grr_grafanalib_dashboards.config import CLIENT_LOAD_STATS_DATA_SOURCE

client_id_variable = Template(name="ClientID", query="", type="textbox")

dashboard = Dashboard(
    title="Client Load Stats Dashboard",
    templating=Templating([client_id_variable]),
    rows=[
        Row(panels=[
            Graph(
                title="User CPU Usage",
                targets=[
                    Target(target='Mean User CPU Rate', ),
                    Target(target='Max User CPU Rate', ),
                ],
                yAxes=YAxes(left=YAxis(max=105, format="percent")),
            ),
            Graph(
                title="System CPU Usage",
                targets=[
                    Target(target='Mean System CPU Rate', ),
                    Target(target='Max System CPU Rate', ),
                ],
                yAxes=YAxes(left=YAxis(max=105, format="percent")),
            ),
        ]),
        Row(panels=[
            Graph(
                title="Resident Memory",
Beispiel #6
0
                ),
            ])

    @staticmethod
    def create_all_rows(interval: int) -> typing.List[Row]:
        return [
            FlyteUserDashboard.workflow_stats(False),
            FlyteUserDashboard.quota_stats(True),
            FlyteUserDashboard.resource_stats(True),
            FlyteUserDashboard.errors(True),
        ]


project_template = Template(
    name="project",
    dataSource=DATASOURCE,
    query="label_values(flyte:propeller:all:collector:flyteworkflow, project)",
    sort=True,
)

domain_template = Template(
    name="domain",
    dataSource=DATASOURCE,
    query="label_values(flyte:propeller:all:collector:flyteworkflow, domain)",
    sort=True,
)

wf_template = Template(
    name="workflow",
    dataSource=DATASOURCE,
    query="label_values(flyte:propeller:all:collector:flyteworkflow, wf)",
    sort=True,