<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[SS Sai's blog]]></title><description><![CDATA[SS Sai's blog]]></description><link>https://sudhindra.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 11:46:02 GMT</lastBuildDate><atom:link href="https://sudhindra.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Setting Up and Configuring a Local GitLab Runner for Efficient CI/CD Testing]]></title><description><![CDATA[The below link will guide you to configure the GitLab runner.
Install GitLab Runner manually on GNU/Linux | GitLab
Alternatively, you can follow the below steps to create a GitLab runner on the local machine:
curl -LJO "https://gitlab-runner-download...]]></description><link>https://sudhindra.hashnode.dev/setting-up-and-configuring-a-local-gitlab-runner-for-efficient-cicd-testing</link><guid isPermaLink="true">https://sudhindra.hashnode.dev/setting-up-and-configuring-a-local-gitlab-runner-for-efficient-cicd-testing</guid><category><![CDATA[GitLab]]></category><category><![CDATA[gitlab-runner]]></category><dc:creator><![CDATA[SS Sai]]></dc:creator><pubDate>Tue, 08 Aug 2023 09:22:03 GMT</pubDate><content:encoded><![CDATA[<p>The below link will guide you to configure the GitLab runner.</p>
<p><a target="_blank" href="https://docs.gitlab.com/runner/install/linux-manually.html">Install GitLab Runner manually on GNU/Linux | GitLab</a></p>
<p>Alternatively, you can follow the below steps to create a GitLab runner on the local machine:</p>
<pre><code class="lang-basic">curl -LJO <span class="hljs-string">"https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb"</span>
sudo dpkg -i gitlab-runner_amd64.deb
sudo gitlab-runner register
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691486381958/0d87fd44-84c7-4d82-aef3-49dfec9cd7b1.png" alt class="image--center mx-auto" /></p>
<p><img alt /></p>
<p><strong><em>Note: The information in the above picture could be obtained from your GitLab account (settings /CI/CD/ runners/ specific runners)</em></strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691486436054/e43fcfad-fcdf-4c81-89fc-d729fe7bb324.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691486448481/2dde38f5-985e-4ec7-87ad-7438a448bd25.png" alt class="image--center mx-auto" /></p>
<p>Output can be seen below on GitLab:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691486467355/57990785-fd3c-4622-b61d-1a8c2d7fd373.png" alt class="image--center mx-auto" /></p>
<p><strong><em>Note: The runner shall always be green in color indicating that the runner is ready to accept the jobs.</em></strong></p>
<p>*** THE END ***</p>
]]></content:encoded></item><item><title><![CDATA[Building a Comprehensive Monitoring Stack: Prometheus, Alertmanager, Slack, and Grafana Integration]]></title><description><![CDATA[Contents:

Architecture

What is Prometheus?

Use cases of Prometheus

Configure Prometheus

Understanding Prometheus.yml file

Configuring Prometheus server + Alertmanager + Node exporter

Integrating Alertmanager with Slack

Integrating Prometheus ...]]></description><link>https://sudhindra.hashnode.dev/building-a-comprehensive-monitoring-stack-prometheus-alertmanager-slack-and-grafana-integration</link><guid isPermaLink="true">https://sudhindra.hashnode.dev/building-a-comprehensive-monitoring-stack-prometheus-alertmanager-slack-and-grafana-integration</guid><category><![CDATA[#prometheus]]></category><category><![CDATA[Grafana Monitoring]]></category><category><![CDATA[monitoring tool]]></category><dc:creator><![CDATA[SS Sai]]></dc:creator><pubDate>Mon, 07 Aug 2023 16:14:25 GMT</pubDate><content:encoded><![CDATA[<p><strong>Contents:</strong></p>
<ol>
<li><p>Architecture</p>
</li>
<li><p>What is Prometheus?</p>
</li>
<li><p>Use cases of Prometheus</p>
</li>
<li><p>Configure Prometheus</p>
</li>
<li><p>Understanding Prometheus.yml file</p>
</li>
<li><p>Configuring Prometheus server + Alertmanager + Node exporter</p>
</li>
<li><p>Integrating Alertmanager with Slack</p>
</li>
<li><p>Integrating Prometheus with Grafana</p>
</li>
</ol>
<p>\======================================================</p>
<p>Let's discuss this in detail:</p>
<p><strong>The Architecture of Prometheus :</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691422126236/97374a21-48ce-49b4-8c4c-c19dc21b4dc2.png" alt class="image--center mx-auto" /></p>
<p><img alt /></p>
<p><strong><em>Understanding the architecture:</em></strong> <em>Prometheus will pull the metrics from Prometheus targets (any application whose analytics has to be monitored) and store the data in its TSDB (Time series Database). We use PromQl(Prometheus Query language) to scrape the data at defined intervals from the above-set Prometheus targets. This data can be read in Prometheus web UI and visualized in third-party apps like Grafana. We shall also install an Alertmanager to push alerts to Email/slack etc.</em></p>
<p><strong>What is Prometheus?</strong></p>
<p>Prometheus is open-source software that collects metrics from <em>targets</em> by "scraping" metrics HTTP endpoints. Supported "targets" include infrastructure platforms (e.g. Kubernetes), applications, and services (e.g. database management systems). With its companion Alertmanager service, Prometheus is a flexible metrics collection and alerting tool.</p>
<p><strong>Use cases of Prometheus:</strong></p>
<p>One of the most popular use cases is gathering numeric metrics from a service that runs constantly. As long as the files are published on an HTTP server, you can query Prometheus by using the hostname, path, and port for the server to scrape the data you need. Monitoring the service metrics for an app can tell you important information about memory utilization, CPU utilization, the number of threads, and more.                     </p>
<p>Another use case for Prometheus involves monitoring the operating system. You’ll want to know when a server’s hard disk is full or when a CPU is always running at 100%. Memory usage, website uptime, and the number of HTTP requests for each page are some other metrics that users commonly track so they can make improvements as needed.</p>
<p><strong>Configure Prometheus:</strong></p>
<p>You may download and configure Prometheus from the URL given below</p>
<p><a target="_blank" href="https://prometheus.io/download/">Download | Prometheus</a></p>
<p>We have to select the <em>tar.gz</em> file for Linux and extract it on our local system by using the below command</p>
<p><code>tar -xvf &lt;file_name&gt;.tar.gz</code></p>
<p>Similarly, an <em>Alertmanager</em> has to be downloaded and installed in the same manner to receive alerts over email/slack.</p>
<p><strong>Below mentioned is a Prometheus configuration file (Prometheus.yml) which is made available for a better understanding :</strong></p>
<p><em>NOTE: The heart of Prometheus is its configuration file so whatever configuration we would like to make or change it can only be done in the main configuration file.</em></p>
<pre><code class="lang-yaml"><span class="hljs-comment"># my global config</span>

<span class="hljs-comment"># we shall mention the scrape intervals in this block of code.That means we shall tell prometheus to fetch the data from targets at given time intervals as mentioned below.</span>

<span class="hljs-attr">global:</span>
  <span class="hljs-attr">scrape_interval:</span> <span class="hljs-string">15s</span> <span class="hljs-comment"># Set the scrape interval to every 15 seconds. Default is every 1 minute.</span>
  <span class="hljs-attr">evaluation_interval:</span> <span class="hljs-string">15s</span> <span class="hljs-comment"># Evaluate rules every 15 seconds. The default is every 1 minute.</span>
  <span class="hljs-comment"># scrape_timeout is set to the global default (10s).</span>

<span class="hljs-comment"># Alertmanager configuration</span>

<span class="hljs-comment"># Under this block of code we have to make configuration related to Alertmanager configuration</span>

<span class="hljs-attr">alerting:</span>
  <span class="hljs-attr">alertmanagers:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">static_configs:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-attr">targets:</span>
           <span class="hljs-bullet">-</span> <span class="hljs-string">localhost:9093</span>

<span class="hljs-comment"># Load rules once and periodically evaluate them according to the global 'evaluation_interval'.</span>

<span class="hljs-comment"># Under this block of code we shall provide the alerting rules file.</span>

<span class="hljs-attr">rule_files:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-string">prometheus_rules.yml</span>
  <span class="hljs-comment"># - "first_rules.yml"</span>
  <span class="hljs-comment"># - "second_rules.yml"</span>

<span class="hljs-comment"># A scrape configuration containing exactly one endpoint to scrape:</span>

<span class="hljs-comment"># In here we mention the metrics that we want to scrape. we mention the endpoint of the target.</span>

<span class="hljs-comment"># Below we have 3 jobs namely prometheus and node exporter running at different ports.That means the data is being scraped from 3 endpoints and displayed on prometheus UI.</span>

<span class="hljs-attr">scrape_configs:</span>
  <span class="hljs-comment"># The job name is added as a label `job=&lt;job_name&gt;` to any timeseries scraped from this config.</span>

  <span class="hljs-bullet">-</span> <span class="hljs-attr">job_name:</span> <span class="hljs-string">"prometheus"</span>

    <span class="hljs-comment"># metrics_path defaults to '/metrics'</span>
    <span class="hljs-comment"># scheme defaults to 'http'.</span>

    <span class="hljs-attr">static_configs:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">targets:</span> [<span class="hljs-string">"localhost:9090"</span>]

  <span class="hljs-bullet">-</span> <span class="hljs-attr">job_name:</span> <span class="hljs-string">"node-exporter"</span>

    <span class="hljs-attr">static_configs:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">targets:</span> [<span class="hljs-string">"localhost:9100"</span>]

  <span class="hljs-bullet">-</span> <span class="hljs-attr">job_name:</span> <span class="hljs-string">"grafana"</span>

    <span class="hljs-attr">static_configs:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">targets:</span> [ <span class="hljs-string">"localhost:3000"</span> ]
</code></pre>
<p>After extracting the Prometheus.tar.gz file which was downloaded from <a target="_blank" href="https://prometheus.io/download/">Download | Prometheus</a>, we have to fire the command mentioned below to run Prometheus.</p>
<p><code>./prometheus</code></p>
<p>This will run the Prometheus on <a target="_blank" href="HTTP://localhost:9090">HTTP://localhost:9090</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691422758359/821687f3-3f50-4ec3-854a-e08a415d9aab.png" alt="Prometheus homepage at localhost:9090" class="image--center mx-auto" /></p>
<p>Here, we can see a search bar that says “Expression“That's where we write our queries, and the return values are displayed as shown below.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691422897497/9391abc3-f1c6-4a6d-967d-d9795e39d4af.png" alt class="image--center mx-auto" /></p>
<p><img alt /></p>
<p>When we write a query “up“ it displays the status of the total jobs that we have mentioned in our scrape configs in the Prometheus.yml file (refer to sample yaml file above). Upon looking at the above image whether our job is running or not, it displays “1“ which means it's active and running and if it displays “0“ that means the job is not running to scrape the metrics.</p>
<ul>
<li><strong>Exporters:</strong></li>
</ul>
<p>A Prometheus exporter acts as a proxy between an application and the Prometheus server. Exporters use a simple, text-based, key-value format to scrape and expose metrics over time, via HTTP, for aggregation and decision-making.</p>
<p><strong>In simple words, it acts as a bridge between our target (where we would like to scrape the metrics from) and the Prometheus server.</strong></p>
<p>In our scenario, we are using <em>Node exporter</em> just to showcase that when it's not responding/down it creates an alert that can be received on Email/slack.</p>
<p>Node exporter can be downloaded from <a target="_blank" href="https://prometheus.io/download/">Download | Prometheus</a> and we must have to extract the files to make the node_exporter run by using the below-given command</p>
<p><code>./node_exporter</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691423067370/3b2dba66-f023-4b16-ada7-60fe8f9de9a1.png" alt="node_exporter running at HTTP://localhost:9100" class="image--center mx-auto" /></p>
<p>Now, we shall write a simple alert rule in <em>Prometheus_rules.yml</em> that informs us if our node exporter is running / down.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">groups:</span>

<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">alert_rules</span>
  <span class="hljs-attr">rules:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">alert:</span> <span class="hljs-string">NodeExporterDown</span>
      <span class="hljs-attr">expr:</span> <span class="hljs-string">up{job="node-exporter"}</span> <span class="hljs-string">==</span> <span class="hljs-number">0</span>

      <span class="hljs-attr">labels:</span>
        <span class="hljs-attr">severity:</span> <span class="hljs-string">critical</span>
</code></pre>
<p>we have to mention the <em>Proemtheus_rules.yml</em> file name in the <em>rule_files</em> section of our main Prometheus configuration file i.e, <em>Prometheus.yml</em></p>
<ul>
<li><strong>Alert Manager</strong></li>
</ul>
<p>To view the alerts and send them via Email/slack, we must have to install <em>Alertmanager</em> which is available here to download <a target="_blank" href="https://prometheus.io/download/">Download | Prometheus</a> and we must have to extract the files to make the alert manager run by using the below-given command</p>
<p><code>./alertmanager</code></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691423471544/70da2b09-c76c-4740-a220-9fc62d90f68f.png" alt="the Alertmanager running at HTTP://localhost:9093" class="image--center mx-auto" /></p>
<p><img alt /></p>
<p><em>Alertmanager.yml</em> file is written as below for slack configuration. However, we can configure the same for Email using an SMTP server.</p>
<pre><code class="lang-yaml"><span class="hljs-attr">route:</span>
  <span class="hljs-attr">receiver:</span> <span class="hljs-string">admin</span>

<span class="hljs-attr">receivers:</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">admin</span>
  <span class="hljs-attr">slack_configs:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">channel:</span> <span class="hljs-string">'#prometheus'</span>
    <span class="hljs-attr">api_url:</span> <span class="hljs-string">'https://hooks.slack.com/services/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'</span>
</code></pre>
<ul>
<li><strong>Slack Configuration</strong></li>
</ul>
<p>On Slack, we must add an app called <strong>Incoming WebHooks</strong> available in the Apps directory as shown below</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691423560285/fc81039a-cb1c-4000-a236-f52972eb32e2.png" alt class="image--center mx-auto" /></p>
<p>use the webhook URL in the above Alertmanager.yml (api_url)</p>
<p>For illustration purposes, I shall make the node_exporter shut down which is currently running on <a target="_blank" href="HTTP://localhost:9100">HTTP://localhost:9100</a> so that we can see that an alert is generated.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691423822922/a4dee416-c53e-4005-937b-af71e643b845.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691423921460/85393a38-8349-4355-a51a-399f06b3b94e.png" alt="On HTTP://localhost:9090/alerts we can notice that node_exporter has been down and is in a firing state" class="image--center mx-auto" /></p>
<p><img alt /></p>
<p>on <a target="_blank" href="HTTP://localhost:9093">HTTP://localhost:9093</a> Alertmanager has also captured an alert regarding the node_exporter downtime and sent the information to Slack as shown below</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691423983708/82b1afea-b252-441d-95c5-5f36a8e45eca.png" alt class="image--center mx-auto" /></p>
<p>since we have configured Slack, node_exporter downtime is being displayed</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691424047989/26c27520-db96-44ab-88de-b72f436c7209.png" alt class="image--center mx-auto" /></p>
<ul>
<li><strong>Grafana:</strong></li>
</ul>
<p>Prometheus collects rich metrics and provides a powerful querying language and Grafana transforms metrics into meaningful visualizations. Both are compatible with many if not most, data source types.</p>
<p>It is a third-party tool to visualize beautiful graphs drawn out of data from Prometheus.</p>
<p>You may download Grafana from the below URL</p>
<p><a target="_blank" href="https://grafana.com/grafana/download">Download Grafana | Grafana Labs</a></p>
<p>After configuring Grafana on your local system, enter the command shown below to make Grafana accessible at <a target="_blank" href="HTTP://localhost:3000">HTTP://localhost:3000</a></p>
<p><code>sudo systemctl start grafana-server</code></p>
<p>Grafana Homepage at <a target="_blank" href="HTTP://localhost:3000">HTTP://localhost:3000</a> is shown below</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691424171979/64a2d230-a6ad-4bc3-a4e4-bfa5b4bc21a8.png" alt="Grafana Homepage at HTTP://localhost:3000" class="image--center mx-auto" /></p>
<p>In configuration settings, we must integrate our Prometheus</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691424219109/7f6e4781-fe58-4a95-87f4-999ccc592331.png" alt class="image--center mx-auto" /></p>
<p>In settings, we shall provide the HTTP URL of our Prometheus Server so that it pulls data from that endpoint</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691424286841/0e2b1895-aa85-4d4c-981c-91f85997491d.png" alt class="image--center mx-auto" /></p>
<p>Grafana metrics are showcased here in which you can see whether your jobs are running or in firing state</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691424371927/68de45a5-bb64-4845-b7a3-4331028a1165.png" alt class="image--center mx-auto" /></p>
<p>Prometheus alerts showcasing the firing alerts of node_exporter which was down/not working</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1691424436531/32341b40-4f56-4c9b-bce3-52c743c2636b.png" alt class="image--center mx-auto" /></p>
<p>*** THE END ***</p>
<p><img alt /></p>
]]></content:encoded></item></channel></rss>