{
  "tags": [],
  "title": "Nginx",
  "widgets": [
    {
      "layout": {
        "x": 0,
        "y": 0,
        "width": 12,
        "height": 4
      },
      "definition": {
        "type": "group",
        "title": "General Metrics",
        "widgets": [
          {
            "layout": {
              "x": 0,
              "y": 0,
              "width": 7,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "CPU Usage",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:system.cpu.idle{host:$instance.value*} by {host}",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "100 - query1"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 7,
              "y": 0,
              "width": 2,
              "height": 2
            },
            "definition": {
              "type": "query_value",
              "title": "Current CPU Utilization %",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:system.cpu.idle{host:$instance.value*} by {host}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "100 - query1"
                    }
                  ],
                  "response_format": "scalar",
                  "conditional_formats": [
                    {
                      "value": 80,
                      "palette": "white_on_red",
                      "comparator": ">="
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center"
            }
          },
          {
            "layout": {
              "x": 9,
              "y": 0,
              "width": 3,
              "height": 2
            },
            "definition": {
              "type": "query_value",
              "title": "Current Memory Utilization",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "sum:system.mem.used{$instance}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1 * 1048576"
                    }
                  ],
                  "response_format": "scalar",
                  "conditional_formats": [
                    {
                      "value": 80,
                      "palette": "white_on_red",
                      "comparator": ">="
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center",
              "custom_unit": "B",
              "timeseries_background": {
                "type": "area"
              }
            }
          },
          {
            "layout": {
              "x": 0,
              "y": 2,
              "width": 6,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Network Input",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:system.net.bytes_rcvd{*}",
                      "data_source": "metrics"
                    },
                    {
                      "name": "query2",
                      "query": "avg:net_conntrack_listener_conn_accepted.count{*}.as_rate()",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "alias": "net_bytes_recv",
                      "formula": "query1"
                    },
                    {
                      "alias": "net_conn_accepted",
                      "formula": "query2"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 6,
              "y": 2,
              "width": 6,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Network Ouput",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:system.net.bytes_sent{*}",
                      "data_source": "metrics"
                    },
                    {
                      "name": "query2",
                      "query": "avg:net_conntrack_listener_conn_accepted.count{*}.as_rate()",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "alias": "net_bytes_sent",
                      "formula": "query1"
                    },
                    {
                      "alias": "net_conn_accepted",
                      "formula": "query2"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          }
        ],
        "show_title": true,
        "layout_type": "ordered"
      }
    },
    {
      "layout": {
        "x": 0,
        "y": 4,
        "width": 12,
        "height": 6
      },
      "definition": {
        "type": "group",
        "title": "Nginx Requests Status Code",
        "widgets": [
          {
            "layout": {
              "x": 0,
              "y": 0,
              "width": 8,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Response 2XX / 5m",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginxlog_resp_bytes{instance:$instance.value*,resp_code:20*} by {request}.rollup(sum, 300)",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 8,
              "y": 0,
              "width": 4,
              "height": 2
            },
            "definition": {
              "type": "toplist",
              "title": "Total Response 200 Req. [24h]",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginxlog_resp_bytes{instance:$instance.value*,resp_code:200} by {request}.rollup(sum, 86400)",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "limit": {
                        "count": 10,
                        "order": "desc"
                      },
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar"
                }
              ]
            }
          },
          {
            "layout": {
              "x": 0,
              "y": 2,
              "width": 8,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Response 4XX  /5m",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginxlog_resp_bytes{instance:$instance.value*,resp_code:40*} by {request}.rollup(sum, 300)",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 8,
              "y": 2,
              "width": 4,
              "height": 2
            },
            "definition": {
              "type": "toplist",
              "title": "Total Response 404 Req. [24h]",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginxlog_resp_bytes{instance:$instance.value*,resp_code:404} by {request}.rollup(sum, 300)",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "limit": {
                        "count": 10,
                        "order": "desc"
                      },
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar"
                }
              ]
            }
          },
          {
            "layout": {
              "x": 0,
              "y": 4,
              "width": 4,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Response 3XX",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginxlog_resp_bytes{instance:$instance.value*,resp_code:30*} by {instance}.rollup(sum, 300)",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 4,
              "y": 4,
              "width": 5,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Response 5XX",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginxlog_resp_bytes{instance:$instance.value*,resp_code:50*} by {instance}.rollup(sum, 300)",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 9,
              "y": 4,
              "width": 3,
              "height": 2
            },
            "definition": {
              "type": "query_value",
              "title": "Total Request 503 Resonse",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginxlog_resp_bytes{instance:$instance.value*,resp_code:503} by {request}.rollup(sum, 300)",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar"
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center",
              "timeseries_background": {
                "type": "area"
              }
            }
          }
        ],
        "show_title": true,
        "layout_type": "ordered"
      }
    },
    {
      "layout": {
        "x": 0,
        "y": 10,
        "width": 12,
        "height": 8
      },
      "definition": {
        "type": "group",
        "title": "Nginx Metrics",
        "widgets": [
          {
            "layout": {
              "x": 0,
              "y": 0,
              "width": 4,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Nginx Connections Accepted",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "markers": [
                {
                  "value": "y = 80",
                  "display_type": "error dashed"
                }
              ],
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginx.net.conn_opened_per_s{host:$instance.value*} by {host}",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 4,
              "y": 0,
              "width": 2,
              "height": 2
            },
            "definition": {
              "type": "query_value",
              "title": "Nginx Writing",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginx.net.writing{host:$instance.value*} by {host}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar",
                  "conditional_formats": [
                    {
                      "value": 80,
                      "palette": "white_on_red",
                      "comparator": ">="
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center"
            }
          },
          {
            "layout": {
              "x": 6,
              "y": 0,
              "width": 4,
              "height": 2
            },
            "definition": {
              "type": "toplist",
              "title": "Nginx Active Connections[accepted]",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginx.net.connections{host:$instance.value*} by {host}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "limit": {
                        "count": 10,
                        "order": "desc"
                      },
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar"
                }
              ]
            }
          },
          {
            "layout": {
              "x": 10,
              "y": 0,
              "width": 2,
              "height": 2
            },
            "definition": {
              "type": "query_value",
              "title": "Nginx Waiting Connections",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginx.net.waiting{host:$instance.value*} by {host}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar",
                  "conditional_formats": [
                    {
                      "value": 80,
                      "palette": "white_on_red",
                      "comparator": ">="
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center",
              "timeseries_background": {
                "type": "area"
              }
            }
          },
          {
            "layout": {
              "x": 0,
              "y": 2,
              "width": 5,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Handled Request",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "markers": [
                {
                  "value": "y = 80",
                  "display_type": "error dashed"
                }
              ],
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginx.net.conn_opened_per_s{host:$instance.value*} by {host}",
                      "data_source": "metrics"
                    },
                    {
                      "name": "query2",
                      "query": "avg:nginx.net.conn_dropped_per_s{host:$instance.value*} by {host}",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1 - query2"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 5,
              "y": 2,
              "width": 5,
              "height": 2
            },
            "definition": {
              "type": "timeseries",
              "title": "Nginx Requests",
              "yaxis": {
                "max": "auto",
                "min": "auto",
                "label": "",
                "scale": "linear",
                "include_zero": true
              },
              "markers": [
                {
                  "value": "y = 80",
                  "display_type": "error dashed"
                }
              ],
              "requests": [
                {
                  "style": {
                    "palette": "dog_classic",
                    "line_type": "solid",
                    "line_width": "normal"
                  },
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginx.net.request_per_s{host:$instance.value*} by {host}",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "display_type": "area",
                  "response_format": "timeseries"
                }
              ],
              "show_legend": true,
              "legend_layout": "auto",
              "legend_columns": [
                "avg",
                "min",
                "max",
                "value",
                "sum"
              ]
            }
          },
          {
            "layout": {
              "x": 10,
              "y": 2,
              "width": 2,
              "height": 2
            },
            "definition": {
              "type": "query_value",
              "title": "nginx_reading",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginx.net.reading{host:$instance.value*} by {host}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar",
                  "conditional_formats": [
                    {
                      "value": 80,
                      "palette": "white_on_red",
                      "comparator": ">="
                    }
                  ]
                }
              ],
              "autoscale": true,
              "precision": 2,
              "text_align": "center"
            }
          },
          {
            "layout": {
              "x": 0,
              "y": 4,
              "width": 12,
              "height": 4
            },
            "definition": {
              "type": "query_table",
              "title": "Each Request Detail",
              "requests": [
                {
                  "queries": [
                    {
                      "name": "query1",
                      "query": "avg:nginxlog_resp_bytes{instance:$instance.value*} by {instance,request,resp_code}",
                      "aggregator": "last",
                      "data_source": "metrics"
                    }
                  ],
                  "formulas": [
                    {
                      "limit": {
                        "count": 50,
                        "order": "desc"
                      },
                      "formula": "query1"
                    }
                  ],
                  "response_format": "scalar"
                }
              ],
              "has_search_bar": "auto"
            }
          }
        ],
        "show_title": true,
        "layout_type": "ordered"
      }
    }
  ],
  "description": "Converted from Grafana dashboard https://grafana.com/grafana/dashboards/14900 (by opstreedevops). Grafana Dashboard for Nginx Web Server.",
  "layout_type": "ordered",
  "reflow_type": "fixed",
  "template_variables": [
    {
      "name": "instance",
      "prefix": "host",
      "default": "*",
      "available_values": []
    }
  ]
}