The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    16
    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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...
Similar Threads - Call functions cPanel
  1. ziGuy
    Replies:
    4
    Views:
    1,340

Share This Page