<?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>Debug School: Akila Ravi</title>
    <description>The latest articles on Debug School by Akila Ravi (@rakila1211_666).</description>
    <link>https://www.debug.school/rakila1211_666</link>
    <image>
      <url>https://www.debug.school/images/o9PK__3RH5ANc5p_xJvzleYCeLfN7wCqH5emmxh0WKs/rs:fill:90:90/g:sm/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvdXNl/ci9wcm9maWxlX2lt/YWdlLzY1OC9kMDI0/MTgwZC1lMGEyLTRm/MGItODI0Yy05ZWI2/YTJmOTViZTEucG5n</url>
      <title>Debug School: Akila Ravi</title>
      <link>https://www.debug.school/rakila1211_666</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://www.debug.school/feed/rakila1211_666"/>
    <language>en</language>
    <item>
      <title>Introduction of Datadog</title>
      <dc:creator>Akila Ravi</dc:creator>
      <pubDate>Mon, 11 Sep 2023 07:25:16 +0000</pubDate>
      <link>https://www.debug.school/rakila1211_666/introduction-of-datadog-3po4</link>
      <guid>https://www.debug.school/rakila1211_666/introduction-of-datadog-3po4</guid>
      <description>&lt;h2&gt;
  
  
  What is Observability and its advantage?
&lt;/h2&gt;

&lt;p&gt;Observability is used to understand how the system/environment works with various metrics and its used to identify the problem and fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Difference between Obserbability Monitoring?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;observability helps to identify the reason why issue is occurred whereas in monitoring we can only see what is the issue using metrics dashboard.&lt;/li&gt;
&lt;li&gt;observability is reactive and monitoring is proactive&lt;/li&gt;
&lt;li&gt;observability is used to monitor dynamic env whereas in monitoring it is static environment.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What is Datadog?
&lt;/h2&gt;

&lt;p&gt;Datadog is a service where it provides infra metrics, application metrics, used to check uptime, network, logs etc, it has 600+ integrations and used for observability to create alerts, dashboards.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Datadog Agent and How it works?
&lt;/h2&gt;

&lt;p&gt;Datadog agent is lightweight software where it installed in server based on OS and used to collect metrics from the server and published into Datadog.&lt;/p&gt;

&lt;h2&gt;
  
  
  Component of Datadog Agent and short intro for each
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Collector - it collects infra metrics as cpu, Ram, disk etc&lt;/li&gt;
&lt;li&gt;statsD - statsD is code to add at application end and used to send application metrics and it aggregates metrics.&lt;/li&gt;
&lt;li&gt;Datadog statsD - Datadog statsD is available in datadog agent used to send application metrics to Datadog tool.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1 Top 10 commands of Datadog Agent
&lt;/h2&gt;

&lt;p&gt;$ systemctl start datadog-agent&lt;br&gt;
$ systemctl stop datadog-agent&lt;br&gt;
$ systemctl restart datadog-agent&lt;br&gt;
$ systemctl status datadog-agent&lt;br&gt;
$ more /var/log/datadog/agent.log&lt;br&gt;
$ datadog-agent status&lt;br&gt;
$ datadog-agent configcheck&lt;br&gt;
$ datadog-agent config&lt;br&gt;
$ datadog-agent health&lt;br&gt;
$ datadog-agent hostname&lt;/p&gt;

&lt;h2&gt;
  
  
  2 Locate how to enable Process monitoring in datadog.yaml?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Process Agent
&lt;/h2&gt;

&lt;h1&gt;
  
  
  process_agent_enabled: true
&lt;/h1&gt;

&lt;h2&gt;
  
  
  3 Top 5 Techniques for troubleshooting Datadog Agent
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;use correct API Key&lt;/li&gt;
&lt;li&gt;Site should be correct&lt;/li&gt;
&lt;li&gt;ensure yaml file has any error&lt;/li&gt;
&lt;li&gt;check Datadog agent is running or not&lt;/li&gt;
&lt;li&gt;for any changes, agent needs to be restarted&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Day2&lt;br&gt;
 I. Write it down a step to collect apache metrices to datadog&lt;br&gt;
    1. Install Datadog Agent in Ubuntu &lt;br&gt;
          Register at &lt;a href="https://www.datadoghq.com/"&gt;https://www.datadoghq.com/&lt;/a&gt;&lt;br&gt;
          Select the UBUNTU from the Datadog supported agent list&lt;br&gt;
          Run the commands in ubuntu -&lt;br&gt;
             $ D_AGENT_MAJOR_VERSION=7 DD_API_KEY=XXX DD_SITE="datadoghq.com" bash -c "$(curl -L &lt;a href="https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)"&gt;https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)&lt;/a&gt;"&lt;br&gt;
             systemctl start datadog-agent&lt;br&gt;
             systemctl status datadog-agent&lt;br&gt;
         datadog-agent status&lt;br&gt;
          You would get output at the end of Installation&lt;br&gt;
                 Adding you api key to Agent config: /etc/datadog-agent/datadog.yml&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2. Install Apache HTTPD server in Ubuntu
       $ sudo apt update
   $ sudo apt install apache2
   # Setup webiste in default virtual host
    $ rm /var/www/html/index.html
    $ vi /var/www/html/index.html
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt; Welcome to DevOpsSchool.com &amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;p&amp;gt; I'm running this website on an Ubuntu Server server!
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
# Restart Apache
$ service apache2 reload
$ service apache2 restart
    # Validate 
$ watch curl http://localhost

3. Go to datadog console, https://app.datadoghq.com/integrations -&amp;gt; Integrations -&amp;gt; Search For Apache and Install the integration
4. Enable mod_status &amp;amp; ExtendedStatus in Apache
    By default, Apache ships with the mod_status module already enabled. Verify by running, $ ls /etc/apache2/mods-enabled | grep status*
          Output:
              status.conf
              status.load
    Enable mod_status module by invoking the command:
$ sudo /usr/sbin/a2enmod status
Configure mod_status in Apache Ubuntu
          sudo vi /etc/apache2/mods-enabled/status.conf 
                 &amp;lt;Location /server-status&amp;gt;
                            Require all granted       #Replace ip &amp;lt;&amp;gt; 
     $ sudo systemctl restart apache2
$ sudo systemctl status apache2
$ curl http://localhost/server-status
5. Enable Datadog Apache Integration configuration to start collecting your Apache metrics.
      $ cd /etc/datadog-agent/conf.d/apache.d/
     $ sudo cp conf.yaml.example conf.yaml
     $ sudo vi conf.yaml 
          instances:
                - apache_status_url: http:localhost/server-status?auto        #localhost can be added with IP if it is a remote agent
    $ sudo systemctl restart datadog-agent
    watch curl http://localhost/
6. Validate if datadog agent is monitoring Apache
     $ datadog-agent configcheck | grep apache -A 5 -B 5
    Output: 
    === apache check ===
     Configuration provider: file
    Configuration source: file:/etc/datadog-agent/conf.d/apache.d/conf.yaml
    $ datadog-agent status | grep apache -B 5 -A 15
    ==Running Checks apache====
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Create a dummy traffic on Apache 
    $ while true; do curl -s -o /dev/null &lt;a href="http://localhost"&gt;http://localhost&lt;/a&gt; &amp;amp; done&lt;/li&gt;
&lt;li&gt;Verify the Apache Metrix on Datadog Console&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;II. Write it down a step to collect tomcat metrices to datadog&lt;br&gt;
       Loginto Datadog console, Integrations -&amp;gt; Search for Tomcat and Click Install&lt;br&gt;
        Step 1: Install Open JDK 11&lt;br&gt;
                        $ sudo apt-get update&lt;br&gt;
            $ sudo apt-get install openjdk-11-jdk -y&lt;br&gt;
            $ apt install openjdk-11-jdk-headless -y &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    Step 2: Download Apache Tomcat 9 in ubuntu:
            $ sudo apt-get install wget unzip -y
    $ sudo -s
    $ cd /opt/
    $ wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.80/bin/apache-tomcat-9.0.80.zip
            $ unzip apache-tomcat-9.0.80.zip
    $ cd apache-tomcat-9.0.73
    $ cd bin
    $ chmod -R 755 .
    $ ls
    $ ./shutdown.sh
    $ ./startup.sh
   Step 3: Enable JMX Remote in Tomcat 8 to Monitor &amp;amp; Administer
          $ vi /opt/apache-tomcat-9.0.73/bin/catalina.sh
    #Add these below lines
        CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9012 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
    $ ./shutdown.sh
    $ ./startup.sh
   Step 4: Configure and enable Tomcat intergration in Datadog agent
        $ cd /etc/datadog-agent/conf.d/tomcat.d/
    $ cp conf.yaml.example conf.yaml
    $ datadog-agent configcheck
    $ systemctl restart datadog-agent
    $ systemctl status datadog-agent
    $ datadog-agent configcheck | grep tomcat -A 1 B 1
                  Output:
                 ==tomcat check====
  Step 5: In datadog console, Go to Metrics tab, search for tomcat metrices and also in Infrastructure list under Ubuntu VM check for tomcat apps 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;III.   Write it down a step to collect docker metrices to datadog&lt;br&gt;
Step 1 – Enable Datadog Process Monitoring&lt;br&gt;
Step 2 – Install Docker Server&lt;br&gt;
Step 3 – Enable Docker integration with Datadog&lt;/p&gt;

&lt;h1&gt;
  
  
  These commands to configure Agent for Docker Intergration.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Add the user running the Agent to Docker's group.
&lt;/h1&gt;

&lt;p&gt;$ usermod -a -G docker dd-agent&lt;/p&gt;

&lt;p&gt;$ cd /etc/datadog-agent/conf.d/docker.d/&lt;br&gt;
$ cp conf.yaml.default conf.yaml&lt;br&gt;
$ vi conf.yaml&lt;br&gt;
$ systemctl restart datadog-agent&lt;br&gt;
$ systemctl status datadog-agent&lt;br&gt;
ad_identifiers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;_docker
init_config:
instances:

&lt;ul&gt;
&lt;li&gt;url: "unix://var/run/docker.sock"
new_tag_names: true
$ datadog-agent configcheck
$ datadog-agent check docker
$ datadog-agent status | grep docker -B 5 -A 5
=========
Collector
=========
Step 4 – Create few containers and Verify
$ docker run -itd ubuntu
$ docker run -itd ubuntu
$ docker run -itd ubuntu
$ docker ps
Step 5 - Verify Containers at Datadog console
In console -&amp;gt; Integrations -&amp;gt; Docker Install -&amp;gt; Metrics -&amp;gt; Explorer -&amp;gt; Search for command:containerd-shim-runc-v2&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;IV.  - Write it down a step to collect mysql metrices to datadog&lt;br&gt;
  Step 1 – Install Datadog Agent in Ubuntu&lt;br&gt;
          Register at &lt;a href="https://www.datadoghq.com/"&gt;https://www.datadoghq.com/&lt;/a&gt;&lt;br&gt;
          Select the UBUNTU from the Datadog supported agent list&lt;br&gt;
          Run the commands in ubuntu -&lt;br&gt;
                $ D_AGENT_MAJOR_VERSION=7 DD_API_KEY=XXX DD_SITE="datadoghq.com" bash -c "$(curl -L &lt;a href="https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)"&gt;https://s3.amazonaws.com/dd-agent/scripts/install_script.sh)&lt;/a&gt;"&lt;br&gt;
                $ systemctl start datadog-agent&lt;br&gt;
                $ systemctl status datadog-agent&lt;br&gt;
        $ datadog-agent status&lt;br&gt;
              You would get output at the end of Installation&lt;br&gt;
                  Adding you api key to Agent config: /etc/datadog-agent/datadog.yml&lt;br&gt;
        (Mysql by default comes with Dataagent package)&lt;br&gt;
   Step 2 – Prepare MySQL. On each MySQL server, create a database user for the Datadog Agent:&lt;br&gt;
                 Go to datadog console, Integrations, Mysql -&amp;gt; Install&lt;br&gt;
   Step 3 - Login Mysql in Ubuntu. Run the below commands&lt;br&gt;
        $sudo su -&lt;br&gt;
        $ mysql -h localhost -u root -p&lt;br&gt;
        mysql&amp;gt; CREATE USER 'datadog'@'localhost' IDENTIFIED BY '';&lt;br&gt;
        mysql&amp;gt; CREATE USER 'datadog'@'localhost' IDENTIFIED WITH mysql_native_password by '';&lt;br&gt;
        mysql -u datadog --password='' -e "show status" | \&lt;br&gt;
grep Uptime &amp;amp;&amp;amp; echo -e "3[0;32mMySQL user - OK3[0m" || \&lt;br&gt;
echo -e "3[0;31mCannot connect to MySQL3[0m"&lt;br&gt;
        mysql -u datadog --password='' -e "show slave status" &amp;amp;&amp;amp; \&lt;br&gt;
echo -e "3[0;32mMySQL grant - OK3[0m" || \&lt;br&gt;
echo -e "3[0;31mMissing REPLICATION CLIENT grant3[0m"&lt;br&gt;
   Step 4 - The Agent needs a few privileges to collect metrics. Grant the user the following limited privileges ONLY:&lt;br&gt;
        mysql&amp;gt; GRANT REPLICATION CLIENT ON &lt;em&gt;.&lt;/em&gt; TO 'datadog'@'localhost' WITH MAX_USER_CONNECTIONS 5;&lt;br&gt;
        mysql&amp;gt; GRANT PROCESS ON &lt;em&gt;.&lt;/em&gt; TO 'datadog'@'localhost';&lt;br&gt;
        mysql&amp;gt; ALTER USER 'datadog'@'localhost' WITH MAX_USER_CONNECTIONS 5;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    If enabled, metrics can be collected from the performance_schema database by granting an additional privilege:
    mysql&amp;gt; show databases like 'performance_schema';
    Output:     
        | Database (performance_schema) |
            +-------------------------------+
            | performance_schema            |
    mysql&amp;gt; GRANT SELECT ON performance_schema.* TO 'datadog'@'localhost';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Step 5 - Configure Datadog agent to start collection mysql metrix.&lt;br&gt;
        Edit the mysql.d/conf.yaml file, in the conf.d/ folder at the root of your Agent's configuration directory to start collecting your MySQL metrics and logs&lt;br&gt;
        $ cd /etc/datadog-agent/conf.d/mysql.d/&lt;br&gt;
        $ sudo cp conf.yaml.example conf.yaml&lt;br&gt;
        $ sudo vi conf.yaml&lt;br&gt;
        init_config:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    instances:
      - server: 127.0.0.1
        user: datadog
        pass: "&amp;lt;YOUR_CHOSEN_PASSWORD&amp;gt;" # from the CREATE USER step earlier
        port: "&amp;lt;YOUR_MYSQL_PORT&amp;gt;" # e.g. 3306
        options:
              replication: false
              galera_cluster: true
              extra_status_metrics: true
              extra_innodb_metrics: true
              extra_performance_metrics: true
              schema_size_metrics: false
              disable_innodb_metrics: false
Note: Wrap your password in single quotes in case a special character is present.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Step 6: Validate mysql metrices&lt;br&gt;
        $ systemctl restart datadog-agent&lt;br&gt;
               $ datadog-agent status&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  In metrics explorer UI console, You would be able to see the mysql data reporting
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
  </channel>
</rss>
