Mar 30, 2023

Monitor Docker metrics using Prometheus & Grafana

Prometheus and Grafana are great tools for both metric data collection and visualization. Using Prometheus and Grafana, here we shall create a dashboard to monitor Docker container. 

Assume, we have already a setup with Grafana & Prometheus  and a docker container.

To setup Prometheus & Grafana, Click here.

To setup Docker container, Click here


Step-1: Check docker service is active or not

[root@docker docker]# service docker status| grep active

Redirecting to /bin/systemctl status docker.service

     Active: active (running) since Thu 2023-03-30 06:03:24 UTC; 47s ago

[root@docker docker]#


Step-2 : Add below file in docker server/ machine

vi /etc/docker/daemon.json

{

 "metrics-addr" : "172.31.37.33:9393",

 "experimental" : true

}

[root@docker docker]# service docker restart


Step3: Check running containers if any

[root@docker docker]# docker ps -a

CONTAINER ID   IMAGE     COMMAND       CREATED         STATUS          PORTS     NAMES

deb6378efe5b   ubuntu    "/bin/bash"   2 minutes ago   Up 6 seconds              container5

e2967e62a390   ubuntu    "/bin/bash"   2 minutes ago   Up 14 seconds             container4

d044849ad38e   ubuntu    "/bin/bash"   2 minutes ago   Up 30 seconds             container3          container1

[root@docker docker]#


Step-4: Edit prometheus.yml file and restart Prometheus service

[root@grafana ~]# cd /home/ec2-user/prometheus/prometheus_setup/

# vi prometheus.yml


static_configs:

      - targets: ["localhost:9090"]

      - targets: ["172.31.37.33:9100"]

      - targets: ["172.31.37.33:9323"]   ## added for docker

!wq!

# systemctl restart prometheus.service

Step-5 : Now connect to Prometheus server and check this target status.

It should be "Up"


Step-6: Create new dashboard/ panel

use below PromoSQL

sum by(state)(engine_daemon_container_states_containers{})

Now you will have data in your panel:















3 comments:

  1. <<<<<<<<
    <<<<<<<<Investment is one of the best ways to achieve financial freedom. For a beginner there are so many challenges you face. It’s hard to know how to get started. Trading the Crypto market has really been a life changer for me. I almost gave up on crypto currency at some point not until I got a proficient trader Bernie Doran, he gave me all the information required to succeed in trading. I made more profit than I could ever imagine. I’m not here to converse much but to share my testimony, I invested $2000.00 and got back $21,500.00 within 5 days of investment. His strategies and signals are the best and I have gained more knowledge.
    If you are new to cryptocurrency. You can reach to him on Telegram: @BERNIE_FX
    Or through Email : Bernie.doranfx01@gmail.com

    ReplyDelete
  2. It persists to be unnatural that people don't know how to get back wallets, security keys, and cryptocurrencies that have been misplaced. Despite the fact I used to imagine the contrary, everything is possible when working with certified digital asset recovery developers. Have you ever experienced financial loss due to hoaxes on spurious investing portals? Feel comfortable knowing that MYSTERIOUS HACKER has the tools to help people reclaim their financial futures and corporations by recovering any money they may have sent or lost to counterfeiters. I paid a Bitcoin scammer $40,000 to assist me with a purchase after transferring him the money. I hired MYSTERIOUS HACKER when I lost communication with them, and they were successful in recovering my funds. I'm happy I stumbled onto these web professionals. Get the help you need quickly, Visit their website on: https://mysterioushacker.info and telegram: +15625539611

    ReplyDelete
  3. It was a quiet Tuesday morning. I logged into my Bitcoin wallet like I had a hundred times before, expecting to check balances and plan trades. But instead of numbers, I saw a void — a zero balance staring back at me like a cruel joke.

    I blinked. Refreshed. Checked again. Still empty. Over $3,000,000…gone. Just like that. The air seemed to thicken around me. My heart raced. For a moment, I thought it was a glitch. But the harsh truth set in quickly: I had been hacked.

    The realization was crushing. This wasn’t just money. It was years of savings, strategic investments, and early adoption that I had poured my soul into. And now it had vanished in the blink of an eye, swept away like dust in the wind.

    I contacted my wallet provider. No help. Filed reports. Got silence. Every road led to a dead end. The blockchain — as transparent as it is — offers little mercy when it comes to reversing a malicious transaction.

    Days passed in a haze. Sleep eluded me. The thought that I had lost everything was like a weight I couldn’t shake.

    But just when despair threatened to become permanent, I stumbled on an article — a digital forensics firm had helped a tech entrepreneur recover his stolen crypto. At first, I was skeptical. There are too many scams promising hope only to exploit vulnerability. But something about the way they operated, their transparency and technical insights, gave me pause.

    They were called SPYHOST — a digital assets recovery group that specialized in crypto theft investigation and blockchain tracing. I sent a cautious email to: Spyhost@cyberdude.com.

    Within hours, I got a response. What followed was nothing short of extraordinary.

    They assigned a recovery specialist to my case. The team dissected the movement of my stolen BTC across the blockchain, mapping the laundering patterns through mixers, identifying exchange addresses, and even liaising with enforcement and security contacts when necessary.

    It felt like watching digital detectives at work — forensic, methodical, relentless.

    And then, ten days later, came the email that brought me to tears:

    “We’ve traced the stolen funds to cold wallets linked to a known laundering syndicate. Action has been taken. Check your wallet.”

    I logged in, my hands trembling. The familiar figure was back. My $3 million was restored.

    To this day, I still can’t quite put into words the mix of disbelief, gratitude, and awe I felt. I had prepared to move on with my life with nothing. Instead, I got everything back.

    So if you're reading this and facing a similar nightmare, know this: there is hope. Blockchain may be unforgiving, but the right expertise can turn the tide.

    Reach out to the team that helped me. You can contact them via email: Spyhost@cyberdude.com. They didn’t just recover my assets — they helped me reclaim my peace of mind.

    ReplyDelete

Translate >>