How to setup JFrog monitoring using Matrix? [Video]

Will Odam
2021-02-02 14:50

How to utilize matrix parameters in a monitoring solution


Video Transcription

My name is Will Odam, from Jfrog support. Today I’m going to be showing you a video on how to use Matrix parameters in a monitoring solution. So why Matrix parameters? Matrix parameters give us a value that we don’t get from query parameters. As you know, with query parameters, you can only append values at the end of a URL, whereas with Matrix parameters, these values or key-pair values for that matter, can be appended anywhere in the URL path. So we’re talking about the end, the beginning, or somewhere in between.

It also allows us to capture key data points and values. So we get a very good value out of using Matrix parameters in general, and when it comes to setting up a reporting or monitoring solution, there’s some cool things we can do, and I’m about to show you how we can do that.

But before we go into the demo, I also wanted to add that, I think, since this is a DevOps solution, it’s very good, and we can use Matrix parameters in an automated way. We can pass mdi-script to a URL. So the demo today will focus on one of the many monitoring tools out there. I know Grafana is very popular, so I chose that for this demo. This is a small recap of what the architectures will be. I have a Linux machine running, so it’s not a batch script, it’s a bash script, excuse my typing. And this bash script has a pushgateway service running. This service can host an API endpoint.

And finally we have a Prometheus server which can scrape the data from the endpoint and display it in a way that is very readable to Prometheus. These gets stored in the Prometheus database, and as you can see, it’s a time series database. And then to make it visible and consumable, we set up a Grafana as a data source to Prometheus, and then it fetches the data and displays the query as well as the visual form of the data so you can use it to see trends and make decisions. So now let’s move on to the demo.

Stop share. Okay. So, this is my Linux server. You can see the pushgateway is running. When I run a netstat, here you can see it’s running on port 9091 and you can see the pid for 594. So I’m going to show this script I have at prop_fetch, or you can imagine. It’s capturing the ps aux command, and then it’ll format it using awk. This format allows Prometheus to read it properly, and then it’ll finally post it on the pushgateway that I showed you earlier. So, just a small curl.

So let’s run this script, and here you can see the output of the script. On the top, you can see the data before the awk command formats it, and then let’s show the key-value pair that we captured. So here you can see the two data points that we captured. You can see the CPU usage in the pid with a value of 0.0. The pid is two. Right?

So once the data is formatted, we see it displayed in the API of Prometheus, and as you can see, we see the [thresh 00:04:50]. Here I’ve set up Prometheus to display the data, and as you can see, it’s tracking the CPU usage. The last time it captured, it was about 300 milliseconds ago, and it scraped the data nicely and displayed it for us. So let’s move on.

One of the many advantages we get from using Grafana is it gives us a very visual UI that we can use to see the query as well as the data in a very consumable way. So Grafana [inaudible 00:05:33] Prometheus, and Prometheus sends the data source. So Prometheus comes with a lot of UI display options. I’m going to show you in the next display. So here we see that we’re capturing the top process and we see our data end points, the CP usage. And then we also see the Prometheus parameters that we captured. We see the pid, as well as the process. So on here, as you can see, what I was capturing was my… So we ran the tab command and it’s showing the tap process processes running. You can see there’s 10 processes that are causing me my CPU, and there’s only 10% of it is consumed. So this shows how you can use the [inaudible 00:06:34] matrix parameters in a monitoring solution. Thank you very much for watching. I hope you’ve enjoyed it. If you have any feedback, please do be able to share in the feedback section. Thank you.