Question

uptime command in webapp shows [0,0,0]

Lookng at tutorial: How To Monitor CPU Use on DigitalOcean Droplets | DigitalOcean I’m trying to get CPU usage / load metrics of the environment where my node application is running but running the command uptime just gives load average as load average: 0.0, 0.0, 0.0 whereas in both my local dev (WSL) and docker container has the proper load avg which I’m later using in my node app with func: os.loadavg(). I assume there are permission errors but isn’t there any way to get system load info i.e. cpu, mem, etc. in a web app env or will I need to recreate as a droplet? In the tutorial they also run uptime with no issues. Thanks


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.

KFSys
Site Moderator
Site Moderator badge
January 11, 2024
Accepted Answer

Heya,

You are correct, it’s permissions issues as you are not on a dedicated environment. As you know, App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers and as such you do not have the proper permissions to show you the load averages.

Additionally, I don’t think there is a way to check the load on the servers.

Bobby Iliev
Site Moderator
Site Moderator badge
January 11, 2024

Hi there,

It’s great to see you leveraging DigitalOcean’s resources to monitor your application’s performance.

Regarding the issue you’re encountering with the uptime command on the App Platform, it’s important to understand that the DigitalOcean App Platform operates differently from a traditional Droplet or a local development environment like WSL. In the App Platform, your application is running in a more abstracted environment, where certain system-level metrics and commands might not function as they would on a dedicated virtual machine or your local setup.

Regarding your specific issue with the uptime command showing [0,0,0], this is likely due to the abstracted nature of the App Platform. The platform is designed to abstract away many of the underlying infrastructure details, including certain aspects of system load monitoring.

Instead of relying on traditional Linux commands like uptime, I recommend utilizing the built-in monitoring tools provided by the App Platform. These tools are specifically designed to give you insights into your application’s performance, including CPU and memory usage, in a way that’s tailored to the platform’s unique environment.

Now, if you were working on a traditional Droplet, the output of uptime showing load averages like 0.0, 0.0, 0.0 would generally indicate a system that’s not under much load. This could be completely normal, especially for a server that’s not handling heavy traffic or processing.

To get a more interactive and detailed view of your system’s performance on a droplet, I would suggest using a tool like htop. This command-line tool provides a dynamic real-time view of your server’s resource usage, including CPU, memory, and process management. It’s a powerful tool for diagnosing performance issues and understanding how your server is handling its workload.

In summary, for your App Platform scenario, lean on the platform’s monitoring features for insights. If you ever transition to or work with a droplet, tools like uptime and htop are invaluable for understanding system performance.

Hope this helps and happy coding!

Best,

Bobby

Try DigitalOcean for free

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

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel