Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Call functions like cPanel?

Discussion in 'Workarounds and Optimization' started by tejli009, Jan 23, 2016.

  1. tejli009

    tejli009 Member

    Joined:
    May 12, 2015
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Austria
    cPanel Access Level:
    Website Owner
    Hello.

    I need to display those outputs on my Script:


    (edit) cPanel Version (I have found it : /usr/local/cpanel/version)

    Memory Used in %
    Disk usage in % (Disk /dev/sda1 (/))

    Those should show same as in cPanel when I check Server Status in procentage


    I have only found how to show server load:
    Code:
    echo substr(file_get_contents("/proc/loadavg"), 0, 14);
    The output is like this:
    Code:
    0.11 0.04 0.01

    Thank you!
     
    #1 tejli009, Jan 23, 2016
    Last edited: Jan 23, 2016
  2. Shavaun

    Shavaun Well-Known Member

    Joined:
    Aug 15, 2013
    Messages:
    106
    Likes Received:
    0
    Trophy Points:
    91
    cPanel Access Level:
    Root Administrator
  3. tejli009

    tejli009 Member

    Joined:
    May 12, 2015
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Austria
    cPanel Access Level:
    Website Owner
    Thank you for your answer but am not able to find it.

    I need something like:
    substr(file_get_contents("/proc/meminfo"));

    and to show: 19%

    and not the whole memory info.
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,809
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    You may need to develop a custom script that takes the output from an API function and parses the data into an easy-to-read format. Here are some functions that may help you:

    WHM API 1 Functions - loadavg - Software Development Kit - cPanel Documentation

    Or, if it's only the memory output you are seeking, you could develop a script that puts the output from the "free -m" command in a better format.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice