{"id":32165,"date":"2018-11-09T18:35:15","date_gmt":"2018-11-09T13:05:15","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=32165"},"modified":"2018-11-09T18:35:15","modified_gmt":"2018-11-09T13:05:15","slug":"install-prometheus-on-ubuntu-16-04","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/install-prometheus-on-ubuntu-16-04\/","title":{"rendered":"Install Prometheus on Ubuntu 16.04"},"content":{"rendered":"<p><span style=\"color: #003366;\"><strong>Install Prometheus on Ubuntu 16.04<\/strong><\/span><\/p>\n<h3 id=\"prometheus\"><span style=\"color: #008080;\">Prometheus<\/span><\/h3>\n<p><strong>Prometheus<\/strong> could be a powerful and open-source, ASCII text file observance system that collects metrics from your services and stores them in an exceedingly time-series information.<\/p>\n<p>It proposes a multi-dimensional data model, a versatile <a href=\"https:\/\/www.wikitechy.com\/tutorials\/neo4j\/neo4j-query-language-cypher\" target=\"_blank\" rel=\"noopener\">query language<\/a>, and numerous visualization image prospects through tools like <strong>Grafana<\/strong>.<\/p>\n<p>Prometheus solely exports metrics regarding itself (e.g. the number of requests it\u2019s received, its memory consumption, etc.). But, you\u2019ll greatly expand Prometheus by installing exporters, optional gratia programs that generate further metrics.<\/p>\n<p><strong>Exporters<\/strong>\u2014both the official ones that the Prometheus team maintains further because the <strong>community-contributed ones<\/strong>\u2014provide info regarding everything from infrastructure, databases, and web servers to electronic communication systems, APIs, and more.<\/p>\n<h3 id=\"some-of-the-foremost-common-selections-include\"><span style=\"color: #3366ff;\">Some of the foremost common selections include:<\/span><\/h3>\n<ul>\n<li><span style=\"color: #003300;\"><strong>node_exporter<\/strong><\/span> \u2013 This produces metrics regarding infrastructure, as well as the present CPU, memory, and disk usage, further as I\/O and network statistics, like the quantity of bytes scan from a disk or a server\u2019s average load.<\/li>\n<li><span style=\"color: #003300;\"><strong>blackbox_exporter<\/strong><\/span> \u2013 This generates metrics derived from inquisitory protocols like protocol HTTP and HTTPS to see end convenience, time interval, and more.<\/li>\n<li><span style=\"color: #003300;\"><strong>mysqld_exporter<\/strong><\/span> \u2013 This gathers metrics associated with a MySQL server, like the quantity of executed queries, average response time interval, and cluster replication standing.<\/li>\n<li><span style=\"color: #003300;\"><strong>rabbitmq_exporter<\/strong><\/span> \u2013 This outputs metrics regarding the RabbitMQ electronic communication system, as well as the number of messages printed, the number of messages able to be delivered, and also the size of all the messages within the queue.<\/li>\n<li><span style=\"color: #003300;\"><strong>nginx-vts-exporter<\/strong> <\/span>\u2013 This provides metrics regarding associate Nginx web server victimization the Nginx VTS module, as well as the number of open connections, the quantity of sent responses (grouped by response codes), and also the total size of sent or received requests in bytes.<\/li>\n<\/ul>\n<p>You will notice a lot of complete list of each official and community-contributed exporters on Prometheus\u2019 web site.<\/p>\n<p>You\u2019ll install, configure, and secure Prometheus and Node Exporter to come up with metrics that may build it easier to observe your server\u2019s performance.<\/p>\n<h3 id=\"prerequisites\"><span style=\"color: #ff0000;\">Prerequisites<\/span><\/h3>\n<p>Before following this tutorial check that you have:<\/p>\n<ul>\n<li>One <strong>Ubuntu 16.04 Droplet<\/strong>, established by following the<strong> Initial Server Setup with Ubuntu sixteen.04<\/strong> tutorial, as well as a sudo non-root user and a firewall.<\/li>\n<li>Nginx installed by following the primary 2 steps of the way to <a href=\"https:\/\/www.wikitechy.com\/technology\/how-to-install-nginx-on-ubuntu-16-04\/\" target=\"_blank\" rel=\"noopener\">Install Nginx on Ubuntu 16.04 tutorial<\/a>.<\/li>\n<\/ul>\n<h3 id=\"step-1-create-service-users\"><span style=\"color: #800080;\">Step 1 \u2014 Create Service Users<\/span><\/h3>\n<p>For the safety functions, we\u2019ll begin by making 2 new user accounts, <strong>prometheus<\/strong> and <strong>node_exporter<\/strong>. We\u2019ll use these accounts throughout the tutorial to isolate the possession on Prometheus\u2019 core files and directories.<\/p>\n<p>Create these 2 users, and use the <strong>\u2013no-create-home<\/strong> and <strong>\u2013shell \/bin\/false<\/strong> choices in order that these users cannot log into the server.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20useradd%20\u2013no-create-home%20\u2013shell%20%2Fbin%2Ffalse%20prometheus%0A%24%20sudo%20useradd%20\u2013no-create-home%20\u2013shell%20%2Fbin%2Ffalse%20node_exporter\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Before downloading the Prometheus binaries, create the essential directories to store Prometheus\u2019 files and data.<\/p>\n<p>The upcoming standard Linux conventions, we\u2019ll generate a directory in <strong>\/etc<\/strong> for Prometheus\u2019 configuration files and a directory in <strong>\/var\/lib<\/strong> for its data.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20mkdir%20%2Fetc%2Fprometheus%0A%24%20sudo%20mkdir%20%2Fvar%2Flib%2Fprometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Set user and group ownership for new directories of prometheus user.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20chown%20prometheus%3Aprometheus%20%2Fetc%2Fprometheus%0A%24%20sudo%20chown%20prometheus%3Aprometheus%20%2Fvar%2Flib%2Fprometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>With our users in place, we will currently download prometheus so produce the specified configuration file to run for 1st time.<\/p>\n<h3 id=\"step-2-download-prometheus\"><span style=\"color: #800080;\">Step 2 \u2014 Download Prometheus<\/span><\/h3>\n<p>Download and take the present stable version of Prometheus into your home directory. You\u2019ll notice the newest binaries together with their checksums on the Prometheus transfer page.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20cd%20~%0A%24%20curl%20-LO%20https%3A%2F%2Fgithub.com%2Fprometheus%2Fprometheus%2Freleases%2Fdownload%2Fv2.0.0%2Fprometheus-2.0.0.linux-amd64.tar.gz\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Next, use the <strong>sha256sum<\/strong> command to come up with a checksum of the downloaded file:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sha256sum%20prometheus-2.0.0.linux-amd64.tar.gz\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Compare the output from this command with the checksum on the Prometheus download page to confirm that your file is each real and not corrupted.<\/p>\n<h3 id=\"output\"><span style=\"color: #333399;\">Output<\/span><\/h3>\n[pastacode lang=\u201dbash\u201d manual=\u201de12917b25b32980daee0e9cf879d9ec197e2893924bd1574604eb0f550034d46%20%20prometheus-2.0.0.linux-amd64.tar.gz\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>If the checksums do not match, take away the downloaded file and repeat the preceding steps to re-download the file.<\/p>\n<p>Now, take out the downloaded archive.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20tar%20xvf%20prometheus-2.0.0.linux-amd64.tar.gz\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>This can produce a directory known as <strong>prometheus-1.7.1.linux-amd64<\/strong> containing 2 binary files (<strong>prometheus and promtool<\/strong>), consoles, <strong>console_libraries<\/strong>, and several other example files.<\/p>\n<p>Copy the 2 binaries to the<strong> \/usr\/local\/bin<\/strong> directory.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20cp%20prometheus-2.0.0.linux-amd64%2Fprometheus%20%2Fusr%2Flocal%2Fbin%2F%0A%24%20sudo%20cp%20prometheus-2.0.0.linux-amd64%2Fpromtool%20%2Fusr%2Flocal%2Fbin%2F\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Set the user and cluster possession on the binaries to the Prometheus user created in Step 1.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20chown%20prometheus%3Aprometheus%20%2Fusr%2Flocal%2Fbin%2Fprometheus%0A%24%20sudo%20chown%20prometheus%3Aprometheus%20%2Fusr%2Flocal%2Fbin%2Fpromtool\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Copy the consoles and<strong> console_libraries<\/strong> directories to <strong>\/etc\/prometheus.<\/strong><\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20cp%20-r%20prometheus-2.0.0.linux-amd64%2Fconsoles%20%2Fetc%2Fprometheus%0A%24%20sudo%20cp%20-r%20prometheus-2.0.0.linux-amd64%2Fconsole_libraries%20%2Fetc%2Fprometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Set the user and cluster ownership on the directories to the prometheus user. Using the <strong>-R flag<\/strong> will confirm that ownership is set on the files inside the directory as well.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20chown%20-R%20prometheus%3Aprometheus%20%2Fetc%2Fprometheus%2Fconsoles%0A%24%20sudo%20chown%20-R%20prometheus%3Aprometheus%20%2Fetc%2Fprometheus%2Fconsole_libraries\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Lastly, take away the leftover files from your home directory as they\u2019re not required.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20rm%20-rf%20prometheus-2.0.0.linux-amd64.tar.gz%20prometheus-2.0.0.linux-amd64\u2033 message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Now Prometheus is installed, we\u2019ll produce its configuration and service files in preparation of its initial run.<\/p>\n<h3 id=\"step-3-configure-prometheus\"><span style=\"color: #800080;\">Step 3 \u2014 Configure Prometheus<\/span><\/h3>\n<p>In the \/e<strong>tc\/prometheus<\/strong> directory, use nano or your favorite text editor to make a configuration file named <strong>Prometheus.yml<\/strong>. For now, this file can contain barely enough info to run Prometheus for the primary time.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20nano%20%2Fetc%2Fprometheus%2Fprometheus.yml\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p><span style=\"color: #ff0000;\"><strong>Warning:<\/strong> <\/span>Prometheus\u2019 configuration file uses the YAML format, that strictly forbids tabs and needs 2 areas for indentation. Prometheus can fail to start out if the configuration file is incorrectly formatted.<\/p>\n<p>In the global settings, outline the default interval for scraping metrics. Note that Prometheus can apply these settings to each exporter unless a personal exporter\u2019s own settings override the globals.<\/p>\n[pastacode lang=\u201dhaml\u201d manual=\u201dglobal%3A%0A%20%20scrape_interval%3A%2015s\u201d message=\u201dPrometheus config file part 1 \u2013 \/etc\/prometheus\/prometheus.yml\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>This <strong>scrape_interval<\/strong> value tells Prometheus to gather metrics from its exporters every fifteen seconds, that is long enough for many exporters.<\/p>\n<p>Now, add Prometheus itself to the list of exporters to scrape from with the subsequent<strong> scrape_configs directive:<\/strong><\/p>\n[pastacode lang=\u201dhaml\u201d manual=\u201d\u2026%0Ascrape_configs%3A%0A%20%20-%20job_name%3A%20\u2019prometheus\u2019%0A%20%20%20%20scrape_interval%3A%205s%0A%20%20%20%20static_configs%3A%0A%20%20%20%20%20%20-%20targets%3A%20%5B\u2019localhost%3A9090\u2019%5D\u201d message=\u201dPrometheus config file part 2 \u2013 \/etc\/prometheus\/prometheus.yml\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Prometheus uses the<strong> job_name<\/strong> to label exporters in queries and on graphs, therefore make certain to choose one thing descriptive here.<\/p>\n<p>And, as Prometheus exports necessary information regarding itself that you simply will use for observance performance and debugging, we\u2019ve overridden the global <strong>scrape_interval<\/strong> directive from 15 seconds to 5 seconds for a lot of frequent updates.<\/p>\n<p>Lastly, Prometheus uses the <strong>static_configs<\/strong> and targets directives to see wherever exporters square measure running. Since this explicit exporter is running on an identical server as Prometheus itself, we will use localhost rather than IP address together with the default port, 9090.<\/p>\n<p>Your configuration file will to currently seem like this:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201dglobal%3A%0A%20%20scrape_interval%3A%2015s%0A%0Ascrape_configs%3A%0A%20%20-%20job_name%3A%20\u2019prometheus\u2019%0A%20%20%20%20scrape_interval%3A%205s%0A%20%20%20%20static_configs%3A%0A%20%20%20%20%20%20-%20targets%3A%20%5B\u2019localhost%3A9090\u2019%5D\u201d message=\u201dPrometheus config file \u2013 \/etc\/prometheus\/prometheus.yml\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Save the file and exit your text editor.<\/p>\n<p>Now, set the user and cluster possession on the configuration file to the Prometheus user created in Step 1.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20chown%20prometheus%3Aprometheus%20%2Fetc%2Fprometheus%2Fprometheus.yml\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>With the configuration complete, we\u2019re able to take a look at <strong>prometheus<\/strong> by running it for the primary time.<\/p>\n<h3 id=\"step-4-running-prometheus\"><span style=\"color: #800080;\">Step 4 \u2014 Running Prometheus<\/span><\/h3>\n<p><strong>Startup Prometheus<\/strong> because the Prometheus user, providing the trail to each the configuration file and also the data directory.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20-u%20prometheus%20%2Fusr%2Flocal%2Fbin%2Fprometheus%20%5C%0A%24%20%20%20%20\u2013config.file%20%2Fetc%2Fprometheus%2Fprometheus.yml%20%5C%0A%24%20%20%20\u2013storage.tsdb.path%20%2Fvar%2Flib%2Fprometheus%2F%20%5C%0A%24%20%20%20%20\u2013web.console.templates%3D%2Fetc%2Fprometheus%2Fconsoles%20%5C%0A%24%20%20%20%20\u2013web.console.libraries%3D%2Fetc%2Fprometheus%2Fconsole_libraries\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>The output contains info regarding Prometheus\u2019 loading progress, configuration file, and connected services. It conjointly confirms that Prometheus is listening on<strong> port 9090.<\/strong><\/p>\n<h3 id=\"output-2\"><span style=\"color: #333399;\">Output<\/span><\/h3>\n<pre class=\"code-pre \"><code>level=info ts=2017-11-17T18:37:27.474530094Z caller=main.go:215 msg=\"Starting Prometheus\" version=\"(version=2.0.0, branch=HEAD, re\r\nvision=0a74f98628a0463dddc90528220c94de5032d1a0)\"\r\nlevel=info ts=2017-11-17T18:37:27.474758404Z caller=main.go:216 build_context=\"(go=go1.9.2, user=root@615b82cb36b6, date=20171108-\r\n07:11:59)\"\r\nlevel=info ts=2017-11-17T18:37:27.474883982Z caller=main.go:217 host_details=\"(Linux 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 1\r\n4:24:03 UTC 2017 x86_64 prometheus-update (none))\"\r\nlevel=info ts=2017-11-17T18:37:27.483661837Z caller=web.go:380 component=web msg=\"Start listening for connections\" address=0.0.0.0\r\n:9090\r\nlevel=info ts=2017-11-17T18:37:27.489730138Z caller=main.go:314 msg=\"Starting TSDB\"\r\nlevel=info ts=2017-11-17T18:37:27.516050288Z caller=targetmanager.go:71 component=\"target manager\" msg=\"Starting target manager...\r\n\"\r\nlevel=info ts=2017-11-17T18:37:27.537629169Z caller=main.go:326 msg=\"TSDB started\"\r\nlevel=info ts=2017-11-17T18:37:27.537896721Z caller=main.go:394 msg=\"Loading configuration file\" filename=\/etc\/prometheus\/promethe\r\nus.yml\r\nlevel=info ts=2017-11-17T18:37:27.53890004Z caller=main.go:371 msg=\"Server is ready to receive requests.\"<\/code><\/pre>\n<p>If an error message comes, ensure that you\u2019ve got used <strong>YAML syntax<\/strong> in your configuration file so follow the on-screen directions to resolve the matter.<\/p>\n<p>Now, halt Prometheus by pressing<strong> CTRL+C,<\/strong> so open a brand new <strong>systemd<\/strong> service file.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20nano%20%2Fetc%2Fsystemd%2Fsystem%2Fprometheus.service\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>The service file tells <strong>systemd<\/strong> to run Prometheus because the Prometheus user, with the configuration file situated within the<strong> \/etc\/prometheus\/prometheus.ym<\/strong>l directory and to store its information within the<strong> \/var\/lib\/prometheus<\/strong> directory. (The details of systemd service files square measure on the far side the scope of this tutorial)<\/p>\n<p>Copy the subsequent content into the file:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%5BUnit%5D%0ADescription%3DPrometheus%0AWants%3Dnetwork-online.target%0AAfter%3Dnetwork-online.target%0A%0A%5BService%5D%0AUser%3Dprometheus%0AGroup%3Dprometheus%0AType%3Dsimple%0AExecStart%3D%2Fusr%2Flocal%2Fbin%2Fprometheus%20%5C%0A%20%20%20%20\u2013config.file%20%2Fetc%2Fprometheus%2Fprometheus.yml%20%5C%0A%20%20%20%20\u2013storage.tsdb.path%20%2Fvar%2Flib%2Fprometheus%2F%20%5C%0A%20%20%20%20\u2013web.console.templates%3D%2Fetc%2Fprometheus%2Fconsoles%20%5C%0A%20%20%20%20\u2013web.console.libraries%3D%2Fetc%2Fprometheus%2Fconsole_libraries%0A%0A%5BInstall%5D%0AWantedBy%3Dmulti-user.target\u201d message=\u201dPrometheus service file \u2013 \/etc\/systemd\/system\/prometheus.service\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Finally, save the file and shut your text editor.<\/p>\n<p>To use the recently created service, reload systemd.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20daemon-reload\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>You will currently begin Prometheus victimization the subsequent command:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20start%20prometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>To check that Prometheus is running, check the service\u2019s status.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20status%20prometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>The output tells you Prometheus\u2019 status, main method symbol (PID), memory use, and more.<\/p>\n<p>If the service\u2019s status is not active, follow the on-screen directions and re-trace the preceding steps to resolve the matter before continued the tutorial.<\/p>\n<h3 id=\"output-3\"><span style=\"color: #333399;\">Output<\/span><\/h3>\n<pre class=\"code-pre \"><code>\u25cf prometheus.service - Prometheus\r\n   Loaded: loaded (\/etc\/systemd\/system\/prometheus.service; disabled; vendor preset: enabled)\r\n   Active: <span class=\"highlight\">active<\/span> (running) since Fri 2017-07-21 11:40:40 UTC; 3s ago\r\n Main PID: 2104 (prometheus)\r\n    Tasks: 7\r\n   Memory: 13.8M\r\n      CPU: 470ms\r\n   CGroup: \/system.slice\/prometheus.service\r\n...<\/code><\/pre>\n<p>When you are able to move, press Q to quit the status command.<\/p>\n<p>Lastly, change the service to start on boot.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20enable%20prometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Now that Prometheus is up and running, we will install an extra exporter to come up with metrics regarding our server\u2019s resources.<\/p>\n<h3 id=\"step-5-downloading-node-exporter\"><span style=\"color: #800080;\">Step 5 \u2014 Downloading Node Exporter<\/span><\/h3>\n<p>To expand Prometheus on the far side metrics regarding itself solely, we\u2019ll install an extra exporter known as Node exporter. Node exporter provides careful info regarding the system, as well as CPU, disk, and memory usage.<\/p>\n<p>First, download the present stable version of Node Exporter into your home directory. You\u2019ll notice the newest binaries together with their checksums on Prometheus\u2019 download page.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20cd%20~%0A%24%20curl%20-LO%20https%3A%2F%2Fgithub.com%2Fprometheus%2Fnode_exporter%2Freleases%2Fdownload%2Fv0.15.1%2Fnode_exporter-0.15.1.linux-amd64.tar.gz\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Use the <strong>sha256sum<\/strong> command to create a checksum of the downloaded file:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sha256sum%20node_exporter-0.15.1.linux-amd64.tar.gz\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Now, verify the downloaded file\u2019s integrity by <strong>comparing its checksum<\/strong> with the one on the download page.<\/p>\n<h3 id=\"output-4\"><span style=\"color: #333399;\">Output<\/span><\/h3>\n<pre class=\"code-pre \"><code><span class=\"highlight\">7ffb3773abb71dd2b2119c5f6a7a0dbca0cff34b24b2ced9e01d9897df61a127<\/span>  <span class=\"highlight\">node_exporter-0.15.1.linux-amd64.tar.gz<\/span><\/code><\/pre>\n<p>If the checksums do not match, take away the downloaded file and repeat the preceding steps.<\/p>\n<p>Now, unload downloaded archive.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20tar%20xvf%20node_exporter-0.15.1.linux-amd64.tar.gz\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>This can produce a directory known as n<strong>ode_exporter-0.14.0.linux-amd64<\/strong> containing a computer file named node_exporter, a license, and a notice.<\/p>\n<p>Copy the binary to the <strong>\/usr\/local\/bin<\/strong> directory and set the user and cluster possession to the<strong> node_exporter<\/strong> user that you simply created in Step 1.<\/p>\n[pastacode lang=\u201dmarkup\u201d manual=\u201d%24%20sudo%20cp%20node_exporter-0.15.1.linux-amd64%2Fnode_exporter%20%2Fusr%2Flocal%2Fbin%0A%24%20sudo%20chown%20node_exporter%3Anode_exporter%20%2Fusr%2Flocal%2Fbin%2Fnode_exporter\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Lastly, take away the leftover files from your home directory as they\u2019re not required.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20rm%20-rf%20node_exporter-0.15.1.linux-amd64.tar.gz%20node_exporter-0.15.1.linux-amd64\u2033 message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Now that you\u2019ve got put in Node Exporter, you\u2019ll take a look at it out by running it so we will produce a service file for it in order that it starts on boot.<\/p>\n<h3 id=\"step-6-running-node-exporter\"><span style=\"color: #800080;\">Step 6 \u2014 Running Node Exporter<\/span><\/h3>\n<p>The steps for running Node Exporter is the same as those for running Prometheus itself. Begin by making the <strong>Systemd<\/strong> service file for Node Exporter.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20nano%20%2Fetc%2Fsystemd%2Fsystem%2Fnode_exporter.service\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>This service file tells your system to run Node Exporter because the <strong>node_exporter<\/strong> user with the default set of collectors enabled.<\/p>\n<p>Copy the subsequent content into the service file:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%5BUnit%5D%0ADescription%3DNode%20Exporter%0AWants%3Dnetwork-online.target%0AAfter%3Dnetwork-online.target%0A%0A%5BService%5D%0AUser%3Dnode_exporter%0AGroup%3Dnode_exporter%0AType%3Dsimple%0AExecStart%3D%2Fusr%2Flocal%2Fbin%2Fnode_exporter%0A%0A%5BInstall%5D%0AWantedBy%3Dmulti-user.target\u201d message=\u201dNode Exporter service file \u2013 \/etc\/systemd\/system\/node_exporter.service\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Collectors outline that metrics Node Exporter can generate. You\u2019ll see Node Exporter\u2019s complete list of collectors\u2014including enabled by default and that deprecated\u2014in the Node Exporter <strong>README<\/strong> file.<\/p>\n<p>If you ever have to be compelled to override the default list of collectors, you\u2019ll use the <strong>\u2013collectors.enabled flag<\/strong>, like:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d\u2026%0AExecStart%3D%2Fusr%2Flocal%2Fbin%2Fnode_exporter%20\u2013collectors.enabled%20meminfo%2Cloadavg%2Cfilesystem%0A\u2026\u201d message=\u201dNode Exporter service file part \u2013 \/etc\/systemd\/system\/node_exporter.service\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>The preceding example would tell Node Exporter to create metrics victimization solely the <strong>meminfo, loadavg, and filesystem collectors.<\/strong> You\u2019ll limit the collectors to but few or several you would like, however, note that there are not any blank areas before or when the commas.<\/p>\n<p>Save the file and shut your text editor.<\/p>\n<p>Finally, <strong>reload systemd<\/strong> to use the recently created service.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20daemon-reload\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>At the end of the <strong>scrape_configs block<\/strong>, add a brand new entry known as node_exporter.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d\u2026%0A%20%20-%20job_name%3A%20\u2019node_exporter\u2019%0A%20%20%20%20scrape_interval%3A%205s%0A%20%20%20%20static_configs%3A%0A%20%20%20%20%20%20-%20targets%3A%20%5B\u2019localhost%3A9100\u2019%5D\u201d message=\u201dPrometheus config file part 1 \u2013 \/etc\/prometheus\/prometheus.yml\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Because this Exporter is additionally running on an identical server as Prometheus itself. We will use localhost rather than <strong>IP address<\/strong> once more together with <strong>Node Exporter\u2019s default port, 9100<\/strong>.<\/p>\n<p>Your whole configuration file ought to seem like this:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201dglobal%3A%0A%20%20scrape_interval%3A%2015s%0A%0Ascrape_configs%3A%0A%20%20-%20job_name%3A%20\u2019prometheus\u2019%0A%20%20%20%20scrape_interval%3A%205s%0A%20%20%20%20static_configs%3A%0A%20%20%20%20%20%20-%20targets%3A%20%5B\u2019localhost%3A9090\u2019%5D%0A%20%20-%20job_name%3A%20\u2019node_exporter\u2019%0A%20%20%20%20scrape_interval%3A%205s%0A%20%20%20%20static_configs%3A%0A%20%20%20%20%20%20-%20targets%3A%20%5B\u2019localhost%3A9100\u2019%5D%20%20%20\u2033 message=\u201dPrometheus config file \u2013 \/etc\/prometheus\/prometheus.yml\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Save the file and exit your text editor once you are able to continue.<\/p>\n<p>Finally,<strong> restart Prometheus<\/strong> to place the changes into impact.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20restart%20prometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Once again, <strong>verify<\/strong> that everything is running properly with the status command.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20status%20prometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>If the service\u2019s status is not set to active, follow the on-screen directions and re-trace your previous steps before moving on.<\/p>\n<h3 id=\"output-5\"><span style=\"color: #333399;\">Output<\/span><\/h3>\n<pre class=\"code-pre \"><code>prometheus.service - Prometheus\r\n   Loaded: loaded (\/etc\/systemd\/system\/prometheus.service; disabled; vendor preset: enabled)\r\n   Active: <span class=\"highlight\">active<\/span> (running) since Fri 2017-07-21 11:46:39 UTC; 6s ago\r\n Main PID: 2219 (prometheus)\r\n    Tasks: 6\r\n   Memory: 19.9M\r\n      CPU: 433ms\r\n   CGroup: \/system.slice\/prometheus.service<\/code><\/pre>\n<p>We currently have <strong>Prometheus and Node Exporter installed,<\/strong> configured, and running. As a final precaution before connecting to the online interface, we\u2019ll enhance our installation\u2019s security with basic protocol HTTP authentication to confirm that unauthorized users cannot access our metrics.<\/p>\n<h3 id=\"step-8-securing-prometheus\"><span style=\"color: #800080;\">Step 8 \u2014 Securing Prometheus<\/span><\/h3>\n<p>Prometheus doesn\u2019t embrace in-built authentication or the other general purpose security mechanism. On the one hand, this suggests you are obtaining an extremely versatile system with fewer configuration restraints; on the opposite hand, it means that it\u2019s up to you to confirm that your metrics and overall setup square measure sufficiently secure.<\/p>\n<p>For simplicity\u2019s sake, we\u2019ll use Nginx to feature basic <a href=\"https:\/\/www.wikitechy.com\/angularjs\/angularjs-$http\" target=\"_blank\" rel=\"noopener\">HTTP<\/a> protocol authentication to our installation, that each Prometheus and its most popular<strong> data visualization tool, Grafana<\/strong>, totally support.<\/p>\n<p>Start by putting in <strong>apache2-utils<\/strong>, which is able to offer you access to the <strong>htpasswd<\/strong> utility for generating password files.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20apt-get%20update%0A%24%20sudo%20apt-get%20install%20apache2-utils\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Now, generate a password file by telling<strong> htpasswd<\/strong> wherever you wish to store the file and that username you want to use for authentication.<\/p>\n<p><span style=\"color: #800000;\"><strong>Note<\/strong><\/span>: <strong>htpasswd<\/strong> can prompt you to enter and re-confirm the password you want to go together with this user. Also, build note of each the username and password you enter here, as you will need them to log into Prometheus in Step 9.<\/p>\n<p>The results of this command could be a newly-created file known as <span style=\"color: #ff0000;\"><strong>.htpasswd<\/strong><\/span>, situated within the <strong>\/etc\/nginx<\/strong> directory, containing the username and a hashed version of the password you entered.<\/p>\n<p>Next, <strong>set up Nginx<\/strong> to use the newly-created passwords.<\/p>\n<p>First, build a Prometheus-specific copy of the default <strong>Nginx configuration file<\/strong> in order that you\u2019ll revert back to the defaults later if you run into a haul.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20cp%20%2Fetc%2Fnginx%2Fsites-available%2Fdefault%20%2Fetc%2Fnginx%2Fsites-available%2Fprometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Then, open the <strong>new configuration file<\/strong>.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20nano%20%2Fetc%2Fnginx%2Fsites-available%2Fprometheus\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Locate the <strong>location\/ block<\/strong> below the <a href=\"https:\/\/www.wikitechy.com\/tutorials\/ethical-hacking\/server-hacking\/what-is-a-server-and-its-types\" target=\"_blank\" rel=\"noopener\">server<\/a> block. It must look like:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d\u2026%0A%20%20%20%20location%20%2F%20%7B%0A%20%20%20%20%20%20%20%20try_files%20%24uri%20%24uri%2F%20%3D404%3B%0A%20%20%20%20%7D%0A\u2026%0A\u201d message=\u201d\/etc\/nginx\/sites-available\/default\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>As we are going to be forwarding all traffic to Prometheus, replace the <strong>try_files<\/strong> directive with the subsequent content:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d\u2026%0A%20%20%20%20location%20%2F%20%7B%0A%20%20%20%20%20%20%20%20auth_basic%20%22Prometheus%20server%20authentication%22%3B%0A%20%20%20%20%20%20%20%20auth_basic_user_file%20%2Fetc%2Fnginx%2F.htpasswd%3B%0A%20%20%20%20%20%20%20%20proxy_pass%20http%3A%2F%2Flocalhost%3A9090%3B%0A%20%20%20%20%20%20%20%20proxy_http_version%201.1%3B%0A%20%20%20%20%20%20%20%20proxy_set_header%20Upgrade%20%24http_upgrade%3B%0A%20%20%20%20%20%20%20%20proxy_set_header%20Connection%20\u2019upgrade\u2019%3B%0A%20%20%20%20%20%20%20%20proxy_set_header%20Host%20%24host%3B%0A%20%20%20%20%20%20%20%20proxy_cache_bypass%20%24http_upgrade%3B%0A%20%20%20%20%7D%0A\u2026\u201d message=\u201d\/etc\/nginx\/sites-available\/prometheus\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>These settings make sure that users can demonstrate at the beginning of every new session. In addition, the <strong>reverse proxy<\/strong> can direct all requests handled by this block to Prometheus.<\/p>\n<p>When you are finished creating changes, save the file and shut your text editor.<\/p>\n<p>Now, <strong>deactivate<\/strong> the default Nginx configuration file by removing the link thereto within the <strong>\/etc\/nginx\/sites-enabled<\/strong> directory, and activate the new configuration file by generating a link to it.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20rm%20%2Fetc%2Fnginx%2Fsites-enabled%2Fdefault%0A%24%20sudo%20ln%20-s%20%2Fetc%2Fnginx%2Fsites-available%2Fprometheus%20%2Fetc%2Fnginx%2Fsites-enabled%2F\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>Before restarting Nginx, check the<strong> configuration for errors<\/strong> victimization the subsequent command:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20nginx%20-t\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>The output must indicate that the <strong>syntax is ok<\/strong> and also the<strong> test is successful<\/strong>. If you receive an error message, follow the on-screen directions to repair the matter before continuing to the following step.<\/p>\n<h3 id=\"an-output-of-nginx-configuration-tests\"><span style=\"color: #333399;\">An output of Nginx configuration tests<\/span><\/h3>\n<pre class=\"code-pre \"><code>nginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\r\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/code><\/pre>\n<p>Then, <strong>reload Nginx<\/strong> to include all of the changes.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20reload%20nginx\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p><strong>Verify<\/strong> that <a href=\"https:\/\/www.wikitechy.com\/technology\/nginx-error-connect-to-php5-fpm-sock-failed-13-permission-denied\/\" target=\"_blank\" rel=\"noopener\">Nginx<\/a> is up and running.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20status%20nginx\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>If your output does not indicate that the service\u2019s status is <span style=\"color: #ff0000;\"><strong>active<\/strong><\/span>, follow the on-screen messages and re-trace the preceding steps to resolve the difficulty before continued.<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%E2%97%8F%20nginx.service%20-%20A%20high%20performance%20web%20server%20and%20a%20reverse%20proxy%20server%0A%20%20%20Loaded%3A%20loaded%20(%2Flib%2Fsystemd%2Fsystem%2Fnginx.service%3B%20enabled%3B%20vendor%20preset%3A%20en%0A%20%20%20Active%3A%20active%20(running)%20since%20Mon%202017-07-31%2021%3A20%3A57%20UTC%3B%2012min%20ago%0A%20%20Process%3A%204302%20ExecReload%3D%2Fusr%2Fsbin%2Fnginx%20-g%20daemon%20on%3B%20master_process%20on%3B%20-s%20r%0A%20Main%20PID%3A%203053%20(nginx)%0A%20%20%20%20Tasks%3A%202%0A%20%20%20Memory%3A%203.6M%0A%20%20%20%20%20%20CPU%3A%2056ms%0A%20%20%20CGroup%3A%20%2Fsystem.slice%2Fnginx.service\u201d message=\u201dOutput\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>At this time, we have a fully-functional and secured<strong> Prometheus server<\/strong>. Therefore we will log into the web interface to start observing metrics.<\/p>\n<h3 id=\"step-9-testing-prometheus\"><span style=\"color: #800080;\">Step 9 \u2014 Testing Prometheus<\/span><\/h3>\n<p>Prometheus provides a basic web interface for observance the status of itself and its exporters, queries, and generating graphs. But, because of the interface\u2019s simplicity, the Prometheus team recommends to <strong>install and use Grafana<\/strong> for all the difficult than testing and debugging.<\/p>\n<p>In this tutorial, we\u2019ll use the inbuilt web interface to <strong>confirm that Prometheus and Node Exporter<\/strong> are up and running, and we\u2019ll conjointly take a glance at straightforward queries and graphs.<\/p>\n<p>To begin, purpose your <a href=\"https:\/\/www.wikitechy.com\/technology\/use-linux-mac-windows-vivaldi-web-browser\/\" target=\"_blank\" rel=\"noopener\">web browser<\/a> to <span style=\"color: #ff0000;\">http:\/\/your_server_ip.<\/span><\/p>\n<p>In the HTTP protocol authentication dialogue box, enter the <strong>username and password<\/strong> you selected in <strong>Step 8<\/strong>.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-32172\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Authentication.png\" alt=\"Prometheus-Authentication\" width=\"583\" height=\"295\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Authentication.png 1154w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Authentication-300x152.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Authentication-768x388.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Authentication-1024x517.png 1024w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Authentication-990x500.png 990w\" sizes=\"(max-width: 583px) 100vw, 583px\" \/><\/p>\n<p>Once logged in, you will see the<strong> Expression<\/strong> Browser, wherever you\u2019ll execute and visualize custom queries.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-32174 \" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Graph.png\" alt=\"Prometheus-Dashboard-Graph\" width=\"808\" height=\"413\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Graph.png 1154w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Graph-300x153.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Graph-768x393.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Graph-1024x524.png 1024w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Graph-990x506.png 990w\" sizes=\"(max-width: 808px) 100vw, 808px\" \/><\/p>\n<p>Before performing any expressions, verify the status of each Prometheus and Node Explorer by clicking initial on the status menu at the highest of the screen so on the Targets menu possibility. As we\u2019ve organized Prometheus to scrape each itself and Node Exporter, you must see each target listed within the <strong>UP<\/strong> state.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-32175\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Targets.png\" alt=\"Prometheus-Dashboard-Targets\" width=\"716\" height=\"406\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Targets.png 1154w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Targets-300x170.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Targets-768x436.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Targets-1024x581.png 1024w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Targets-990x562.png 990w\" sizes=\"(max-width: 716px) 100vw, 716px\" \/><\/p>\n<p>If either Exporter is missing or <strong><span style=\"color: #ff0000;\">displays an error message<\/span><\/strong>, check the service\u2019s status with the subsequent commands:<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20sudo%20systemctl%20status%20prometheus%0A%24%20sudo%20systemctl%20status%20node_exporter\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>The output for each service must report a status of Active: <span style=\"color: #ff0000;\"><strong>active<\/strong><\/span> (running). If a service either is not active in the least or is active however still not operating properly. Follow the on-screen directions and re-trace the previous steps before continuing.<\/p>\n<p>Next, to form certain that the exporters are operating properly, we\u2019ll execute some expressions against <strong>Node Exporter<\/strong>.<\/p>\n<p>First, click on the <strong>Graph menu<\/strong> at the highest of the screen to come back to the Expression Browser.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-32176\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Welcome.png\" alt=\"Prometheus-Dashboard-Welcome\" width=\"750\" height=\"378\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Welcome.png 1154w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Welcome-300x151.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Welcome-768x387.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Welcome-1024x516.png 1024w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-Welcome-990x499.png 990w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>In the Expression field, type <span style=\"color: #008080;\"><strong>node_memory_MemAvailable<\/strong><\/span> and press the <strong>Execute<\/strong> button to update the Console tab with the quantity of memory your server has.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-32177\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal.png\" alt=\"Prometheus-Dashboard-MemTotal\" width=\"777\" height=\"433\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal.png 1153w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-300x168.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-768x428.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-1024x571.png 1024w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-215x120.png 215w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-414x232.png 414w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-990x552.png 990w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/p>\n<p>By default, Node Exporter reports this quantity in bytes. To convert to megabytes, we\u2019ll use math operators to divide by <strong>1024<\/strong> double time.<\/p>\n<p>In the Expression field, <strong>enter node_memory_MemAvailable\/1024\/1024<\/strong> so press the <strong>Execute<\/strong> button.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-32178 \" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB.png\" alt=\"Prometheus-Dashboard-MemTotal-MB\" width=\"742\" height=\"418\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB.png 1153w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB-300x168.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB-768x433.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB-1024x577.png 1024w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB-990x558.png 990w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB-470x264.png 470w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB-640x360.png 640w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB-215x120.png 215w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Dashboard-MemTotal-MB-414x232.png 414w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/p>\n<p>The<strong> Console tab<\/strong> can currently show the ends up in megabytes.<\/p>\n<p>If you wish to verify the results, execute the free command from your terminal. (The <strong>-h flag<\/strong> tells <strong>free<\/strong> to report back in an exceedingly human-readable format, giving a quantity in megabytes.)<\/p>\n[pastacode lang=\u201dbash\u201d manual=\u201d%24%20free%20-h\u201d message=\u201d\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<p>This output contains details regarding memory usage, as well as on the available memory displayed within the on the available column.<\/p>\n<h3 id=\"output-6\"><span style=\"color: #333399;\">Output<\/span><\/h3>\n<pre class=\"code-pre \"><code>              total        used        free      shared  buff\/cache   available\r\nMem:           488M        144M         17M        3.7M        326M        324M\r\nSwap:            0B          0B          0B<\/code><\/pre>\n<p>In addition to basic operators, the Prometheus query language conjointly provides several functions for aggregating results.<\/p>\n<p>In the Expression field, type <strong>avg_over_time(node_memory_MemAvailable[5m])\/1024\/1024<\/strong> and click on on the Execute button. The result is going to be common on the available memory over the last five minutes in megabytes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-32173\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Average-Memory.png\" alt=\"Prometheus-Average-Memory\" width=\"760\" height=\"384\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Average-Memory.png 1154w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Average-Memory-300x152.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Average-Memory-768x388.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Average-Memory-1024x517.png 1024w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Average-Memory-990x500.png 990w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><\/p>\n<p>Now, click on the <strong>Graph tab<\/strong> to show the executed expression as a graph rather than as text.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-32179\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Graph-Average-Memory2.png\" alt=\"Prometheus-Graph-Average-Memory2\" width=\"780\" height=\"557\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Graph-Average-Memory2.png 1362w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Graph-Average-Memory2-300x214.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Graph-Average-Memory2-768x548.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Graph-Average-Memory2-1024x731.png 1024w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Graph-Average-Memory2-990x707.png 990w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2018\/11\/Prometheus-Graph-Average-Memory2-1320x942.png 1320w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/p>\n<p>\u00a0<\/p>\n<p>Finally, whereas still on this tab, hover your mouse over the graph for extra details regarding any specific purpose on the <strong>graph\u2019s X and Y axes<\/strong>.<\/p>\n<p>If you want to find out a lot of regarding making expressions in <strong>Prometheus\u2019 intrinsic web interface<\/strong>, see the<a href=\"https:\/\/prometheus.io\/docs\/querying\/basics\/\" target=\"_blank\" rel=\"noopener\"> Querying Prometheus<\/a> portion of the official documentation.<\/p>\n<h3 id=\"conclusion\"><span style=\"color: #008000;\">Conclusion<\/span><\/h3>\n<ul>\n<li>In this tutorial we have a tendency to<strong> downloaded, configured, secured, and tested a whole Prometheus installation with one further Exporter<\/strong>.<\/li>\n<li>If you want to find out a lot of regarding, however, Prometheus works below the hood, take a glance at How to Query Prometheus on Ubuntu fourteen.04. (Since you have already got Prometheus put in, you\u2019ll skip the primary step.)<\/li>\n<li>To see what else Prometheus will do, visit the <a href=\"https:\/\/prometheus.io\/docs\/introduction\/overview\/\" target=\"_blank\" rel=\"noopener\">official Prometheus documentation<\/a>.<\/li>\n<li>And, to learn more about extending Prometheus, check out the list of available exporters as well as the official <a href=\"https:\/\/grafana.com\/\" target=\"_blank\" rel=\"noopener\">Grafana website.<\/a><\/li>\n<\/ul>\n<p><code class=\"code-highlight language-nginx hljs \"><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Prometheus on Ubuntu 16.04 Prometheus Prometheus could be a powerful and open-source, ASCII text file observance system that collects metrics from your services and stores them in an exceedingly time-series information. It proposes a multi-dimensional data model, a versatile query language, and numerous visualization image prospects through tools like Grafana. Prometheus solely exports metrics [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":14796,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86307,85748],"tags":[86499,86500,86501,86502,86503,86504,86505,86506,86507,86508,86509],"class_list":["post-32165","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nginx","category-ubuntu","tag-install-prometheus-ubuntu","tag-node-exporter-uptime","tag-node_exporter-systemd","tag-prometheus-monitoring","tag-prometheus-node-exporter","tag-prometheus-node-exporter-ubuntu","tag-prometheus-repository","tag-prometheus-systemd","tag-prometheus-systemd-exporter","tag-prometheus-ubuntu-package","tag-prometheus-version"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/32165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=32165"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/32165\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media\/14796"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=32165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=32165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=32165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}