{"id":32681,"date":"2019-10-31T21:48:22","date_gmt":"2019-10-31T18:48:22","guid":{"rendered":"https:\/\/prohoster.info\/blog\/statistika-i-monitoring-php-skriptov-v-realnom-vremeni-clickhouse-i-grafana-idut-na-pomoshh-k-pinba\/"},"modified":"2019-10-31T21:48:22","modified_gmt":"2019-10-31T18:48:22","slug":"statistika-i-monitoring-php-skriptov-v-realnom-vremeni-clickhouse-i-grafana-idut-na-pomoshh-k-pinba","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/statistika-i-monitoring-php-skriptov-v-realnom-vremeni-clickhouse-i-grafana-idut-na-pomoshh-k-pinba","title":{"rendered":"Statistics and monitoring of PHP scripts in real-time. ClickHouse and Grafana come to the aid of Pinba","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>In this article, I will explain how to use Pinba alongside ClickHouse and Grafana instead of pinba_engine and pinboard.<\/p>\n<p>On a PHP project, Pinba is probably the only reliable way to understand what is happening with performance. However, it is usually implemented only when problems are observed and it's unclear where to dig.<\/p>\n<p>Often, no one has any idea how many times per second\/minute a particular script is called, and optimization starts 'by touch', beginning with the areas that seem more logical.<\/p>\n<p>Some analyze nginx logs, while others look at slow database queries.<\/p>\n<p>Of course, Pinba wouldn't be unnecessary, but there are several reasons why it is far from being present on every project.<\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/habrastorage.org\/webt\/br\/zm\/qz\/brzmqzc8itwc2lt3gjp0q2p-kse.png\"><img decoding=\"async\" alt=\"Statistics and monitoring of PHP scripts in real-time. ClickHouse and Grafana come to the aid of Pinba\" src=\"\/wp-content\/uploads\/2019\/04\/cdf2dc9af2a131d1f9aaef6bbde9b914.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nAnd the first reason is installation.<\/p>\n<p>To get some meaningful output from implementing Pinba, it's very desirable to see metrics not only for the last few minutes but also over a longer period (from days to months).<\/p>\n<p>For this, you need to:<\/p>\n<ul>\n<li>install the extension for PHP (and you might want a module for nginx)<\/li>\n<li>compile the extension for MySQL<\/li>\n<li>install Pinboard and set up cron<\/li>\n<\/ul>\n<p>\nDue to the limited information about Pinba, many have the impression that it only worked on PHP5 and has long been consigned to the past, but as we will see further, this is not the case.<\/p>\n<p>The first step is the simplest; you just need to execute the command:<\/p>\n<pre><code class=\"bash\">apt install php-pinba<\/code><\/pre>\n<p>\nThis extension is available in repositories up to PHP 7.3 inclusive, and you don't need to compile anything.<\/p>\n<p>After executing the installation command, we instantly get a working extension that collects and sends metrics for each script (execution duration, memory, etc.) in the format <noindex><a rel=\"nofollow\" href=\"https:\/\/ru.wikipedia.org\/wiki\/Protocol_Buffers\">protobuf<\/a><\/noindex> via UDP to 127.0.0.1:30002.<\/p>\n<p>These UDP packets are currently not being captured or processed by anyone, but this does not negatively affect the speed or stability of your PHP scripts.<\/p>\n<p>Until recently, the only application that could capture and process these UDP packets was <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tony2001\/pinba_engine\">pinba_engine<\/a><\/noindex>. Description &#171;<noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/tony2001\/pinba_engine\/wiki\/Installation\">simple and concise<\/a><\/noindex>&#187; installations dampen the desire to ever read and understand it again. The lengthy lists of dependencies contain both package names and program titles, along with links to individual installation pages, which in turn have their own links to other dependencies. No one has either the time or the desire to deal with this nonsense.<\/p>\n<p>Installation Process <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/badoo\/pinba2\">pinba2<\/a><\/noindex> did not become <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/badoo\/pinba2\/blob\/master\/docs\/index.md#installation\">particularly easier<\/a><\/noindex>.<\/p>\n<p>Perhaps one day, pinba10 can be installed with just one or two commands without having to read a ton of material to understand how to do it, but for now, that is not the case.<\/p>\n<p>If you have installed pinba_engine, that is only half the job. Without <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/intaro\/pinboard\">pinboard<\/a><\/noindex> , you will be limited to data for only the last few minutes or will have to aggregate, save, and visualize the data yourself. Fortunately, pinboard is quite simple to <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/intaro\/pinboard\/wiki\/Installation\">install<\/a><\/noindex>.<\/p>\n<p>It might seem frustrating, because all metrics from PHP are already sent to the UDP port in protobuf format, and all that is needed is to write an application to catch them and store them somewhere. Apparently, those developers who had this thought immediately sat down to write their own solutions, some of which ended up on GitHub.<\/p>\n<p>Next is a review of four open-source projects that save metrics in storages from which this data can be easily retrieved and visualized, for example, using Grafana.<\/p>\n<h4><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/olegfedoseev\/pinba-server\">olegfedoseev\/pinba-server<\/a><\/noindex> (November 2017) <\/h4>\n<p>\na UDP server in Go that saves metrics in OpenTSDB. If OpenTSDB is already being used in your project, this solution might work for you; otherwise, I recommend passing it by.<\/p>\n<h4><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/olegfedoseev\/pinba-influxdb\">olegfedoseev\/pinba-influxdb<\/a><\/noindex> (June 2018)<\/h4>\n<p>\na UDP server in Go from the same <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/users\/Aryoh\/\">Habr user<\/a><\/noindex>, which this time saves metrics in InfluxDB. Many projects are already using InfluxDB for monitoring, so this solution could work well for them.<\/p>\n<p>Pros:<\/p>\n<ul>\n<li>InfluxDB <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/olegfedoseev\/pinba-influxdb#influxdb-preparation\">, rather than taking focus.<\/a><\/noindex> aggregate the received metrics while deleting the original after a specified time.<\/li>\n<\/ul>\n<p>\nCons:<\/p>\n<ul>\n<li>this solution does not save information based on timers.<\/li>\n<li>InfluxDB will save page addresses as tags, and if you have many unique page addresses, it will lead to <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/449352\/#comment_20085878\">increased memory usage.<\/a><\/noindex> of RAM. At some point, it &#171;<noindex><a rel=\"nofollow\" href=\"https:\/\/habrastorage.org\/webt\/2v\/68\/th\/2v68thch8ajln7abt-ghsmsbxgs.png\">start consuming memory excessively<\/a><\/noindex>&#171;. (<noindex><a rel=\"nofollow\" href=\"https:\/\/medium.com\/@valyala\/insert-benchmarks-with-inch-influxdb-vs-victoriametrics-e31a41ae2893\">source<\/a><\/noindex>)<\/li>\n<\/ul>\n<p><\/p>\n<h4><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/ClickHouse-Ninja\/Proton\">ClickHouse-Ninja\/Proton<\/a><\/noindex> (January 2019) <\/h4>\n<p>\nUDP server in Go that saves metrics to ClickHouse. This solution is from my friend. After getting acquainted with it, I decided it was time to tackle Pinba and ClickHouse.<\/p>\n<p>Pros:<\/p>\n<ul>\n<li>ClickHouse is perfect for such tasks; it allows compressing data to the extent that you can store all raw data even without aggregations.<\/li>\n<li>If needed, you can easily aggregate the received metrics.<\/li>\n<li>Ready template for Grafana.<\/li>\n<li>Saves information by timers.<\/li>\n<\/ul>\n<p>\nCons:<\/p>\n<ul>\n<li><noindex><a rel=\"nofollow\" href=\"http:\/\/lurkmore.to\/%D0%A4%D0%B0%D1%82%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%BD%D0%B5%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D1%82%D0%BE%D0%BA\">Fatal flaw.<\/a><\/noindex><\/li>\n<li>There is no configuration in which you can set the database name and tables, server address, and port.<\/li>\n<li>When saving raw data, a helper dictionary table is used to store page addresses and domains, which complicates queries later on.<\/li>\n<li>Other minor issues stemming from the first drawback.<\/li>\n<\/ul>\n<p><\/p>\n<h4><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/pinba-server\/pinba-server\">pinba-server\/pinba-server<\/a><\/noindex> (April 2019) <\/h4>\n<p>\nUDP server in PHP that saves metrics to ClickHouse. This is my solution, resulting from my acquaintance with Pinba, ClickHouse, and Protobuf. While figuring out this entire system, I wrote a 'proof of concept' that unexpectedly consumed minimal resources (30 MB of RAM and less than 1% of one of the eight CPU cores), so I decided to share it with the public.<\/p>\n<p>Pros \u2014 the same as the previous solution; I also used familiar names from the original pinba_engine. I added a configuration that allows launching multiple instances of the Pinba server to save metrics in different tables \u2014 this is useful if you want to collect data not only from PHP but also from Nginx.<br \/>\nCons \u2014 'fatal flaw' and those minor issues that may not suit you personally, but my solution is 'as simple as a slipper' and consists of only about 100 lines of code, so any PHP developer can change what they don't like in a couple of minutes.<\/p>\n<p><b>Operating principle<\/b><\/p>\n<p>Listening on UDP port 30002. All incoming packets are decoded according to the Protobuf schema and aggregated. Once a minute, a batch is inserted into ClickHouse in the pinba.requests table. (All parameters are configured in the <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/pinba-server\/pinba-server\/blob\/master\/config.json\">configuration file<\/a><\/noindex>)<\/p>\n<p><b>A bit about ClickHouse<\/b><\/p>\n<p>ClickHouse supports various data storage engines. The most frequently used is MergeTree. <\/p>\n<p>If at any point you decide to store aggregated data over time while keeping only raw data from the last period, you can create a materialized view with grouping and periodically clean the main table pinba.requests, while all data will remain in the materialized view. Moreover, when creating the pinba.requests table, you can specify \"engine = Null,\" so the raw data will not be saved to disk at all, yet it will still be included in the materialized view and stored aggregated. I use this scheme for nginx metrics because I have 50 times more requests on nginx than on php.<\/p>\n<p>So, you have come a long way, and I wouldn\u2019t want to leave you halfway, so what follows is a detailed description of the installation and configuration of my solution and everything you will need, as well as the pitfalls that have sunk more than one ship. The entire installation process is described for Ubuntu 18.04 LTS and Centos 7; the process may vary slightly on other distributions and versions.<\/p>\n<h4>Installation<\/h4>\n<p>\nI have compiled all the necessary commands in <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/pinba-server\/pinba-server\/tree\/master\/docker\">Dockerfile<\/a><\/noindex> to facilitate the reproducibility of the instructions. Below, only the pitfalls will be described.<\/p>\n<p><b>php-pinba<\/b><\/p>\n<p>After installation, ensure that all options are uncommented in the file \/etc\/php\/7.2\/fpm\/conf.d\/20-pinba.ini. In some distributions (for example, Centos), they may be commented out.<\/p>\n<pre><code class=\"plaintext\">extension=pinba.so\npinba.enabled=1\npinba.server=127.0.0.1:30002<\/code><\/pre>\n<p>\n<b>clickhouse<\/b><\/p>\n<p>During the installation, ClickHouse will prompt you to set a password for the default user. By default, this user is accessible from all IPs, so if you do not have a firewall on the server, be sure to set a password for it. This can also be done after installation in the file \/etc\/clickhouse-server\/users.xml.<\/p>\n<p>It's also worth noting that ClickHouse uses several ports, including 9000. This port is also used for PHP-FPM in some distributions (for example, Centos). If this port is already in use, you can change it to another one in the file \/etc\/clickhouse-server\/config.xml.<\/p>\n<p><b>grafana with clickhouse plugin<\/b><\/p>\n<p>After installing Grafana, use the login admin and the password admin. Upon the first login, Grafana will prompt you to set a new password.<\/p>\n<p>Next, go to the menu &#171;+&#187; -&gt; import and specify the dashboard number for import <noindex><a rel=\"nofollow\" href=\"https:\/\/grafana.com\/dashboards\/10011\">10011<\/a><\/noindex>. This dashboard I prepared and uploaded so you wouldn't have to create it yourself again.<\/p>\n<p>Grafana supports working with ClickHouse via a third-party plugin, but alerts for third-party plugins do not work in Grafana (this ticket has been open for several years).<\/p>\n<p><b>pinba-server<\/b><\/p>\n<p>Installing protobuf and libevent is not mandatory, but it improves the performance of pinba-server. If you install pinba-server in a folder other than \/opt, you will also need to tweak the <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/pinba-server\/pinba-server\/blob\/master\/systemd\/pinba-server.service\">systemd script<\/a><\/noindex> file.<\/p>\n<p><b>pinba module for nginx<\/b><\/p>\n<p>To compile the module, you need the source code of the same version of nginx that is already installed on your server, as well as the same compilation options, otherwise the build will be successful but connecting the module will yield an error stating that \"the module is not binary compatible.\" You can view the compilation options using the command nginx -V.<\/p>\n<p><b>Life Hacks<\/b><\/p>\n<p>All my websites operate exclusively over https. The schema field becomes meaningless, so I use it to separate web\/console.<\/p>\n<p>In scripts that are accessible from the web, I use:<\/p>\n<pre><code class=\"php\">if (ini_get('pinba.enabled')) {\n    pinba_schema_set('web');\n}\n<\/code><\/pre>\n<p>\nAnd in console scripts (e.g., cron scripts):<\/p>\n<pre><code class=\"php\">if (ini_get('pinba.enabled')) {\n    pinba_schema_set('console');\n}<\/code><\/pre>\n<p>\nIn my Grafana dashboard, there is a toggle for web\/console to view statistics separately.<\/p>\n<p>Tags can also be passed in pinba, for example:<\/p>\n<pre><code class=\"php\">pinba_tag_set('country', $countryCode);<\/code><\/pre>\n<p>\n<b>That's all. <\/b><\/p>\n<p>Please respond to the surveys below the article.<\/p>\n<p>I traditionally warn that I do not consult or help through personal messages on Habra or social networks.<\/p>\n<p>Open a ticket on GitHub.<\/p>\n<p>Also, please support with likes <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/en\/post\/449818\/\">the English version<\/a><\/noindex> of this article <noindex><a rel=\"nofollow\" href=\"https:\/\/www.reddit.com\/r\/PHP\/comments\/bigszu\/statistics_and_monitoring_of_php_scripts_in_real\/\">on Reddit<\/a><\/noindex>.<\/p>\n<p class=\"for_users_only_msg\">Only registered users can participate in the survey. <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/auth\/login\/\">Please log in<\/a><\/noindex>, please.<\/p>\n<h2 class=\"default-block__polling-title\">Which OS are you using on the server?<\/h2>\n<ul class=\"content-list content-list_polling\">\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Ubuntu<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    CentOS<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Debian<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Gentoo<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Red Hat<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Alpine<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    OpenSUSE<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    SuSE<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Unix<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Windows<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    other<\/p>\n<\/li>\n<\/ul>\n<p>    114 users voted. 11 users abstained.<\/p>\n<h2 class=\"default-block__polling-title\">Which version of PHP are you using on the server?<\/h2>\n<ul class=\"content-list content-list_polling\">\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    7.3<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    7.2<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    7.1<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    7.0<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    5<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    other<\/p>\n<\/li>\n<\/ul>\n<p>    105 users voted. 17 users abstained.<\/p>\n<h2 class=\"default-block__polling-title\">Have you ever used pinba?<\/h2>\n<ul class=\"content-list content-list_polling\">\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    yes<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    No, but I would like to.<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    No, and I wouldn't want to.<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    No, and I haven't heard of it.<\/p>\n<\/li>\n<\/ul>\n<p>    100 users voted. 14 users abstained.<\/p>\n<h2 class=\"default-block__polling-title\">Which version of the pinba server would you like to try?<\/h2>\n<ul class=\"content-list content-list_polling\">\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    pinba_engine (mysql engine)<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    pinba2 (mysql engine)<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    pinboard (php + mysql)<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    olegfedoseev\/pinba-server (go + OpenTSDB)<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    olegfedoseev\/pinba-influxdb (go + influxdb)<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    pinba-server\/pinba-server (go + clickhouse)<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    pinba-server\/pinba-server (php + clickhouse)<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    I will write my own.<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    other<\/p>\n<\/li>\n<\/ul>\n<p>    39 users voted. 47 users abstained.<br \/>\n<br \/>Source: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/444610\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c pinba \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 clickhouse \u0438 grafana \u0432\u043c\u0435\u0441\u0442\u043e pinba_engine \u0438 pinboard. \u041d\u0430 php-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 pinba \u2014 \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e. \u041f\u0440\u0430\u0432\u0434\u0430 \u043e\u0431\u044b\u0447\u043d\u043e pinba \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0443\u0436\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u00ab\u0433\u0434\u0435 \u043a\u043e\u043f\u0430\u0442\u044c\u00bb. \u0427\u0430\u0441\u0442\u043e \u043d\u0438\u043a\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443\/\u043c\u0438\u043d\u0443\u0442\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":24468,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-32681","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c pinba \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 clickhouse \u0438 grafana \u0432\u043c\u0435\u0441\u0442\u043e pinba_engine \u0438 pinboard. \u041d\u0430 php-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 pinba \u2014 \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/statistika-i-monitoring-php-skriptov-v-realnom-vremeni-clickhouse-i-grafana-idut-na-pomoshh-k-pinba\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 PHP \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. ClickHouse \u0438 Grafana \u0438\u0434\u0443\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043a Pinba | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c pinba \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 clickhouse \u0438 grafana \u0432\u043c\u0435\u0441\u0442\u043e pinba_engine \u0438 pinboard. \u041d\u0430 php-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 pinba \u2014 \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/statistika-i-monitoring-php-skriptov-v-realnom-vremeni-clickhouse-i-grafana-idut-na-pomoshh-k-pinba\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:48:22+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:48:22+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Real-time statistics and monitoring of PHP scripts. ClickHouse and Grafana come to the rescue for Pinba | ProHoster","description":"In this article, I will explain how to use Pinba in conjunction with ClickHouse and Grafana instead of Pinba Engine and Pinboard. For PHP projects, Pinba is perhaps the only reliable way to understand what is happening.","canonical_url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/statistika-i-monitoring-php-skriptov-v-realnom-vremeni-clickhouse-i-grafana-idut-na-pomoshh-k-pinba","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 PHP \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. ClickHouse \u0438 Grafana \u0438\u0434\u0443\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043a Pinba | ProHoster","og:description":"\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c pinba \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 clickhouse \u0438 grafana \u0432\u043c\u0435\u0441\u0442\u043e pinba_engine \u0438 pinboard. \u041d\u0430 php-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 pinba \u2014 \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441.","og:url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/statistika-i-monitoring-php-skriptov-v-realnom-vremeni-clickhouse-i-grafana-idut-na-pomoshh-k-pinba","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:48:22+00:00","article:modified_time":"2019-10-31T18:48:22+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"32681","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-21 12:02:19","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 02:54:26","updated":"2026-01-21 12:02:19","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/32681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=32681"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/32681\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media\/24468"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=32681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=32681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=32681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}