<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Deepanshu Anand</title>
    <description>The latest articles on DEV Community by Deepanshu Anand (@deepanshu0810).</description>
    <link>https://dev.to/deepanshu0810</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F908707%2F4318356f-404b-467d-a210-29580aeffd10.jpeg</url>
      <title>DEV Community: Deepanshu Anand</title>
      <link>https://dev.to/deepanshu0810</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/deepanshu0810"/>
    <language>en</language>
    <item>
      <title>Alerts and Alert Manager in Prometheus</title>
      <dc:creator>Deepanshu Anand</dc:creator>
      <pubDate>Tue, 01 Aug 2023 04:42:30 +0000</pubDate>
      <link>https://dev.to/deepanshu0810/alerts-and-alert-manager-in-prometheus-akm</link>
      <guid>https://dev.to/deepanshu0810/alerts-and-alert-manager-in-prometheus-akm</guid>
      <description>&lt;p&gt;In the last &lt;a href="https://t.co/mONwe4DRVY" rel="noopener noreferrer"&gt;blog&lt;/a&gt; we walked through the process of setting up a Prometheus server with Grafana dashboard. In this blog we will be setting up the alertmanager in the prometheus server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure of an alertmanager and the prometheus server
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9mdun8pt7zunvx1gk23k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9mdun8pt7zunvx1gk23k.png" alt="alertmanager1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Defining rules for prometheus server
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;In the last blog we created a &lt;code&gt;alerts.rules&lt;/code&gt; config files, this file will contain all the rules for our prometheus server
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /opt/prometheus/
vim alerts.rules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;groups&lt;/span&gt;:
  - name: Linux-disk-space
    rules:
     - alert: Linux-DiskSpaceAlert
       &lt;span class="nb"&gt;expr&lt;/span&gt;:  &lt;span class="o"&gt;(&lt;/span&gt;node_filesystem_avail_bytes/node_filesystem_size_bytes&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;100 &amp;lt; 20
       &lt;span class="k"&gt;for&lt;/span&gt;: 5m
       annotations:
        summary: &lt;span class="s2"&gt;"Disk space is running low"&lt;/span&gt;
        description: &lt;span class="s1"&gt;'The available disk space on {{ $labels.instance }} is less than 80percent'&lt;/span&gt;


  - name: Linux-memory-utilisation
    rules:
     - alert: Linux-MemoryUsage
       &lt;span class="nb"&gt;expr&lt;/span&gt;: &lt;span class="o"&gt;((&lt;/span&gt;node_memory_MemAvailable_bytes/node_memory_MemTotal_bytes&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;100 &lt;span class="o"&gt;)&lt;/span&gt; &amp;lt; 20
       &lt;span class="k"&gt;for&lt;/span&gt;: 2m
       annotations:
        Summary: &lt;span class="s2"&gt;"High RAM Usage"&lt;/span&gt;
        description: &lt;span class="s1"&gt;'Memory usage on {{ $labels.instance }} is greater than 80percent'&lt;/span&gt;

  - name: Linux-up
    rules:
     - alert: Linux-up-status
       &lt;span class="nb"&gt;expr&lt;/span&gt;: up&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;job&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'node-exporter'&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; &amp;lt; 1
       &lt;span class="k"&gt;for&lt;/span&gt;: 2m
       annotations:
        Summary: &lt;span class="s2"&gt;"Linux machine/exporter down"&lt;/span&gt;
        description: &lt;span class="s1"&gt;'{{ $labels.instance }} metrics could not be fetched machine may be down'&lt;/span&gt;

  - name: Windows-memory-utilisation
    rules:
     - alert: Windows-MemoryUsage
       &lt;span class="nb"&gt;expr&lt;/span&gt;:  &lt;span class="o"&gt;((&lt;/span&gt;windows_os_physical_memory_free_bytes/windows_cs_physical_memory_bytes&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;100 &lt;span class="o"&gt;)&lt;/span&gt; &amp;lt; 20
       &lt;span class="k"&gt;for&lt;/span&gt;: 2m
       annotations:
        Summary: &lt;span class="s2"&gt;"High RAM Usage"&lt;/span&gt;
        description: &lt;span class="s1"&gt;'RAM usage on {{ $labels.instance }} is higher than 80 percent'&lt;/span&gt;

  - name: Windows-diskspace-utilisation
    rules:
     - alert: Windows-diskspace-utilisation
       &lt;span class="nb"&gt;expr&lt;/span&gt;: &lt;span class="o"&gt;(&lt;/span&gt;windows_logical_disk_free_bytes/windows_logical_disk_size_bytes&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;100 &amp;lt; 20
       &lt;span class="k"&gt;for&lt;/span&gt;: 2m
       annotations:
        Summary: &lt;span class="s2"&gt;"Disk Space running low"&lt;/span&gt;
        description: &lt;span class="s1"&gt;'Diskspace utilisation on {{ $labels.instance }} is higher than 80 percent'&lt;/span&gt;

  - name: Windows-up
    rules:
     - alert: Windows-up-status
       &lt;span class="nb"&gt;expr&lt;/span&gt;: up&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;job&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'win-exporter'&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; &amp;lt; 1
       &lt;span class="k"&gt;for&lt;/span&gt;: 2m
       annotations:
        Summary: &lt;span class="s2"&gt;"Windows machine/exporter down"&lt;/span&gt;
        description: &lt;span class="s1"&gt;'{{ $labels.instance }} metrics could not be fetched machine may be down'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setting the alertmanager
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;for this walkthrough we will be setting up gmail alerts using gmail smtp server&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1. setting up gmail smtp server
&lt;/h3&gt;

&lt;p&gt;To set up a gmail smtp server for prometheus we need a gmail account say &lt;code&gt;sender@gmail.com&lt;/code&gt; on which 2-step verification is enabled&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkwephk0abfi90ss88ex0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkwephk0abfi90ss88ex0.png" alt="step-1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7stqye98t0224zvdmo71.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7stqye98t0224zvdmo71.png" alt="step-2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2npne6oq8f2a56j1ouwa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2npne6oq8f2a56j1ouwa.png" alt="step-3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;your app password is your &lt;code&gt;secret-key&lt;/code&gt; which will be used in &lt;code&gt;alertmanager.yml&lt;/code&gt; as &lt;code&gt;auth_password&lt;/code&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl3d1t63mc9933jikvllq.png" alt="step-4"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. config file for alertmanager
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /opt/prometheus/
&lt;span class="nb"&gt;touch &lt;/span&gt;alertmanager.yml
vim alertmanager.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;global:
  resolve_timeout: 1m

route:
  receiver: &lt;span class="s1"&gt;'gmail-alert-notification'&lt;/span&gt;
  group_wait: 10s
  group_interval: 1m
  repeat_interval: 1m

&lt;span class="c"&gt;# sender@gmail is the gmail account on which you have generated your app password&lt;/span&gt;
receivers:
- name: &lt;span class="s1"&gt;'gmail-alert-notification'&lt;/span&gt;
  email_configs:
    - to: &lt;span class="s1"&gt;'receiver@gmail.com'&lt;/span&gt;
      from: &lt;span class="s1"&gt;'sender@gmail.com'&lt;/span&gt;
      smarthost: smtp.gmail.com:587
      auth_username: &lt;span class="s1"&gt;'sender@gmail.com'&lt;/span&gt;
      auth_identity: &lt;span class="s1"&gt;'sender@gmail.com'&lt;/span&gt;
      auth_password: &lt;span class="s1"&gt;'secret-key'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. installing the alertmanager docker image
&lt;/h3&gt;

&lt;p&gt;We will be installing the docker image of alertmanager on the same machine on which we installed the prometheus server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 9093:9093 &lt;span class="nt"&gt;-v&lt;/span&gt; /opt/prometheus/alertmanager.yml:/etc/alertmanager/alertmanager.yml &lt;span class="nt"&gt;--restart&lt;/span&gt; unless-stopped &lt;span class="nt"&gt;--name&lt;/span&gt; alertmanager prom/alertmanager
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;verify that alertmanager is running by visiting &lt;code&gt;alertmanager-ip:9093&lt;/code&gt; in your browser&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Adding rules and alertmanager in the prometheus
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /opt/prometheus/
vim prometheus.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;global:
  scrape_interval: 15s

scrape_configs:
  - job_name: &lt;span class="s1"&gt;'prometheus'&lt;/span&gt;
    static_configs:
      - targets: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'localhost:9090'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;

  - job_name: &lt;span class="s1"&gt;'node-exporter'&lt;/span&gt;
    static_configs:
      - targets: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'ubuntu_id:9100'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;

  - job_name: &lt;span class="s1"&gt;'win-exporter'&lt;/span&gt;
    static_configs:
      - targets: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'windows_ip:9182'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;

rule_files:
  - &lt;span class="s2"&gt;"/etc/prometheus/alerts.rules"&lt;/span&gt;

alerting:
  alertmanagers:
    - static_configs:
      - targets:
        - &lt;span class="s2"&gt;"ubuntu_ip:9093"&lt;/span&gt;
&lt;span class="c"&gt;# ubuntu_ip is the IP on which the alertmanager container is installed, use localcost:9093 if same as prometheus server&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# if prometheus docker is already running run the following command&lt;/span&gt;
docker restart prometheus

&lt;span class="c"&gt;# if not run the following&lt;/span&gt;
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 9090:9090 &lt;span class="nt"&gt;-v&lt;/span&gt; /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml &lt;span class="nt"&gt;-v&lt;/span&gt; /opt/prometheus/alerts.rules:/etc/prometheus/alerts.rules &lt;span class="nt"&gt;--restart&lt;/span&gt; unless-stopped &lt;span class="nt"&gt;--name&lt;/span&gt; prometheus prom/prometheus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your prometheus and alertmanager is ready and can be verified by visiting &lt;code&gt;prometheus_ip:9090&lt;/code&gt; and &lt;code&gt;alertmanager_ip:9093&lt;/code&gt; on your browser&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I hope this blog helped you understand how to setup prometheus with alertmanager. Stay connected for more such blogs&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>monitoring</category>
      <category>alertmanager</category>
      <category>prometheu</category>
      <category>gmail</category>
    </item>
    <item>
      <title>Monitoring Systems with Prometheus and Grafana: A Comprehensive Guide</title>
      <dc:creator>Deepanshu Anand</dc:creator>
      <pubDate>Tue, 25 Jul 2023 12:22:21 +0000</pubDate>
      <link>https://dev.to/deepanshu0810/monitoring-systems-with-prometheus-and-grafana-a-comprehensive-guide-35ag</link>
      <guid>https://dev.to/deepanshu0810/monitoring-systems-with-prometheus-and-grafana-a-comprehensive-guide-35ag</guid>
      <description>&lt;p&gt;In this blog we will be walking through a step-by-step guide to build your monitoring system for your devices. In this guide we will be setting up a Prometheus server and Grafana dashboard to analyze your systems resource utilization. &lt;br&gt;
We will be deploying our Prometheus and Grafana in docker containers because they are lightweight and easy to manage.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why is System Monitoring Important?
&lt;/h2&gt;

&lt;p&gt;System monitoring is crucial for several reasons, as it provides valuable insights and benefits that contribute to the overall health, performance, and security of IT infrastructures and applications. Here are some key reasons why system monitoring is important:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Early Detection of Issues&lt;/li&gt;
&lt;li&gt;Performance Optimization&lt;/li&gt;
&lt;li&gt;Capacity Planning&lt;/li&gt;
&lt;li&gt;Security and Compliance&lt;/li&gt;
&lt;li&gt;Troubleshooting and Root Cause Analysis&lt;/li&gt;
&lt;li&gt;SLA and KPI Tracking&lt;/li&gt;
&lt;li&gt;Resource Optimization and Cost Reduction&lt;/li&gt;
&lt;li&gt;Trend Analysis and Planning&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  What is Prometheus
&lt;/h2&gt;

&lt;p&gt;Prometheus is a monitoring and alerting toolkit designed to collect and store time-series data from various sources, such as applications, services, and system components. It is particularly well-suited for monitoring highly dynamic and distributed environments. Prometheus scrapes data from designated endpoints at regular intervals, allowing users to monitor the health and performance of their systems. It uses a query language called PromQL to extract and analyze data. Prometheus also supports alerting based on predefined rules, enabling users to receive notifications when certain conditions are met.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Grafana
&lt;/h2&gt;

&lt;p&gt;Grafana is a powerful visualization and analytics platform that works seamlessly with Prometheus and other data sources. It allows users to create custom dashboards and visualizations using various data sources, including Prometheus. Grafana provides a user-friendly interface for exploring and understanding complex data sets. It supports a wide range of charts, graphs, and panels, making it easy to display data in a meaningful way. Grafana is commonly used to create real-time monitoring dashboards, performance reports, and executive summaries, helping teams and organizations gain valuable insights into their systems' health and performance&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting up the environment for Prometheus and Grafan
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;enabling ssh
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;openssh-server
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;ssh
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start ssh
&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw allow ssh
&lt;span class="nb"&gt;sudo &lt;/span&gt;ufw &lt;span class="nb"&gt;enable
sudo &lt;/span&gt;ufw status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;installing docker
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;docker.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Configuring Prometheus and Grafana server on ubuntu
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;create a directory to store all the configuration files which will be mounted to the docker container
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /opt/
&lt;span class="nb"&gt;mkdir &lt;/span&gt;prometheus
&lt;span class="nb"&gt;cd &lt;/span&gt;prometheus
&lt;span class="nb"&gt;touch &lt;/span&gt;prometheus.yml
&lt;span class="nb"&gt;touch &lt;/span&gt;alerts.rules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;alerts rules and alert manager will be discussed in the next post&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;create docker container for prometheus
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 9090:9090 &lt;span class="nt"&gt;-v&lt;/span&gt; /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml &lt;span class="nt"&gt;-v&lt;/span&gt; /opt/prometheus/alerts.rules:/etc/prometheus/alerts.rules &lt;span class="nt"&gt;--restart&lt;/span&gt; unless-stopped &lt;span class="nt"&gt;--name&lt;/span&gt; prometheus prom/prometheus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;creating a node exporter
a node exporter helps in retrieving the metrics of a Linux based system and send it to prometheus
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 9100:9100 &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; node-exporter prom/node-exporter
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;create docker container for grafana
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;grafana &lt;span class="nt"&gt;-p&lt;/span&gt; 3000:3000 grafana/grafana
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;now open any browser and search for &lt;code&gt;ubuntu_ip:9090&lt;/code&gt;, &lt;code&gt;ubuntu_ip:3000&lt;/code&gt; and &lt;code&gt;ubuntu_ip:9100/metrics&lt;/code&gt; for checking whether the prometheus, grafana and node exporter are running or not&lt;br&gt;
ubuntu_ip is the IP address of the machine where the docker container is created&lt;/p&gt;

&lt;p&gt;if you want to monitor your windows machine you can install a windows exporter from &lt;a href="https://github.com/prometheus-community/windows_exporter/releases/tag/v0.23.1" rel="noopener noreferrer"&gt;here&lt;/a&gt;. After installing you can start the service to start the windows exporter&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Configuring Prometheus Server
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim /opt/prometheus/prometheus.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;prometheus.yml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;global:
  scrape_interval: 15s

scrape_configs:
  - job_name: &lt;span class="s1"&gt;'prometheus'&lt;/span&gt;
    static_configs:
      - targets: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'localhost:9090'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;

  - job_name: &lt;span class="s1"&gt;'node-exporter'&lt;/span&gt;
    static_configs:
      - targets: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'ubuntu_id:9100'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
  &lt;span class="c"&gt;# ubuntu_ip is the IP address where node exporter is installed&lt;/span&gt;

  &lt;span class="c"&gt;# for windows exporter&lt;/span&gt;
  - job_name: &lt;span class="s1"&gt;'win-exporter'&lt;/span&gt;
    static_configs:
      - targets: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'windows_ip:9182'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
  &lt;span class="c"&gt;# windows_ip is the IP address of the window machine&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker restart prometheus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;now you will be able to use PromQL to gain insights of you Linux machine by visiting &lt;code&gt;ubuntu_ip:9090&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktg4gjj3bi3erdkjoa73.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fktg4gjj3bi3erdkjoa73.png" alt="Prometheus UI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuring Grafana Dashboard
&lt;/h3&gt;

&lt;p&gt;open &lt;code&gt;ubuntu_ip:3000&lt;/code&gt; on your browser &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwfi9s0s1uyceca9kqx4x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwfi9s0s1uyceca9kqx4x.png" alt="Grafana login"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;now use the default username and password &lt;code&gt;admin&lt;/code&gt; and &lt;code&gt;admin&lt;/code&gt; and after that add prometheus to your datasource&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31pv6m3fqxxxhhnyanwn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F31pv6m3fqxxxhhnyanwn.png" alt="Grafana Home"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyd2i3v54cn4o4p5liomo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyd2i3v54cn4o4p5liomo.png" alt="Grafana Datasource"&gt;&lt;/a&gt;&lt;br&gt;
After adding the datasource build a dashboard for your node exporter using the following library &lt;a href="https://grafana.com/grafana/dashboards/" rel="noopener noreferrer"&gt;Grafana Dashboards&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thanks for reading the blog I hope it was helpful for you. In the next blog we will be configuring our Prometheus Server to send alerts based on some rules.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>devops</category>
      <category>monitoring</category>
      <category>dashboard</category>
    </item>
  </channel>
</rss>
