<% set itype = "diskmanager" %>
<% set tags_filters = {"itype": "diskmanager"} %>
<% do tags_filters.update({'prj': prj}) if prj is defined %>
<% do tags_filters.update({'ctype': ctype}) if ctype is defined %>

<< suggest.add_var("hosts") >>
<< suggest.add_var("prj") >>
<< suggest.add_var("disk_limit") >>

<< suggest.set_choice_list("hosts", list_hosts(**tags_filters)) if hosts is undefined >>
<< suggest.add_choice("hosts", "ASEARCH") >>

<< suggest.set_choice_list("geo", list_geo(**tags_filters)) if geo is undefined >>
<< suggest.set_choice_list("prj", list_prj(**tags_filters)) if prj is undefined >>
<< suggest.set_choice_list("ctype", list_ctype(**tags_filters)) if ctype is undefined >>

<% set hosts = hosts|default('ASEARCH') %>
<% set disk_limit = disk_limit|default('10') %>
<% set disks = list_disk(limit=disk_limit|int, host=hosts, **tags_filters) %>

<% set tag = 'itype=' ~ (itype)
    ~ ( '; ctype=' ~ ctype if ctype is defined )
    ~ ( '; prj=' ~ prj if prj is defined )
    ~ ( '; geo=' ~ geo if geo is defined ) %>

<% set layout = create_main_layout('flow', default_width=2, default_height=1, columns=4) %>

{
    "title": "diskmanager",
    "type": "panel",
    "editors": [],
    "charts": [
        {
            "id": "loops_and_errors",
            "type": "graphic",
            << layout.coords() >>,
            "title": "fstrim loops and errors",
            "normalize": false,
            "signals": [
                {
                    "title": "fstrim errors, qty",
                    "color": "#169833",
                    "yAxis": 1,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "push-fstrim_errors_tmmm"
                },
                {
                    "title": "fstrim loops, qty",
                    "color": "#f6ab31",
                    "yAxis": 2,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "push-fstrim_loops_tmmm"
                }
            ],
            "consts": []
        },
        {
            "id": "fstrim_bytes",
            "type": "graphic",
            << layout.coords() >>,
            "title": "fstrim bytes",
            "normalize": false,
            "signals": [
                {
                    "title": "fstrim, GiB",
                    "color": "#169833",
                    "yAxis": 1,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "conv(push-fstrim_bytes_tmmm, Gi)"
                },
                {
                    "title": "fstrim scan, GiB",
                    "color": "#f6ab31",
                    "yAxis": 2,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "conv(push-fstrim_scan_bytes_tmmm, Gi)"
                }
            ],
            "consts": []
        },
        {
            "id": "remount_loop_and_errors",
            "type": "graphic",
            << layout.coords() >>,
            "title": "remount loops and errors",
            "normalize": false,
            "signals": [
                {
                    "title": "remount errors, qty",
                    "color": "#169833",
                    "yAxis": 1,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "push-remount_errors_tmmm"
                },
                {
                    "title": "remount, qty",
                    "color": "#f6ab31",
                    "yAxis": 2,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "push-remount_tmmm"
                }
            ],
            "consts": []
        },
        {
            "id": "disks",
            "type": "graphic",
            << layout.coords() >>,
            "title": "disks ready",
            "normalize": false,
            "signals": [
                {
                    "title": "disks, qty",
                    "color": "#169833",
                    "yAxis": 1,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "push-nr_disks_tmmm"
                },
                {
                    "title": "ready disks, qty",
                    "color": "#f6ab31",
                    "yAxis": 2,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "push-nr_disks_ready_tmmm"
                }
            ],
            "consts": []
        },
        {
            "id": "volumes",
            "type": "graphic",
            << layout.coords() >>,
            "title": "volumes ready",
            "normalize": false,
            "signals": [
                {
                    "title": "volumes, qty",
                    "color": "#169833",
                    "yAxis": 1,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "push-nr_volumes_tmmm"
                },
                {
                    "title": "ready volumes, qty",
                    "color": "#f6ab31",
                    "yAxis": 2,
                    "tag": "<< tag >>",
                    "host": "<< hosts >>",
                    "name": "push-nr_volumes_ready_tmmm"
                }
            ],
            "consts": []
        },
        <% do layout.skip() %>
        <% for disk in disks %>
        {
            "id": "loops_and_errors_<< disk >>",
            "type": "graphic",
            << layout.coords() >>,
            "title": "<< disk >> fstrim loops and errors",
            "normalize": false,
            "signals": [
                {
                    "title": "fstrim errors, qty",
                    "color": "#169833",
                    "yAxis": 1,
                    "tag": "<< tag >>;disk=<< disk >>",
                    "host": "<< hosts >>",
                    "name": "push-fstrim_errors_tmmm"
                },
                {
                    "title": "fstrim loops, qty",
                    "color": "#f6ab31",
                    "yAxis": 2,
                    "tag": "<< tag >>;disk=<< disk >>",
                    "host": "<< hosts >>",
                    "name": "push-fstrim_loops_tmmm"
                }
            ],
            "consts": []
        },
        {
            "id": "fstrim_bytes_<< disk >>",
            "type": "graphic",
            << layout.coords() >>,
            "title": "<< disk >> fstrim bytes",
            "normalize": false,
            "signals": [
                {
                    "title": "fstrim, GiB",
                    "color": "#169833",
                    "yAxis": 1,
                    "tag": "<< tag >>;disk=<< disk >>",
                    "host": "<< hosts >>",
                    "name": "conv(push-fstrim_bytes_tmmm, Gi)"
                },
                {
                    "title": "fstrim scan, GiB",
                    "color": "#f6ab31",
                    "yAxis": 2,
                    "tag": "<< tag >>;disk=<< disk >>",
                    "host": "<< hosts >>",
                    "name": "conv(push-fstrim_scan_bytes_tmmm, Gi)"
                }
            ],
            "consts": []
        },
        <% endfor %>
    ]
}
