Question

Remotely View Load Balancer Stats (like the webUI's reqs/s)

How can I remotely view the requests per second stats of my load balancer? I have checked the Load Balancer API docs and I don’t see a way to view the requests per second stats of my load balancer like I can if I login to the WebUI. I would like to use this info to alert me or start an additional task, etc. Any ideas?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 3, 2023

Hi there,

What you could do is use the DigitalOcean API and the /v2/load_balancers/LB_ID endpoint to retrieve information about the load balancer itself and its health checks:

https://docs.digitalocean.com/reference/api/api-reference/#operation/loadBalancers_list

The request itself will look like this:

curl -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  "https://api.digitalocean.com/v2/load_balancers/4de7ac8b-495b-4884-9a69-1050c6793cd6"

From the response, you will get the health_check value which you can use to determine the heath.

Hope that this helps!

Best,

Bobby

KFSys
Site Moderator
Site Moderator badge
April 2, 2023

Hey @littlelightseagreensquid,

To remotely view the requests per second stats of your DigitalOcean Load Balancer, you can use the DigitalOcean Monitoring API. The Monitoring API allows you to programmatically retrieve real-time and historical data for your resources, including Load Balancers.

https://docs.digitalocean.com/products/monitoring/

To get started with the Monitoring API, you’ll need to create a personal access token from the DigitalOcean Control Panel. Once you have your access token, you can use it to make authenticated requests to the Monitoring API.

To retrieve the requests per second stats of your Load Balancer, you can use the Metrics API :

https://docs.digitalocean.com/reference/api/api-reference/#operation/monitoring_create_alertPolicy

You can check the List Alert Policies as well to check if any Policy matches what you need or Create a new alert which will be send via the API and you can act upon in

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up