{"id":295198,"date":"2019-11-26T09:00:21","date_gmt":"2019-11-26T09:00:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=295198"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=295198","title":{"rendered":"\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043b\u043e\u0433\u0438 \u0438\u0437 Nginx, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0432 Clickhouse \u0438 \u043e\u0442\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0432 Grafana"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/477498\/\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/mintance\/nginx-clickhouse\">nginx-clickhouse<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u043b\u043e\u0433\u0438 nginx, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u0432 clickhouse. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u043f\u043e \u043b\u043e\u0433\u0430\u043c \u0435\u0441\u0442\u044c \u0434\u0430\u0448\u0431\u043e\u0430\u0440\u0434 \u0434\u043b\u044f Grafana. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c nginx, clickhouse, grafana \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0435.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/mintance\/nginx-clickhouse\">\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 nginx-clickhouse \u043d\u0430 github<\/a><\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c rpm \u043f\u0430\u043a\u0435\u0442 nginx-clickhouse<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">yum -y install yum-plugin-copr yum copr enable antonpatsev\/nginx-clickhouse-rpm yum -y install nginx-clickhouse systemctl start nginx-clickhouse<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 HTTP \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c mockify.<\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c rpm \u043f\u0430\u043a\u0435\u0442 mockify<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">yum -y install yum-plugin-copr yum copr enable antonpatsev\/mockify-rpm yum -y install mockify systemctl start mockify<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423 nginx-clickhouse log_format \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434.<\/p>\n<p>  <\/p>\n<pre><code class=\"nginx\">log_format main '$remote_addr - $remote_user [$time_local] \"$request\" $status $bytes_sent \"$http_referer\" \"$http_user_agent\"';<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 nginx:<\/p>\n<p>  <\/p>\n<pre><code class=\"nginx\">user  nginx; worker_processes  auto; worker_rlimit_nofile 40960;  error_log  \/var\/log\/nginx\/error.log warn; pid        \/var\/run\/nginx.pid;  events {     use epoll;     worker_connections 1024;     multi_accept on; }  http {     include       \/etc\/nginx\/mime.types;     default_type  application\/octet-stream;      log_format main '$remote_addr - $remote_user [$time_local] \"$request\" $status $bytes_sent \"$http_referer\" \"$http_user_agent\"';      access_log \/var\/log\/nginx\/access.log main;      sendfile on;     tcp_nodelay on;     tcp_nopush on;     keepalive_timeout  65;      include \/etc\/nginx\/conf.d\/*.conf;     open_file_cache max=200000 inactive=20s;     open_file_cache_valid 30s;     open_file_cache_min_uses 2;     open_file_cache_errors on; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0445\u043e\u0441\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<p>vhost1.conf:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">server {         listen   80;         server_name vhost1;         location \/ {                 proxy_pass http:\/\/127.0.0.1:8001\/200;         } }<\/code><\/pre>\n<p>  <\/p>\n<p>vhost2.conf:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">server {         listen   80;         server_name vhost2;         location \/ {                 proxy_pass http:\/\/127.0.0.1:8001\/200;         } }<\/code><\/pre>\n<p>  <\/p>\n<p>vhost3.conf:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">server {         listen   80;         server_name vhost3;         location \/ {                 proxy_pass http:\/\/localhost:8001\/304;         } }<\/code><\/pre>\n<p>  <\/p>\n<p>vhost4.conf:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">server {         listen   80;         server_name vhost4;         location \/ {                 proxy_pass http:\/\/localhost:8001\/401;         } }<\/code><\/pre>\n<p>  <\/p>\n<p>vhost5.conf:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">server {         listen   80;         server_name vhost5;         location \/ {                 proxy_pass http:\/\/localhost:8001\/500;         } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b hosts \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0445\u043e\u0441\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">cat \/etc\/hosts 127.0.0.1 vhost1 127.0.0.1 vhost2 127.0.0.1 vhost3 127.0.0.1 vhost4 127.0.0.1 vhost5<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433 nginx-clickhouse \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043b\u0435\u0436\u0438\u0442 \u0432 <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">\/etc\/nginx-clickhouse\/config\/config.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0443\u0442\u044c \u0434\u043e \u043b\u043e\u0433\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435: <code>log_path:<\/code><\/p>\n<p>  <\/p>\n<p>\u0412 clickhouse \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 metrics:<\/p>\n<p>  <\/p>\n<pre><code class=\"sql\">create database metrics<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 nginx:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">CREATE TABLE metrics.nginx (     RemoteAddr String,     RemoteUser String,     TimeLocal DateTime,     Date Date DEFAULT toDate(TimeLocal),     Request String,     RequestMethod String,     Status Int32,     BytesSent Int64,     HttpReferer String,     HttpUserAgent String,     RequestTime Float32,     UpstreamConnectTime Float32,     UpstreamHeaderTime Float32,     UpstreamResponseTime Float32,     Https FixedString(2),     ConnectionsWaiting Int64,     ConnectionsActive Int64 ) ENGINE = MergeTree(Date, (Status, Date), 8192)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 Grafana \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 datasource \u0434\u043b\u044f Clickhouse \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0435\u043c\u0443 <code>ClickHouse Main Server<\/code>, \u0442.\u043a. \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0435 \u0434\u043b\u044f Grafana \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u043e\u043d \u0438\u043c\u0435\u043d\u043d\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e table \u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c <code>metrics.nginx<\/code>.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/418\/708\/ec3\/418708ec3125ab0c910ec1ed2ced1d1e.png\" alt=\"image\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 Grafana \u0432\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434. \u041e\u043d \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u043c <a href=\"https:\/\/github.com\/mintance\/nginx-clickhouse\/issues\/2\">issue<\/a>:<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043c\u043e\u0439 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u0430\u0448\u0431\u043e\u0440\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">\u200b``` {     \"editable\": true,     \"gnetId\": null,     \"graphTooltip\": 0,     \"hideControls\": false,     \"id\": 1,     \"links\": [],     \"refresh\": false,     \"rows\": [     {     \"collapse\": false,     \"height\": \"250px\",     \"panels\": [     {     \"aliasColors\": {},     \"bars\": false,     \"dashLength\": 10,     \"dashes\": false,     \"datasource\": \"ClickHouse Main Server\",     \"fill\": 1,     \"id\": 1,     \"legend\": {     \"avg\": true,     \"current\": true,     \"max\": true,     \"min\": true,     \"show\": true,     \"total\": false,     \"values\": true     },     \"lines\": true,     \"linewidth\": 1,     \"links\": [],     \"nullPointMode\": \"null\",     \"percentage\": false,     \"pointradius\": 5,     \"points\": false,     \"renderer\": \"flot\",     \"seriesOverrides\": [],     \"spaceLength\": 10,     \"span\": 12,     \"stack\": false,     \"steppedLine\": false,     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkcyan\\\"&gt;$columns&lt;\/font&gt;(Status, &lt;font color=\\\"navajowhite\\\"&gt;count&lt;\/font&gt;(&lt;font color=\\\"yellow\\\"&gt;*&lt;\/font&gt;) &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; c) &lt;font color=\\\"darkorange\\\"&gt;from&lt;\/font&gt; metrics&lt;font color=\\\"yellow\\\"&gt;.&lt;\/font&gt;nginx_streaming\",     \"hide\": false,     \"interval\": \"15s\",     \"intervalFactor\": 1,     \"query\": \"$columns(Status, count(*) as c) from metrics.nginx\",     \"rawQuery\": \"SELECT t, groupArray((Status, c)) as groupArr FROM ( SELECT (intDiv(toUInt32(TimeLocal), 15) * 15) * 1000 as t, Status, count(*) as c from metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY t, Status ORDER BY t) GROUP BY t ORDER BY t\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"thresholds\": [],     \"timeFrom\": null,     \"timeShift\": null,     \"title\": \"Streaming API Requests &amp; Response\",     \"tooltip\": {     \"shared\": true,     \"sort\": 0,     \"value_type\": \"individual\"     },     \"type\": \"graph\",     \"xaxis\": {     \"buckets\": null,     \"mode\": \"time\",     \"name\": null,     \"show\": true,     \"values\": []     },     \"yaxes\": [     {     \"decimals\": null,     \"format\": \"short\",     \"label\": \"Requests\",     \"logBase\": 1,     \"max\": null,     \"min\": null,     \"show\": true     },     {     \"format\": \"short\",     \"label\": \"\",     \"logBase\": 1,     \"max\": null,     \"min\": null,     \"show\": true     }     ]     }     ],     \"repeat\": null,     \"repeatIteration\": null,     \"repeatRowId\": null,     \"showTitle\": false,     \"title\": \"Dashboard Row\",     \"titleSize\": \"h6\"     },     {     \"collapse\": false,     \"height\": 399,     \"panels\": [     {     \"columns\": [],     \"datasource\": \"ClickHouse Main Server\",     \"fontSize\": \"100%\",     \"id\": 2,     \"links\": [],     \"pageSize\": null,     \"scroll\": true,     \"showHeader\": true,     \"sort\": {     \"col\": 0,     \"desc\": true     },     \"span\": 6,     \"styles\": [     {     \"alias\": \"Time\",     \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",     \"pattern\": \"Time\",     \"type\": \"date\"     },     {     \"alias\": \"\",     \"colorMode\": null,     \"colors\": [     \"rgba(245, 54, 54, 0.9)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(50, 172, 45, 0.97)\"     ],     \"decimals\": 2,     \"pattern\": \"\/.*\/\",     \"thresholds\": [],     \"type\": \"number\",     \"unit\": \"short\"     }     ],     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkcyan\\\"&gt;$columns&lt;\/font&gt;(Status, &lt;font color=\\\"navajowhite\\\"&gt;count&lt;\/font&gt;(&lt;font color=\\\"yellow\\\"&gt;*&lt;\/font&gt;) &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; c) &lt;font color=\\\"darkorange\\\"&gt;from&lt;\/font&gt; metrics&lt;font color=\\\"yellow\\\"&gt;.&lt;\/font&gt;nginx_streaming\",     \"hide\": false,     \"interval\": \"3600s\",     \"intervalFactor\": 1,     \"query\": \"$columns(Status, count(*) as c) from metrics.nginx\",     \"rawQuery\": \"SELECT t, groupArray((Status, c)) as groupArr FROM ( SELECT (intDiv(toUInt32(TimeLocal), 3600) * 3600) * 1000 as t, Status, count(*) as c from metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY t, Status ORDER BY t) GROUP BY t ORDER BY t\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"title\": \"Requests Stats Table\",     \"transform\": \"timeseries_to_columns\",     \"type\": \"table\"     },     {     \"aliasColors\": {},     \"bars\": false,     \"dashLength\": 10,     \"dashes\": false,     \"datasource\": \"ClickHouse Main Server\",     \"fill\": 1,     \"id\": 3,     \"legend\": {     \"avg\": false,     \"current\": false,     \"max\": false,     \"min\": false,     \"show\": true,     \"total\": false,     \"values\": false     },     \"lines\": true,     \"linewidth\": 1,     \"links\": [],     \"nullPointMode\": \"null\",     \"percentage\": false,     \"pointradius\": 5,     \"points\": false,     \"renderer\": \"flot\",     \"seriesOverrides\": [],     \"spaceLength\": 10,     \"span\": 6,     \"stack\": false,     \"steppedLine\": false,     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkcyan\\\"&gt;$rate&lt;\/font&gt;(&lt;font color=\\\"navajowhite\\\"&gt;avg&lt;\/font&gt;(RequestTime) &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; RequestTime) &lt;font color=\\\"darkorange\\\"&gt;FROM&lt;\/font&gt; metrics&lt;font color=\\\"yellow\\\"&gt;.&lt;\/font&gt;nginx_streaming\",     \"hide\": false,     \"intervalFactor\": 1,     \"query\": \"$rate(avg(RequestTime) as RequestTime) FROM metrics.nginx\",     \"rawQuery\": \"SELECT t, RequestTime\/runningDifference(t\/1000) RequestTimeRate FROM ( SELECT (intDiv(toUInt32(TimeLocal), 120) * 120) * 1000 as t, avg(RequestTime) as RequestTime FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY t ORDER BY t)\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     },     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkcyan\\\"&gt;$rate&lt;\/font&gt;(&lt;font color=\\\"navajowhite\\\"&gt;avg&lt;\/font&gt;(UpstreamResponseTime) &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; UpstreamResponseTime) &lt;font color=\\\"darkorange\\\"&gt;FROM&lt;\/font&gt; metrics&lt;font color=\\\"yellow\\\"&gt;.&lt;\/font&gt;nginx_streaming\",     \"hide\": false,     \"intervalFactor\": 1,     \"query\": \"$rate(avg(UpstreamResponseTime) as UpstreamResponseTime) FROM metrics.nginx\",     \"rawQuery\": \"SELECT t, UpstreamResponseTime\/runningDifference(t\/1000) UpstreamResponseTimeRate FROM ( SELECT (intDiv(toUInt32(TimeLocal), 120) * 120) * 1000 as t, avg(UpstreamResponseTime) as UpstreamResponseTime FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY t ORDER BY t)\",     \"refId\": \"B\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     },     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkcyan\\\"&gt;$rate&lt;\/font&gt;(&lt;font color=\\\"navajowhite\\\"&gt;avg&lt;\/font&gt;(UpstreamConnectTime) &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; UpstreamConnectTime) &lt;font color=\\\"darkorange\\\"&gt;FROM&lt;\/font&gt; metrics&lt;font color=\\\"yellow\\\"&gt;.&lt;\/font&gt;nginx_streaming\",     \"hide\": false,     \"intervalFactor\": 1,     \"query\": \"$rate(avg(UpstreamConnectTime) as UpstreamConnectTime) FROM metrics.nginx\",     \"rawQuery\": \"SELECT t, UpstreamConnectTime\/runningDifference(t\/1000) UpstreamConnectTimeRate FROM ( SELECT (intDiv(toUInt32(TimeLocal), 120) * 120) * 1000 as t, avg(UpstreamConnectTime) as UpstreamConnectTime FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY t ORDER BY t)\",     \"refId\": \"C\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"thresholds\": [],     \"timeFrom\": null,     \"timeShift\": null,     \"title\": \"Response Timing\",     \"tooltip\": {     \"shared\": true,     \"sort\": 0,     \"value_type\": \"individual\"     },     \"type\": \"graph\",     \"xaxis\": {     \"buckets\": null,     \"mode\": \"time\",     \"name\": null,     \"show\": true,     \"values\": []     },     \"yaxes\": [     {     \"format\": \"short\",     \"label\": null,     \"logBase\": 1,     \"max\": null,     \"min\": null,     \"show\": true     },     {     \"format\": \"short\",     \"label\": null,     \"logBase\": 1,     \"max\": null,     \"min\": null,     \"show\": true     }     ]     }     ],     \"repeat\": null,     \"repeatIteration\": null,     \"repeatRowId\": null,     \"showTitle\": false,     \"title\": \"Dashboard Row\",     \"titleSize\": \"h6\"     },     {     \"collapse\": false,     \"height\": 250,     \"panels\": [     {     \"cacheTimeout\": null,     \"colorBackground\": false,     \"colorValue\": false,     \"colors\": [     \"rgba(245, 54, 54, 0.9)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(50, 172, 45, 0.97)\"     ],     \"datasource\": \"ClickHouse Main Server\",     \"format\": \"none\",     \"gauge\": {     \"maxValue\": 100,     \"minValue\": 0,     \"show\": false,     \"thresholdLabels\": false,     \"thresholdMarkers\": true     },     \"id\": 4,     \"interval\": null,     \"links\": [],     \"mappingType\": 1,     \"mappingTypes\": [     {     \"name\": \"value to text\",     \"value\": 1     },     {     \"name\": \"range to text\",     \"value\": 2     }     ],     \"maxDataPoints\": 100,     \"nullPointMode\": \"connected\",     \"nullText\": null,     \"postfix\": \"\",     \"postfixFontSize\": \"50%\",     \"prefix\": \"\",     \"prefixFontSize\": \"50%\",     \"rangeMaps\": [     {     \"from\": \"null\",     \"text\": \"N\/A\",     \"to\": \"null\"     }     ],     \"span\": 2,     \"sparkline\": {     \"fillColor\": \"rgba(31, 118, 189, 0.18)\",     \"full\": false,     \"lineColor\": \"rgb(31, 120, 193)\",     \"show\": false     },     \"tableColumn\": \"\",     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkorange\\\"&gt;SELECT&lt;\/font&gt;&lt;br \/&gt;        &lt;font color=\\\"cornflowerblue\\\"&gt;1&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; t,&lt;br \/&gt;        &lt;font color=\\\"navajowhite\\\"&gt;count&lt;\/font&gt;(&lt;font color=\\\"yellow\\\"&gt;*&lt;\/font&gt;) &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; c&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;FROM&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$table&lt;\/font&gt;&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;WHERE&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$timeFilter&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;GROUP BY&lt;\/font&gt; t\",     \"intervalFactor\": 1,     \"query\": \"SELECT\\n 1 as t,\\n count(*) as c\\n FROM $table\\n WHERE $timeFilter GROUP BY t\",     \"rawQuery\": \"SELECT 1 as t, count(*) as c FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY t\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"thresholds\": \"\",     \"title\": \"Total Requests\",     \"type\": \"singlestat\",     \"valueFontSize\": \"80%\",     \"valueMaps\": [     {     \"op\": \"=\",     \"text\": \"N\/A\",     \"value\": \"null\"     }     ],     \"valueName\": \"avg\"     },     {     \"cacheTimeout\": null,     \"colorBackground\": false,     \"colorValue\": false,     \"colors\": [     \"rgba(245, 54, 54, 0.9)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(50, 172, 45, 0.97)\"     ],     \"datasource\": \"ClickHouse Main Server\",     \"format\": \"ops\",     \"gauge\": {     \"maxValue\": 100,     \"minValue\": 0,     \"show\": false,     \"thresholdLabels\": false,     \"thresholdMarkers\": true     },     \"id\": 5,     \"interval\": null,     \"links\": [],     \"mappingType\": 1,     \"mappingTypes\": [     {     \"name\": \"value to text\",     \"value\": 1     },     {     \"name\": \"range to text\",     \"value\": 2     }     ],     \"maxDataPoints\": 100,     \"nullPointMode\": \"connected\",     \"nullText\": null,     \"postfix\": \"\",     \"postfixFontSize\": \"50%\",     \"prefix\": \"\",     \"prefixFontSize\": \"50%\",     \"rangeMaps\": [     {     \"from\": \"null\",     \"text\": \"N\/A\",     \"to\": \"null\"     }     ],     \"span\": 2,     \"sparkline\": {     \"fillColor\": \"rgba(31, 118, 189, 0.18)\",     \"full\": false,     \"lineColor\": \"rgb(31, 120, 193)\",     \"show\": false     },     \"tableColumn\": \"\",     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkorange\\\"&gt;SELECT&lt;\/font&gt;&lt;br \/&gt;        &lt;font color=\\\"cornflowerblue\\\"&gt;1&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; t,&lt;br \/&gt;        &lt;font color=\\\"navajowhite\\\"&gt;count&lt;\/font&gt;(&lt;font color=\\\"yellow\\\"&gt;*&lt;\/font&gt;) &lt;font color=\\\"yellow\\\"&gt;\/&lt;\/font&gt; &lt;font color=\\\"cornflowerblue\\\"&gt;3600&lt;\/font&gt;&lt;font color=\\\"yellow\\\"&gt;*&lt;\/font&gt;&lt;font color=\\\"cornflowerblue\\\"&gt;24&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; c&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;FROM&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$table&lt;\/font&gt;&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;WHERE&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$timeFilter&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;GROUP BY&lt;\/font&gt; t\",     \"intervalFactor\": 1,     \"query\": \"SELECT\\n 1 as t,\\n count(*) \/ 3600*24 as c\\n FROM $table\\n WHERE $timeFilter GROUP BY t\",     \"rawQuery\": \"SELECT 1 as t, count(*) \/ 3600*24 as c FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY t\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"thresholds\": \"\",     \"title\": \"RPS\",     \"type\": \"singlestat\",     \"valueFontSize\": \"80%\",     \"valueMaps\": [     {     \"op\": \"=\",     \"text\": \"N\/A\",     \"value\": \"null\"     }     ],     \"valueName\": \"avg\"     },     {     \"cacheTimeout\": null,     \"colorBackground\": true,     \"colorValue\": false,     \"colors\": [     \"rgba(50, 172, 45, 0.97)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(245, 54, 54, 0.9)\"     ],     \"datasource\": \"ClickHouse Main Server\",     \"format\": \"none\",     \"gauge\": {     \"maxValue\": 100,     \"minValue\": 0,     \"show\": false,     \"thresholdLabels\": false,     \"thresholdMarkers\": true     },     \"id\": 6,     \"interval\": null,     \"links\": [],     \"mappingType\": 1,     \"mappingTypes\": [     {     \"name\": \"value to text\",     \"value\": 1     },     {     \"name\": \"range to text\",     \"value\": 2     }     ],     \"maxDataPoints\": 100,     \"nullPointMode\": \"connected\",     \"nullText\": null,     \"postfix\": \"\",     \"postfixFontSize\": \"50%\",     \"prefix\": \"\",     \"prefixFontSize\": \"50%\",     \"rangeMaps\": [     {     \"from\": \"null\",     \"text\": \"N\/A\",     \"to\": \"null\"     }     ],     \"span\": 2,     \"sparkline\": {     \"fillColor\": \"rgba(31, 118, 189, 0.18)\",     \"full\": false,     \"lineColor\": \"rgb(31, 120, 193)\",     \"show\": false     },     \"tableColumn\": \"\",     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkorange\\\"&gt;SELECT&lt;\/font&gt;&lt;br \/&gt;        &lt;font color=\\\"cornflowerblue\\\"&gt;1&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; t,&lt;br \/&gt;        &lt;font color=\\\"navajowhite\\\"&gt;count&lt;\/font&gt;(&lt;font color=\\\"yellow\\\"&gt;*&lt;\/font&gt;) &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; c&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;FROM&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$table&lt;\/font&gt;&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;WHERE&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$timeFilter&lt;\/font&gt; &lt;font color=\\\"yellow\\\"&gt;AND&lt;\/font&gt; Status &lt;font color=\\\"darkorange\\\"&gt;NOT&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;IN&lt;\/font&gt; (&lt;font color=\\\"cornflowerblue\\\"&gt;200&lt;\/font&gt;, &lt;font color=\\\"cornflowerblue\\\"&gt;201&lt;\/font&gt;, &lt;font color=\\\"cornflowerblue\\\"&gt;401&lt;\/font&gt;) &lt;font color=\\\"darkorange\\\"&gt;GROUP BY&lt;\/font&gt; t\",     \"intervalFactor\": 1,     \"query\": \"SELECT\\n 1 as t,\\n count(*) as c\\n FROM $table\\n WHERE $timeFilter AND Status NOT IN (200, 201, 401) GROUP BY t\",     \"rawQuery\": \"SELECT 1 as t, count(*) as c FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) AND Status NOT IN (200, 201, 401) GROUP BY t\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"thresholds\": \"10,20,50\",     \"title\": \"Failed Requests\",     \"type\": \"singlestat\",     \"valueFontSize\": \"80%\",     \"valueMaps\": [     {     \"op\": \"=\",     \"text\": \"N\/A\",     \"value\": \"null\"     }     ],     \"valueName\": \"avg\"     },     {     \"cacheTimeout\": null,     \"colorBackground\": true,     \"colorValue\": false,     \"colors\": [     \"rgba(50, 172, 45, 0.97)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(245, 54, 54, 0.9)\"     ],     \"datasource\": \"ClickHouse Main Server\",     \"decimals\": null,     \"format\": \"none\",     \"gauge\": {     \"maxValue\": 100,     \"minValue\": 0,     \"show\": false,     \"thresholdLabels\": false,     \"thresholdMarkers\": true     },     \"id\": 9,     \"interval\": null,     \"links\": [],     \"mappingType\": 1,     \"mappingTypes\": [     {     \"name\": \"value to text\",     \"value\": 1     },     {     \"name\": \"range to text\",     \"value\": 2     }     ],     \"maxDataPoints\": 100,     \"nullPointMode\": \"connected\",     \"nullText\": null,     \"postfix\": \"%\",     \"postfixFontSize\": \"80%\",     \"prefix\": \"\",     \"prefixFontSize\": \"50%\",     \"rangeMaps\": [     {     \"from\": \"null\",     \"text\": \"N\/A\",     \"to\": \"null\"     }     ],     \"span\": 2,     \"sparkline\": {     \"fillColor\": \"rgba(31, 118, 189, 0.18)\",     \"full\": false,     \"lineColor\": \"rgb(31, 120, 193)\",     \"show\": false     },     \"tableColumn\": \"\",     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkorange\\\"&gt;SELECT&lt;\/font&gt;&lt;br \/&gt;        &lt;font color=\\\"cornflowerblue\\\"&gt;1&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; t, (&lt;font color=\\\"navajowhite\\\"&gt;sum&lt;\/font&gt;(Status &lt;font color=\\\"yellow\\\"&gt;=&lt;\/font&gt; &lt;font color=\\\"cornflowerblue\\\"&gt;500&lt;\/font&gt; &lt;font color=\\\"yellow\\\"&gt;or&lt;\/font&gt; Status &lt;font color=\\\"yellow\\\"&gt;=&lt;\/font&gt; &lt;font color=\\\"cornflowerblue\\\"&gt;499&lt;\/font&gt;)&lt;font color=\\\"yellow\\\"&gt;\/&lt;\/font&gt;&lt;font color=\\\"navajowhite\\\"&gt;sum&lt;\/font&gt;(Status &lt;font color=\\\"yellow\\\"&gt;=&lt;\/font&gt; &lt;font color=\\\"cornflowerblue\\\"&gt;200&lt;\/font&gt; &lt;font color=\\\"yellow\\\"&gt;or&lt;\/font&gt; Status &lt;font color=\\\"yellow\\\"&gt;=&lt;\/font&gt; &lt;font color=\\\"cornflowerblue\\\"&gt;201&lt;\/font&gt; &lt;font color=\\\"yellow\\\"&gt;or&lt;\/font&gt; Status &lt;font color=\\\"yellow\\\"&gt;=&lt;\/font&gt; &lt;font color=\\\"cornflowerblue\\\"&gt;401&lt;\/font&gt;))&lt;font color=\\\"yellow\\\"&gt;*&lt;\/font&gt;&lt;font color=\\\"cornflowerblue\\\"&gt;100&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;FROM&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$table&lt;\/font&gt;&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;WHERE&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$timeFilter&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;GROUP BY&lt;\/font&gt; t\",     \"intervalFactor\": 1,     \"query\": \"SELECT\\n 1 as t, (sum(Status = 500 or Status = 499)\/sum(Status = 200 or Status = 201 or Status = 401))*100 FROM $table\\n WHERE $timeFilter GROUP BY t\",     \"rawQuery\": \"SELECT 1 as t, (sum(Status = 500 or Status = 499)\/sum(Status = 200 or Status = 201 or Status = 401))*100 FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY t\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"thresholds\": \"1,5\",     \"title\": \"Failing Prcent\",     \"type\": \"singlestat\",     \"valueFontSize\": \"80%\",     \"valueMaps\": [     {     \"op\": \"=\",     \"text\": \"N\/A\",     \"value\": \"null\"     }     ],     \"valueName\": \"current\"     },     {     \"cacheTimeout\": null,     \"colorBackground\": true,     \"colorValue\": false,     \"colors\": [     \"rgba(245, 54, 54, 0.9)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(50, 172, 45, 0.97)\"     ],     \"datasource\": \"ClickHouse Main Server\",     \"format\": \"s\",     \"gauge\": {     \"maxValue\": 100,     \"minValue\": 0,     \"show\": false,     \"thresholdLabels\": false,     \"thresholdMarkers\": true     },     \"id\": 7,     \"interval\": null,     \"links\": [],     \"mappingType\": 1,     \"mappingTypes\": [     {     \"name\": \"value to text\",     \"value\": 1     },     {     \"name\": \"range to text\",     \"value\": 2     }     ],     \"maxDataPoints\": 100,     \"nullPointMode\": \"connected\",     \"nullText\": null,     \"postfix\": \"\",     \"postfixFontSize\": \"50%\",     \"prefix\": \"\",     \"prefixFontSize\": \"50%\",     \"rangeMaps\": [     {     \"from\": \"null\",     \"text\": \"N\/A\",     \"to\": \"null\"     }     ],     \"span\": 2,     \"sparkline\": {     \"fillColor\": \"rgba(31, 118, 189, 0.18)\",     \"full\": false,     \"lineColor\": \"rgb(31, 120, 193)\",     \"show\": false     },     \"tableColumn\": \"\",     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkorange\\\"&gt;SELECT&lt;\/font&gt;&lt;br \/&gt;        &lt;font color=\\\"cornflowerblue\\\"&gt;1&lt;\/font&gt;, &lt;font color=\\\"navajowhite\\\"&gt;avg&lt;\/font&gt;(RequestTime) &lt;font color=\\\"darkorange\\\"&gt;FROM&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$table&lt;\/font&gt;&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;WHERE&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$timeFilter&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;GROUP BY&lt;\/font&gt; &lt;font color=\\\"cornflowerblue\\\"&gt;1&lt;\/font&gt;\",     \"intervalFactor\": 1,     \"query\": \"SELECT\\n 1, avg(RequestTime) FROM $table\\n WHERE $timeFilter GROUP BY 1\",     \"rawQuery\": \"SELECT 1, avg(RequestTime) FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY 1\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"thresholds\": \"0.02,0.05,0.1\",     \"title\": \"Avg Response Time\",     \"type\": \"singlestat\",     \"valueFontSize\": \"80%\",     \"valueMaps\": [     {     \"op\": \"=\",     \"text\": \"N\/A\",     \"value\": \"null\"     }     ],     \"valueName\": \"avg\"     },     {     \"cacheTimeout\": null,     \"colorBackground\": true,     \"colorValue\": false,     \"colors\": [     \"rgba(50, 172, 45, 0.97)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(245, 54, 54, 0.9)\"     ],     \"datasource\": \"ClickHouse Main Server\",     \"decimals\": null,     \"format\": \"s\",     \"gauge\": {     \"maxValue\": 100,     \"minValue\": 0,     \"show\": false,     \"thresholdLabels\": false,     \"thresholdMarkers\": true     },     \"id\": 8,     \"interval\": null,     \"links\": [],     \"mappingType\": 1,     \"mappingTypes\": [     {     \"name\": \"value to text\",     \"value\": 1     },     {     \"name\": \"range to text\",     \"value\": 2     }     ],     \"maxDataPoints\": 100,     \"nullPointMode\": \"connected\",     \"nullText\": null,     \"postfix\": \"\",     \"postfixFontSize\": \"70%\",     \"prefix\": \"\",     \"prefixFontSize\": \"50%\",     \"rangeMaps\": [     {     \"from\": \"null\",     \"text\": \"N\/A\",     \"to\": \"null\"     }     ],     \"span\": 2,     \"sparkline\": {     \"fillColor\": \"rgba(31, 118, 189, 0.18)\",     \"full\": false,     \"lineColor\": \"rgb(31, 120, 193)\",     \"show\": false     },     \"tableColumn\": \"\",     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"&lt;font color=\\\"darkorange\\\"&gt;SELECT&lt;\/font&gt;&lt;br \/&gt;        &lt;font color=\\\"cornflowerblue\\\"&gt;1&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; t, &lt;font color=\\\"navajowhite\\\"&gt;max&lt;\/font&gt;(RequestTime) &lt;font color=\\\"darkorange\\\"&gt;as&lt;\/font&gt; c&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;FROM&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$table&lt;\/font&gt;&lt;br \/&gt;    &lt;font color=\\\"darkorange\\\"&gt;WHERE&lt;\/font&gt; &lt;font color=\\\"darkcyan\\\"&gt;$timeFilter&lt;\/font&gt; &lt;font color=\\\"darkorange\\\"&gt;GROUP BY&lt;\/font&gt; t\",     \"intervalFactor\": 1,     \"query\": \"SELECT\\n 1 as t, max(RequestTime) as c\\n FROM $table\\n WHERE $timeFilter GROUP BY t\",     \"rawQuery\": \"SELECT 1 as t, max(RequestTime) as c FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) GROUP BY t\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"thresholds\": \"0.2,0.5,1\",     \"title\": \"Max Response Time\",     \"type\": \"singlestat\",     \"valueFontSize\": \"80%\",     \"valueMaps\": [     {     \"op\": \"=\",     \"text\": \"N\/A\",     \"value\": \"null\"     }     ],     \"valueName\": \"current\"     }     ],     \"repeat\": null,     \"repeatIteration\": null,     \"repeatRowId\": null,     \"showTitle\": false,     \"title\": \"Dashboard Row\",     \"titleSize\": \"h6\"     },     {     \"collapse\": false,     \"height\": \"450\",     \"panels\": [     {     \"columns\": [],     \"datasource\": \"ClickHouse Main Server\",     \"fontSize\": \"100%\",     \"id\": 11,     \"links\": [],     \"pageSize\": null,     \"scroll\": true,     \"showHeader\": true,     \"sort\": {     \"col\": 0,     \"desc\": true     },     \"span\": 8,     \"styles\": [     {     \"alias\": \"Time\",     \"dateFormat\": \"HH:mm:ss\",     \"pattern\": \"Time\",     \"type\": \"date\"     },     {     \"alias\": \"\",     \"colorMode\": null,     \"colors\": [     \"rgba(245, 54, 54, 0.9)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(50, 172, 45, 0.97)\"     ],     \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",     \"decimals\": 0,     \"pattern\": \"Status\",     \"thresholds\": [],     \"type\": \"number\",     \"unit\": \"none\"     },     {     \"alias\": \"Response Time\",     \"colorMode\": null,     \"colors\": [     \"rgba(50, 172, 45, 0.97)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(245, 54, 54, 0.9)\"     ],     \"dateFormat\": \"YYYY-MM-DD HH:mm:ss\",     \"decimals\": 2,     \"pattern\": \"RequestTime\",     \"thresholds\": [     \"50\",     \"70\",     \"100\"     ],     \"type\": \"number\",     \"unit\": \"dtdurations\"     },     {     \"alias\": \"\",     \"colorMode\": null,     \"colors\": [     \"rgba(245, 54, 54, 0.9)\",     \"rgba(237, 129, 40, 0.89)\",     \"rgba(50, 172, 45, 0.97)\"     ],     \"decimals\": 2,     \"pattern\": \"\/.*\/\",     \"thresholds\": [],     \"type\": \"number\",     \"unit\": \"short\"     }     ],     \"targets\": [     {     \"database\": \"metrics\",     \"dateColDataType\": \"Date\",     \"dateLoading\": false,     \"dateTimeColDataType\": \"TimeLocal\",     \"datetimeLoading\": false,     \"formattedQuery\": \"SELECT TimeLocal as t, Status, RequestMethod, splitByChar(' ', Request)[2] as Request, RequestTime FROM $table WHERE $timeFilter AND Status NOT IN (200, 201) AND RequestMethod != 'OPTIONS' ORDER BY t\",     \"intervalFactor\": 1,     \"query\": \"SELECT TimeLocal as t, Status, RequestMethod, splitByChar(' ', Request)[2] as Request, RequestTime FROM $table WHERE $timeFilter AND Status NOT IN (200, 201) AND RequestMethod != 'OPTIONS' ORDER BY t\",     \"rawQuery\": \"SELECT TimeLocal as t, Status, RequestMethod, splitByChar(' ', Request)[2] as Request, RequestTime FROM metrics.nginx WHERE Date &gt;= toDate(1539358595) AND TimeLocal &gt;= toDateTime(1539358595) AND Status NOT IN (200, 201) AND RequestMethod != 'OPTIONS' ORDER BY t\",     \"refId\": \"A\",     \"resultFormat\": \"time_series\",     \"table\": \"nginx_streaming\",     \"tableLoading\": false     }     ],     \"title\": \"Error Requests\",     \"transform\": \"timeseries_to_columns\",     \"type\": \"table\"     }     ],     \"repeat\": null,     \"repeatIteration\": null,     \"repeatRowId\": null,     \"showTitle\": false,     \"title\": \"Dashboard Row\",     \"titleSize\": \"h6\"     }     ],     \"schemaVersion\": 14,     \"style\": \"dark\",     \"tags\": [],     \"templating\": {     \"list\": []     },     \"time\": {     \"from\": \"now-24h\",     \"to\": \"now\"     },     \"timepicker\": {     \"refresh_intervals\": [     \"5s\",     \"10s\",     \"30s\",     \"1m\",     \"5m\",     \"15m\",     \"30m\",     \"1h\",     \"2h\",     \"1d\"     ],     \"time_options\": [     \"5m\",     \"15m\",     \"1h\",     \"6h\",     \"12h\",     \"24h\",     \"2d\",     \"7d\",     \"30d\"     ]     },     \"timezone\": \"\",     \"title\": \"Streaming API\",     \"version\": 17     } \u200b```<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Apache benchmark.<\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">yum install -y httpd-tools<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Apache benchmark \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u043e\u043b\u044f\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">while true; do ab -c 1 -n 1 -t 1 http:\/\/vhost1\/; sleep 2; done while true; do ab -c 1 -n 1 -t 1 http:\/\/vhost2\/; sleep 2; done while true; do ab -c 1 -n 1 -t 1 http:\/\/vhost3\/; sleep 2; done while true; do ab -c 1 -n 1 -t 1 http:\/\/vhost4\/; sleep 2; done while true; do ab -c 1 -n 1 -t 1 http:\/\/vhost5\/; sleep 2; done<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3m\/l7\/bv\/3ml7bvqt_5yyi8ozwczvn6rjbro.png\"><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/27\/fp\/ld\/27fpld_mwyyqlo0f7-zjaw__h6m.png\"><\/p>\n<p>  <\/p>\n<p>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0441 github \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/950\/f98\/afe\/950f98afe48bd0855a3bf416e004bfda.png\"><\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043d\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041f\u043e\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u043c\u0430\u043b\u043e\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0440\u0443\u043a\u0430\u043c\u0438, \u0442\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e\u0442 <a href=\"https:\/\/github.com\/mintance\/nginx-clickhouse\/issues\/6\">issue<\/a>.<\/p>\n<p>  <\/p>\n<p>Telegram \u043a\u0430\u043d\u0430\u043b\u044b, \u0433\u0434\u0435 \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0443\u0442:<br \/>  <a href=\"https:\/\/t.me\/clickhouse_ru\">Clickhouse<\/a><br \/>  <a href=\"https:\/\/t.me\/nginx_ru\">Nginx<\/a><br \/>  <a href=\"https:\/\/t.me\/metrics_ru\">\u0426\u0435\u0440\u043a\u043e\u0432\u044c \u043c\u0435\u0442\u0440\u0438\u043a<\/a><\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441 \u043a \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c: \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432 clickhouse, \u0442\u043e \u043a\u0430\u043a\u0438\u043c\u0438 self-hosted \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u043c\u0438\/\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u043e\u0434\u0430\u043c \u0438 \u043f\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u0445\u043e\u0441\u0442\u0430\u043c \u0441 Nginx?<\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/477498\/\"> https:\/\/habr.com\/ru\/post\/477498\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/477498\/\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/mintance\/nginx-clickhouse\">nginx-clickhouse<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u043b\u043e\u0433\u0438 nginx, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u0432 clickhouse. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u043f\u043e \u043b\u043e\u0433\u0430\u043c \u0435\u0441\u0442\u044c \u0434\u0430\u0448\u0431\u043e\u0430\u0440\u0434 \u0434\u043b\u044f Grafana. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-295198","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=295198"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295198\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=295198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=295198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=295198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}