Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Format the load average of a linux server using php?

Posted on 2010-09-05
Medium Priority
Last Modified: 2012-05-10

I'm using the below code to display the load of my linux server.

$info = file_get_contents('/proc/loadavg');

Open in new window

I'd like to format the result which is this: (changes per load of course)  0.71 0.54 0.54 1/78 31161

I'd even be fine with knowing what each number means since then I can just add what each means (each set, I notice is separated by a space) above the printed result.

Question by:showmeurgoods
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 16

Expert Comment

ID: 33608477

Author Comment

ID: 33608486
Thanks santoshmotwani, but I've its not the output, I have that down correct.  I actually came across that post prior to posting here.

I need to know either what each set of numbers refers to, or how to format them differently to show up better then 5 sets of numbers.

LVL 16

Accepted Solution

santoshmotwani earned 1000 total points
ID: 33608858
The first three columns measure CPU and IO utilization of the last one, five, and 10 minute periods. The fourth column shows the number of currently running processes and the total number of processes. The last column displays the last process ID used.


Author Closing Comment

ID: 33609200
This 100% answers my question
LVL 16

Expert Comment

ID: 33609286

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question