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.

Adding Bandwidth Meter to CMS

Discussion in 'cPanel Developers' started by inspyre, Jul 20, 2011.

  1. inspyre

    inspyre Member

    Joined:
    Jul 20, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I'm new to all this, so please don't think that I'm stupid or anything... Hopefully I'll learn.

    I have a CMS that my clients use to update their website, and I would love to have the Bandwidth meter (And possibly also the disc space usage meter) showing in my CMS, so that my clients can see how much of their limits they have used.

    How would I go about doing this? I feel that it's probably an easy task, but I have only just started using cPanel and WHM so i'm not too sure how to do it.

    Cheers,
    Brad
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    How do the clients update their cPanel sites via that CMS? Are you using the API to plug into something? Without more details on how the CMS is working to get an idea of how it pulls information, it would be difficult to answer this question.
     
  3. inspyre

    inspyre Member

    Joined:
    Jul 20, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Thanks for replying. The CMS is very basic; the page content is stored in a database, there's no API or anything that connects directly to cPanel.
    My clients generally have no need to log in to cPanel as I look after all of that for them, which is why I would love to get the meters showing in my CMS, so that information is all in one place.

    Cheers,
    Brad
     
  4. inspyre

    inspyre Member

    Joined:
    Jul 20, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    I've worked it out cheers, after much trial and error.
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Do tell, I'd like to hear more about how you accomplished this. :)
     
  6. inspyre

    inspyre Member

    Joined:
    Jul 20, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Haha, well this may not be the best way to do it, but it surely works.

    (and it is only in a password protected area, so hopefully any security issues using the 2082 port won't be a problem)

    I loaded an array from
    www.mywebsite. com:2082/xml-api/cpanel?cpanel_xmlapi_module=StatsBar&cpanel_xmlapi_func=stat&cpanel_xmlapi_apiversion=2&display=bandwidthusage|diskusage

    then just used that array to display the details.

    If you can see anything that might pose a potential problem with that, then please let me know; as I said, I'm new to all of this!
     
    #6 inspyre, Jul 21, 2011
    Last edited: Jul 21, 2011
  7. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi inspyre,

    That's the correct why to get that information.

    I would still recommend using port 2083 if possible. The reason why is that unless you're explicitly using the loopback (ie, localhost/127.0.0.1) or a private network, it's possible for someone to sniff the packets on the network transmission (which will contain plain text data). At the least, you'd probably be exposing the packets to other boxes that share the same switch as you in the datacenter, but it could also include the various other places along the route from the originating server to the cPanel box itself (this might even happen if the origin and destination live on the same box...that is, you make yourself vulnerable if the request is broadcasted on an external network interface).

    IMHO, non-ssl ports are only a valid choice if your request is being sent on an internal network (for which the cPanel box has a dedicated interface to), i,e your CMS only calls cPanel on a private network address that you direct/physically control.

    Regards,
    -DavidN
     
  8. inspyre

    inspyre Member

    Joined:
    Jul 20, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hi DavidN

    Thanks for your reply.

    I now have it set up to use port 2083 :)

    Cheers,
    Brad
     
Loading...

Share This Page