Adding Prometheus as a Data Source to Grafana

Posted on Tuesday, February 2, 2021


 


I recently wrote a few article on installing Grafana and Prometheus.

http://www.whiteboardcoder.com/2021/01/installing-grafana-on-ubuntu-2004.html [1]
http://www.whiteboardcoder.com/2021/01/installing-prometheus-on-ubuntu-2004.html [2]

Now that I have it set up and I have prometheus ingesting some data I want to hook it into Promtheus and see some beautiful graphs 

Now I want to start getting some real data into it to have something to graph! 

 

 

 

Adding a Data Source

 

I have Prometheus and Grafana running on the same box.
Let me ssh into my box and also pull some ports on the way.

 

  > ssh prometheus -L 3000:localhost:3000 -L 9090:localhost:9090 -L 9100:localhost:9100

 


Now check if prometheus and grafana are running.

 

  > sudo systemctl status grafana-server

 




And Prometheus

 

  > sudo systemctl status prometheus

 

 

OK all looks good.
Now let me open up Grafana.
http://localhost:3000/login

 

 

Click on Configuration and select Data Sources.


Click Add data sources


Click on Select in the Prometheus


Set URL to http://localhost:9090

All other settings leave as is since I have no SSL or anything fancy set up in front of prometheus.

 


Click on Save & Test



Wahoo its working!



Now go back to Data Sources
Now we should see that we have Promtheus as a data source.


 

Testing data

First let me prove I have some node exporter data in prometheus.
Head over to http://localhost:9090/graph


 

 Click on Graph

 Enter node_cpu_seconds_total and click Execute.



 Yeah data

Now back to grafana

 


Click on + and select Dashboard


Click Add New Panel
Enter the query

 

(100 - 100*(avg by (node) (irate(node_cpu_seconds_total{mode="idle"}[15m]))))

 

 


 

Then hit apply



On the right scroll down to Axes and set the Y-Min to 0 and Y-Max to 100 and click Apply


As you can see nothing much is going on my CPU is not taxed
On my computer let me run htop to confirm (if you don’t have htop install it with sudo apt-get install htop

 

  > htop

 

 


Now let’s do something to get our CPU to max out or at least jump up a bit.

Let me install and run stress

 

  > sudo apt-get install stress
   > stress --cpu 2

 

 


 

Wow



 

Run just one cpu

 

 

  > stress --cpu 1

 

 



 

References

 

[1]        Installing Grafana on Ubuntu 20.04

http://www.whiteboardcoder.com/2021/01/installing-grafana-on-ubuntu-2004.html
Accessed 2/2020

[2]        Installing Prometheus on Ubuntu 20.04

http://www.whiteboardcoder.com/2021/01/installing-prometheus-on-ubuntu-2004.html
Accessed 2/2020

 

 

20 comments:

  1. I have voiced some of the posts on your website now, and I really like your blogging style. I added it to my list of favorite blogging sites and will be back soon ...

    Digital Marketing Training in Bangalore

    ReplyDelete
  2. The Extraordinary blog went amazed by the content that they have developed in a very descriptive manner. This type of content surely ensures the participants explore themselves. Hope you deliver the same near the future as well. Gratitude to the blogger for the efforts.

    Machine Learning Course in Bangalore

    ReplyDelete
  3. Very interesting blog. A lot of the blogs I visit nowadays don't really provide anything that I'm interested in, but I'm definitely interested in this one Turkish e Visa is an electronic visa Turkey that allows entry into Turkey. Once available, eligible foreign will be able to complete the online application process without visiting an embassy or consulate.

    ReplyDelete
  4. Nice Post thank you very much for sharing such a useful information and will definitely saved and revisit your site and i have bookmarked to check out new things frm your post.
    Data Science Course

    ReplyDelete
  5. Really impressed! Everything is a very open and very clear clarification of the issues. It contains true facts. Your website is very valuable. Thanks for sharing.

    Digital Marketing Training in Bangalore

    ReplyDelete
  6. I am really enjoying reading your well written articles. I am looking forward to reading new articles. Keep up the good work.
    Data Science Courses in Bangalore

    ReplyDelete
  7. Very good article and liked reading your post, very pleasant to share, I want to tweet this to my followers. Thank you!.
    Digital Marketing Institute in Hyderabad

    ReplyDelete
  8. First You got a great blog .I will be interested in more similar topics.I commend you for your excellent report on the knowledge that you have shared in this blog.

    digital marketing training in hyderabad
    free digital marketing course in hyderabad

    ReplyDelete
  9. I am hoping the same best effort from you in the future as well and in fact your creative writing skills has inspired me.
    Data Science Course near me

    ReplyDelete
  10. This is an informative and knowledgeable article. therefore, I would like to thank you for your effort in writing this article.
    Data Science Course in Bangalore

    ReplyDelete
  11. Interesting and attractive information. This blog is really rocking... Yes, the post is very interesting and I enjoy it a lot. What to bring to the airport? You will need your passport, copy of ETV and a valid citizen card when you check-in on your flight to India.

    ReplyDelete
  12. Very informative Blog! There is so much information here that can help thank you for sharing.
    Data Analytics Training in Bangalore

    ReplyDelete
  13. I got to this amazing site not long ago. I actually captured with the piece of resources you have got here. Thanks for making such wonderful blog page.
    Data Science Course in Ahmedabad

    ReplyDelete
  14. I read your excellent post. It's a great job. I enjoyed reading your post for the first time. I want to thank you for this publication. Thank you...

    Data Science Course in Patna

    ReplyDelete
  15. Very interesting blog. A lot of the blogs I see these days don't provide anything that interests me, but I'm really interested in this one. I just thought I would post and let you know.

    Data Science Course in Ernakulam

    ReplyDelete
  16. This is an informative and knowledgeable article. therefore, I would like to thank you for your effort in writing this article.
    Data Scientist Course in Chandigarh

    ReplyDelete
  17. I enjoyed reading your articles. I have bookmarked it and I am looking forward to reading new articles. Thanks for sharing.
    Data Science Course in Ahmedabad

    ReplyDelete
  18. Really impressed! Information shared was very helpful Your website is very valuable. Thanks for sharing.
    Business Analytics Course in Bangalore

    ReplyDelete
  19. Some really good points you wrote here ... Great things ... I think you raised some really interesting points. Keep up the good work.

    Best Data Analytics Courses in Bangalore

    ReplyDelete
  20. This comment has been removed by the author.

    ReplyDelete