def dashboard_row_nginx(panel_id, node):
    queries_through = []
    queries_conn = []
    queries_timing = []

    for measurement in [
        'accepted',
        'handled',
        'requests',
    ]:
        queries_through.append({
            'groupBy': [
                {'type': 'time', 'params': ['$__interval']},
                {'type': 'fill', 'params': ['linear']},
            ],
            'orderByTime': "ASC",
            'policy': "default",
            'query': f"""from(bucket: "telegraf")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) =>
        r["_measurement"] == "nginx" and
        r["_field"] == "{measurement}" and
        r["host"] == "{node.name}"
    )
    |> derivative(unit: 1s)
    |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
    |> yield(name: "{measurement}")""",
            'resultFormat': 'time_series',
            'select': [[
                {'type': 'field', 'params': ['value']},
                {'type': 'mean', 'params': []},
            ]],
            "tags": []
        })

    for measurement in [
        'active',
        'reading',
        'writing',
        'waiting',
    ]:
        queries_conn.append({
            'groupBy': [
                {'type': 'time', 'params': ['$__interval']},
                {'type': 'fill', 'params': ['linear']},
            ],
            'orderByTime': "ASC",
            'policy': "default",
            'query': f"""from(bucket: "telegraf")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) =>
        r["_measurement"] == "nginx" and
        r["_field"] == "{measurement}" and
        r["host"] == "{node.name}"
    )
    |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
    |> yield(name: "{measurement}")""",
            'resultFormat': 'time_series',
            'select': [[
                {'type': 'field', 'params': ['value']},
                {'type': 'mean', 'params': []},
            ]],
            "tags": []
        })

    for measurement in [
        'request_time',
        'upstream_response_time',
    ]:
        queries_timing.append({
            'groupBy': [
                {'type': 'time', 'params': ['$__interval']},
                {'type': 'fill', 'params': ['linear']},
            ],
            'orderByTime': "ASC",
            'policy': "default",
            'query': f"""from(bucket: "telegraf")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) =>
        r["_measurement"] == "nginx_timing" and
        r["_field"] == "{measurement}" and
        r["host"] == "{node.name}"
    )
    |> map(fn: (r) => ({{
            r with
            _field: "{measurement}"
        }})
    )
    |> group(columns: ["path", "_field"])
    |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
    |> yield(name: "{measurement}")""",
            'resultFormat': 'time_series',
            'select': [[
                {'type': 'field', 'params': ['value']},
                {'type': 'mean', 'params': []},
            ]],
            "tags": []
        })

    return {
        'title': 'nginx',
        'collapse': False,
        'editable': False,
        'height': '250px',
        'panels': [
            {
                'aliasColors': {},
                'bars': False,
                'dashLength': 10,
                'dashes': False,
                'datasource': None,
                'fieldConfig': {
                    'defaults': {
                        'displayName': '${__field.name}'
                    },
                    'overrides': []
                },
                'fill': 1,
                'fillGradient': 0,
                'hiddenSeries': False,
                'id': next(panel_id),
                'legend': {
                    'alignAsTable': False,
                    'avg': False,
                    'current': False,
                    'max': False,
                    'min': False,
                    'rightSide': False,
                    'show': True,
                    'total': False,
                    'values': False
                },
                'lines': True,
                'linewidth': 1,
                'NonePointMode': 'None',
                'options': {
                    'alertThreshold': True
                },
                'percentage': False,
                'pluginVersion': '7.5.5',
                'pointradius': 2,
                'points': False,
                'renderer': 'flot',
                'seriesOverrides': [],
                'spaceLength': 10,
                'span': 6,
                'stack': True,
                'steppedLine': False,
                'targets': queries_conn,
                'thresholds': [],
                'timeRegions': [],
                'title': 'nginx connections',
                'tooltip': {
                    'shared': True,
                    'sort': 0,
                    'value_type': 'individual'
                },
                'type': 'graph',
                'xaxis': {
                    'buckets': None,
                    'mode': 'time',
                    'name': None,
                    'show': True,
                    'values': []
                },
                'yaxes': [
                    {
                        'format': 'short',
                        'label': None,
                        'logBase': 1,
                        'max': None,
                        'min': 0,
                        'show': True,
                        'decimals': 0,
                    },
                    {
                        'format': 'short',
                        'label': None,
                        'logBase': 1,
                        'max': None,
                        'min': None,
                        'show': False,
                    }
                ],
                'yaxis': {
                    'align': False,
                    'alignLevel': None
                }
            },
            {
                'aliasColors': {},
                'bars': False,
                'dashLength': 10,
                'dashes': False,
                'datasource': None,
                'fieldConfig': {
                    'defaults': {
                        'displayName': '${__field.name}'
                    },
                    'overrides': []
                },
                'fill': 1,
                'fillGradient': 0,
                'hiddenSeries': False,
                'id': next(panel_id),
                'legend': {
                    'alignAsTable': False,
                    'avg': False,
                    'current': False,
                    'max': False,
                    'min': False,
                    'rightSide': False,
                    'show': True,
                    'total': False,
                    'values': False
                },
                'lines': True,
                'linewidth': 1,
                'NonePointMode': 'None',
                'options': {
                    'alertThreshold': True
                },
                'percentage': False,
                'pluginVersion': '7.5.5',
                'pointradius': 2,
                'points': False,
                'renderer': 'flot',
                'seriesOverrides': [],
                'spaceLength': 10,
                'span': 6,
                'stack': True,
                'steppedLine': False,
                'targets': queries_through,
                'thresholds': [],
                'timeRegions': [],
                'title': 'nginx throughput',
                'tooltip': {
                    'shared': True,
                    'sort': 0,
                    'value_type': 'individual'
                },
                'type': 'graph',
                'xaxis': {
                    'buckets': None,
                    'mode': 'time',
                    'name': None,
                    'show': True,
                    'values': []
                },
                'yaxes': [
                    {
                        'format': 'short',
                        'label': None,
                        'logBase': 1,
                        'max': None,
                        'min': 0,
                        'show': True,
                        'decimals': 0,
                    },
                    {
                        'format': 'short',
                        'label': None,
                        'logBase': 1,
                        'max': None,
                        'min': None,
                        'show': False,
                    }
                ],
                'yaxis': {
                    'align': False,
                    'alignLevel': None
                }
            },
            {
                'aliasColors': {},
                'bars': False,
                'dashLength': 10,
                'dashes': False,
                'datasource': None,
                'fieldConfig': {
                    'defaults': {
                        'displayName': '${__field.name} ${__field.labels.path}'
                    },
                    'overrides': []
                },
                'fill': 0,
                'fillGradient': 0,
                'hiddenSeries': False,
                'id': next(panel_id),
                'legend': {
                    'alignAsTable': True,
                    'avg': False,
                    'current': False,
                    'max': False,
                    'min': False,
                    'rightSide': True,
                    'show': True,
                    'total': False,
                    'values': False
                },
                'lines': False,
                'linewidth': 1,
                'NonePointMode': 'None',
                'options': {
                    'alertThreshold': True
                },
                'percentage': False,
                'pluginVersion': '7.5.5',
                'pointradius': 2,
                'points': True,
                'renderer': 'flot',
                'seriesOverrides': [],
                'spaceLength': 10,
                'span': 12,
                'stack': False,
                'steppedLine': False,
                'targets': queries_timing,
                'thresholds': [
                    {
                        'colorMode': 'warning',
                        'fill': False,
                        'line': True,
                        'op': 'gt',
                        'value': 5,
                        'yaxis': 'left'
                    },
                    {
                        'colorMode': 'critical',
                        'fill': False,
                        'line': True,
                        'op': 'gt',
                        'value': 15,
                        'yaxis': 'left'
                    }
                ],
                'timeRegions': [],
                'title': 'nginx timing',
                'tooltip': {
                    'shared': True,
                    'sort': 0,
                    'value_type': 'individual'
                },
                'type': 'graph',
                'xaxis': {
                    'buckets': None,
                    'mode': 'time',
                    'name': None,
                    'show': True,
                    'values': []
                },
                'yaxes': [
                    {
                        'format': 's',
                        'label': 'request time',
                        'logBase': 1,
                        'max': None,
                        'min': 0,
                        'show': True,
                        'decimals': 0,
                    },
                    {
                        'format': 'short',
                        'label': None,
                        'logBase': 1,
                        'max': None,
                        'min': None,
                        'show': False,
                    }
                ],
                'yaxis': {
                    'align': False,
                    'alignLevel': None
                }
            },
        ],
    }