{"id":1755,"date":"2020-07-27T13:15:00","date_gmt":"2020-07-27T10:15:00","guid":{"rendered":"https:\/\/www.virtono.com\/community\/?p=1755"},"modified":"2020-07-28T03:29:25","modified_gmt":"2020-07-28T00:29:25","slug":"how-to-install-and-configure-prometheus-on-a-linux-server","status":"publish","type":"post","link":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/","title":{"rendered":"How To Install and Configure Prometheus On a Linux Server"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Introduction\" title=\"Introduction\">Introduction<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Prerequisite\" title=\"Prerequisite:\">Prerequisite:<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Setup_Prometheus_Binaries\" title=\"Setup Prometheus Binaries\">Setup Prometheus Binaries<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_1_Updating_repos\" title=\"Step 1:  Updating repos\">Step 1:  Updating repos<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_2_Creating_user_and_directories\" title=\"Step 2: Creating user and directories\">Step 2: Creating user and directories<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_3_Getting_Prometheus\" title=\"Step 3: Getting Prometheus\">Step 3: Getting Prometheus<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_4_Downloading_and_Installing_Prometheus\" title=\"Step 4: Downloading and Installing Prometheus\">Step 4: Downloading and Installing Prometheus<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_5_Copying_prometheus_and_promtool\" title=\"Step 5: Copying prometheus and promtool\">Step 5: Copying prometheus and promtool<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_6_Changing_ownership\" title=\"Step 6: Changing ownership\">Step 6: Changing ownership<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_7_Moving_consoles_and_libraries\" title=\"Step 7: Moving consoles and libraries\">Step 7: Moving consoles and libraries<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Setup_Prometheus_Configuration\" title=\"Setup Prometheus Configuration\">Setup Prometheus Configuration<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_1_Create_prometheusyml_file\" title=\"Step 1:&nbsp;Create prometheus.yml file.\">Step 1:&nbsp;Create prometheus.yml file.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_2_Edit_prometheusyml_file\" title=\"Step 2:&nbsp;Edit prometheus.yml file.\">Step 2:&nbsp;Edit prometheus.yml file.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_3_Ownership_change_for_prometheusyml_file\" title=\"Step 3:&nbsp;Ownership change for prometheus.yml file.\">Step 3:&nbsp;Ownership change for prometheus.yml file.<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Setup_Prometheus_Service_File\" title=\"Setup Prometheus Service File\">Setup Prometheus Service File<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_1_Create_a_prometheus_service_file\" title=\"Step 1:&nbsp;Create a prometheus&nbsp;service file.\">Step 1:&nbsp;Create a prometheus&nbsp;service file.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_2_Edit_prometheusservice\" title=\"Step 2:&nbsp;Edit prometheus.service\">Step 2:&nbsp;Edit prometheus.service<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Step_3_Reload_the_systemd\" title=\"Step 3:&nbsp;Reload the systemd\">Step 3:&nbsp;Reload the systemd<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/#Access_Prometheus_Web_UI\" title=\"Access Prometheus Web UI\">Access Prometheus Web UI<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Introduction\"><\/span><strong>Introduction<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Prometheus is an open-source monitoring system developed by SoundCloud. Development on Prometheus started back in 2012 when SoundCloud felt that the existing monitoring systems were proving insufficient for their needs. It uses a time-series database just like Druid, InfluxDB, Graphite. <\/p>\n\n\n\n<p>However, Prometheus is able to work on a multi-dimensional data model, uses a powerful query to language to leverage this data model properly. Uses pull method over HTTP to record real-time metrics, this helps admins to easily fine-tune the capabilities to their needs which in turn produces more accurate reports.<\/p>\n\n\n\n<p>Prometheus has a browser-based tool called PromDash to build and view dashboards that use SQL backend. The Data model stores all data as time series: streams of timestamped values belonging to the same metric and the same set of labeled dimensions.<\/p>\n\n\n\n<p>Another main attraction of Prometheus is that it uses single server nodes that are autonomous. How many times have you just given up trying to configure a distributed system cluster? Well, that won\u2019t be the case this time.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Prerequisite\"><\/span>Prerequisite:<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>To follow this tutorial, you will need:<\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\"><li>&nbsp;sudo access to your system.<\/li><li>Working internet connection as we will download the Prometheus Linux Binary.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Setup_Prometheus_Binaries\"><\/span><strong>Setup Prometheus Binaries<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_1_Updating_repos\"><\/span><strong>Step 1:<\/strong>  Updating repos<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>As always, our first step will be to update the yum package repositories.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>yum update -y<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_2_Creating_user_and_directories\"><\/span><strong><strong>Step 2:<\/strong><\/strong> Creating user and directories<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Let\u2019s create a Prometheus user, required directories, and make prometheus user as the owner of those directories.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>useradd &#8211;no-create-home &#8211;shell \/bin\/false prometheus<\/p><p>&nbsp;mkdir \/etc\/prometheus<\/p><p>&nbsp;mkdir \/var\/lib\/prometheus<\/p><p>&nbsp;chown prometheus:prometheus \/etc\/prometheus<\/p><p>&nbsp;chown prometheus:prometheus \/var\/lib\/prometheus<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_3_Getting_Prometheus\"><\/span><strong><strong><strong>Step 3:<\/strong><\/strong><\/strong> Getting Prometheus<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Go to the official&nbsp;Prometheus&nbsp;downloads page&nbsp;and get the download link for Linux binary by right-clicking the binary and clicking on Copy Link next.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"202\" data-attachment-id=\"1758\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/attachment\/image-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image.png?fit=602%2C202&amp;ssl=1\" data-orig-size=\"602,202\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image.png?fit=300%2C101&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image.png?fit=602%2C202&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image.png?resize=602%2C202&#038;ssl=1\" alt=\"\" class=\"wp-image-1758\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image.png?w=602&amp;ssl=1 602w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image.png?resize=300%2C101&amp;ssl=1 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_4_Downloading_and_Installing_Prometheus\"><\/span><strong><strong><strong>Step 4:<\/strong><\/strong><\/strong> Downloading and Installing Prometheus<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Download the source using wget, untar it, and rename the&nbsp;extracted folder to prometheus-files.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>wget https:\/\/github.com\/prometheus\/prometheus\/releases\/download\/v2.20.0-rc.1\/prometheus-2.20.0-rc.1.linux-amd64.tar.gz<\/p><p>tar -xvf prometheus-2.20.0-rc.1.linux-amd64.tar.gz<\/p><p>mv prometheus-2.20.0-rc.1.linux-amd64 prometheus-files<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_5_Copying_prometheus_and_promtool\"><\/span><strong><strong><strong>Step 5<\/strong><\/strong><\/strong>: Copying prometheus and promtool<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>You will have to copy&nbsp;prometheus&nbsp;and promtool&nbsp;binary from&nbsp;prometheus-files folder to&nbsp;\/usr\/local\/bin.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>cp prometheus-files\/prometheus \/usr\/local\/bin\/<\/p><p>cp prometheus-files\/promtool \/usr\/local\/bin\/<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_6_Changing_ownership\"><\/span><strong><strong><strong>Step <\/strong><\/strong><\/strong>6: Changing ownership<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Change the ownership to prometheus user.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>chown prometheus:prometheus \/usr\/local\/bin\/prometheus<\/p><p>chown prometheus:prometheus \/usr\/local\/bin\/promtool<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_7_Moving_consoles_and_libraries\"><\/span><strong><strong><strong>Step <\/strong><\/strong><\/strong>7: Moving consoles and libraries<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Move the&nbsp;consoles&nbsp;and&nbsp;console_libraries&nbsp;directories from prometheus-files to&nbsp;\/etc\/prometheus&nbsp;folder and change the ownership to prometheus&nbsp;user.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&nbsp;cp -r prometheus-files\/consoles \/etc\/prometheus<\/p><p>&nbsp;cp -r prometheus-files\/console_libraries \/etc\/prometheus<\/p><p>&nbsp;chown -R prometheus:prometheus \/etc\/prometheus\/consoles &nbsp;<\/p><p>chown -R prometheus:prometheus \/etc\/prometheus\/console_libraries<\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Setup_Prometheus_Configuration\"><\/span><strong>Setup Prometheus Configuration<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>prometheus.yml holds all the prometheus configurations. The file be present in&nbsp;\/etc\/prometheus\/prometheus.yml file.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_1_Create_prometheusyml_file\"><\/span>Step 1:&nbsp;Create <em>prometheus.yml file.<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Create the prometheus.yml file.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>touch \/etc\/prometheus\/prometheus.yml<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_2_Edit_prometheusyml_file\"><\/span>Step 2:&nbsp;Edit <em>prometheus.yml file.<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Open the file using vim or any file editor of your liking and copy the following contents to the prometheus.yml file.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>global:<\/p><p>&nbsp; scrape_interval: 10s<\/p><p>scrape_configs:<\/p><p>&nbsp; &#8211; job_name: &#8216;prometheus&#8217;<\/p><p>&nbsp;&nbsp;&nbsp; scrape_interval: 5s<\/p><p>&nbsp;&nbsp;&nbsp; static_configs:<\/p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8211; targets: [&#8216;localhost:9090&#8217;]<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_3_Ownership_change_for_prometheusyml_file\"><\/span>Step 3:&nbsp;Ownership change for <em>prometheus.yml file.<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Change the ownership of the file to prometheus user.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&nbsp;chown prometheus:prometheus \/etc\/prometheus\/prometheus.yml<\/p><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Setup_Prometheus_Service_File\"><\/span><strong>Setup Prometheus Service File<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_1_Create_a_prometheus_service_file\"><\/span>Step 1:&nbsp;Create a prometheus&nbsp;service file.<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&nbsp;vi \/etc\/systemd\/system\/prometheus.service<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_2_Edit_prometheusservice\"><\/span>Step 2:&nbsp;Edit <em>prometheus.service<\/em><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Copy the following content to the file.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>[Unit]<\/p><p>Description=Prometheus<\/p><p>Wants=network-online.target<\/p><p>After=network-online.target<\/p><p>[Service]<\/p><p>User=prometheus<\/p><p>Group=prometheus<\/p><p>Type=simple<\/p><p>ExecStart=\/usr\/local\/bin\/prometheus \\<\/p><p>&nbsp;&nbsp;&nbsp; &#8211;config.file \/etc\/prometheus\/prometheus.yml \\<\/p><p>&nbsp;&nbsp;&nbsp; &#8211;storage.tsdb.path \/var\/lib\/prometheus\/ \\<\/p><p>&nbsp;&nbsp;&nbsp; &#8211;web.console.templates=\/etc\/prometheus\/consoles \\<\/p><p>&nbsp;&nbsp;&nbsp; &#8211;web.console.libraries=\/etc\/prometheus\/console_libraries<\/p><p>[Install]<\/p><p>WantedBy=multi-user.target<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_3_Reload_the_systemd\"><\/span>Step 3:&nbsp;Reload the systemd<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Reload the systemd service to register the prometheus service and start the prometheus service.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>systemctl daemon-reload<\/p><p>&nbsp;systemctl start prometheus<\/p><\/blockquote>\n\n\n\n<p>Check the prometheus service status using the following command.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&nbsp;systemctl status prometheus<\/p><\/blockquote>\n\n\n\n<p>The status should show the active state as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"117\" data-attachment-id=\"1760\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/attachment\/image-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-1.png?fit=602%2C117&amp;ssl=1\" data-orig-size=\"602,117\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-1.png?fit=300%2C58&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-1.png?fit=602%2C117&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-1.png?resize=602%2C117&#038;ssl=1\" alt=\"\" class=\"wp-image-1760\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-1.png?w=602&amp;ssl=1 602w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-1.png?resize=300%2C58&amp;ssl=1 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Access_Prometheus_Web_UI\"><\/span><strong>Access Prometheus Web UI<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Now you will be able to access the prometheus&nbsp;UI on 9090 port of the prometheus&nbsp;server.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>http:\/\/&lt;prometheus-ip&gt;:9090\/graph<\/p><\/blockquote>\n\n\n\n<p>You should be able to see the following UI as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"217\" data-attachment-id=\"1761\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-prometheus-on-a-linux-server\/attachment\/image-2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-2.png?fit=602%2C217&amp;ssl=1\" data-orig-size=\"602,217\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-2\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-2.png?fit=300%2C108&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-2.png?fit=602%2C217&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-2.png?resize=602%2C217&#038;ssl=1\" alt=\"\" class=\"wp-image-1761\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-2.png?w=602&amp;ssl=1 602w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/image-2.png?resize=300%2C108&amp;ssl=1 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<p>Currently, we have only configured Prometheus. We need to register a target to actually some metrics from the system.<\/p>\n\n\n\n<p>In order to do this please follow along to the next tutorial: <a href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-monitor-linux-servers-using-prometheus-node-exporter\/\" target=\"_blank\" rel=\"noreferrer noopener\">Prometheus Node Exporter Guide<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Prometheus is an open-source monitoring system developed by SoundCloud. Development on Prometheus started back in 2012 when SoundCloud felt that the existing monitoring systems were proving insufficient for their needs. It uses a time-series database just like Druid, InfluxDB, Graphite. However, Prometheus is able to work on a multi-dimensional<\/p>\n","protected":false},"author":4,"featured_media":1765,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,3],"tags":[26,69,71,70],"class_list":["post-1755","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledgebase","category-tutorial-how-to","tag-linux","tag-prometheus","tag-prometheus-centos","tag-prometheus-linux"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/1_yz1TgEsIb9qNtmv2O-SZsg.png?fit=1600%2C900&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7ISfL-sj","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3459,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-prometheus-and-grafana-on-ubuntu\/","url_meta":{"origin":1755,"position":0},"title":"How to install Prometheus and Grafana on Ubuntu","author":"George B.","date":"June 6, 2023","format":false,"excerpt":"Prometheus and Grafana are powerful open-source tools used for monitoring and visualizing system metrics, making them essential components of any modern infrastructure. In this comprehensive guide, we will walk you through the step-by-step process of installing Prometheus and Grafana on an Ubuntu system. By the end of this tutorial, you'll\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/06\/How-to-install-Prometheus-and-Grafana-on-Ubuntu.png?fit=600%2C330&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/06\/How-to-install-Prometheus-and-Grafana-on-Ubuntu.png?fit=600%2C330&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/06\/How-to-install-Prometheus-and-Grafana-on-Ubuntu.png?fit=600%2C330&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":1766,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-monitor-linux-servers-using-prometheus-node-exporter\/","url_meta":{"origin":1755,"position":1},"title":"How To Monitor Linux Servers Using Prometheus Node Exporter","author":"Shreyash Sharma","date":"July 28, 2020","format":false,"excerpt":"There are multiple exporters that can be used to collect all the Linux server related metrics and statistics for monitoring. However, Node is the best way to monitor Linux Servers Using Prometheus In this article we will learn how to setup Prometheus node exporter. This will be used to export\u2026","rel":"","context":"In &quot;Knowledgebase&quot;","block_context":{"text":"Knowledgebase","link":"https:\/\/www.virtono.com\/community\/category\/knowledgebase\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/prometheus-node-exporter-status.png?fit=1200%2C472&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/prometheus-node-exporter-status.png?fit=1200%2C472&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/prometheus-node-exporter-status.png?fit=1200%2C472&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/prometheus-node-exporter-status.png?fit=1200%2C472&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/prometheus-node-exporter-status.png?fit=1200%2C472&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3695,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-prometheus-on-kubernetes\/","url_meta":{"origin":1755,"position":2},"title":"How to Deploy Prometheus on Kubernetes","author":"George B.","date":"July 30, 2023","format":false,"excerpt":"In this tutorial, we'll discuss how to set up Prometheus on Kubernetes. We'll assume that you've already installed Helm and K3s. If you don't have K3s and Helm installed you can follow our guide. Prometheus has established itself as a top open-source option for monitoring and alerting systems. It is\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-Deploy-Prometheus-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1774,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-integrate-and-visualize-prometheus-metrics-in-grafana\/","url_meta":{"origin":1755,"position":3},"title":"How To Integrate and Visualize Prometheus Metrics In Grafana","author":"Shreyash Sharma","date":"July 29, 2020","format":false,"excerpt":"Generally speaking, Prometheus is good, after all he was a titan, created humanity, gave us fire. And the other Prometheus is also good however we need a way to visualize it. Currently the official recommendation is to use Grafana. Prometheus has a plugin for this that can be configured as\u2026","rel":"","context":"In &quot;Knowledgebase&quot;","block_context":{"text":"Knowledgebase","link":"https:\/\/www.virtono.com\/community\/category\/knowledgebase\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/monitoring-prometheus-with-grafana.jpg?fit=564%2C336&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/monitoring-prometheus-with-grafana.jpg?fit=564%2C336&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2020\/07\/monitoring-prometheus-with-grafana.jpg?fit=564%2C336&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3761,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-grafana-on-kubernetes\/","url_meta":{"origin":1755,"position":4},"title":"How to Deploy Grafana on Kubernetes","author":"George B.","date":"August 24, 2023","format":false,"excerpt":"This article will walk you through the process of deploying Grafana on Kubernetes, specifically using k3s and Helm, and making it accessible via a NodePort on your VPS (Virtual Private Server). We'll assume you have k3s and Helm already installed. If not, please refer to their respective official documentation to\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/08\/How-to-Deploy-Grafana-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3496,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-tune-your-mysql-server-for-optimal-performance\/","url_meta":{"origin":1755,"position":5},"title":"How to Tune Your MySQL Server for Optimal Performance","author":"George B.","date":"June 12, 2023","format":false,"excerpt":"In this step-by-step guide, we will walk you through the process of tuning your MySQL server, helping you enhance its efficiency and responsiveness. MySQL is one of the most popular open-source relational database management systems, widely used for various applications and websites. However, as your database grows in size and\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/06\/1.png?fit=600%2C330&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/06\/1.png?fit=600%2C330&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/06\/1.png?fit=600%2C330&ssl=1&resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/1755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/comments?post=1755"}],"version-history":[{"count":7,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/1755\/revisions"}],"predecessor-version":[{"id":1813,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/1755\/revisions\/1813"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media\/1765"}],"wp:attachment":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media?parent=1755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/categories?post=1755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/tags?post=1755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}