Community Forums
Connect with us on LinkedIn
  
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Jun 2010
    Posts
    67

    Default Stats Bar

    Hello,

    I am customising this theme for cPanel but I have this problem . Basically this is what I have coded:

    Code:
    <!--
    --------------------------------------------------------------------------------------------------
    STATS BAR START
    --------------------------------------------------------------------------------------------------
    -->
    		<div id="sidebar">
    			<div id="stats" class="side-box">
    				<h3>
    					<cpanel langprint="Account Information">
    				</h3>
    				<div class="cellbox">
    					<table summary="Statistics">
    						
    							<?cp StatsBar::stat([tr class="row-%"][td]%[/td][td class="info"]%[/td][/tr],rowtype,item,value) display=hostingpackage|sharedip|dedicatedip|shorthostname|cpanelversion|cpanelrevision|sendmailpath|machinetype,rowcounter=mainstats ?>
                                
                                <!--
                                apacheversion|theme|mysqlversion|kernalversion|machinetype
                                -->
    						</tbody>
    					</table>
    				</div>
    			</div>
    		</div>
    	</div>
    <!--  
    --------------------------------------------------------------------------------------------------
    STATS BAR END
    ---------------------------------------------------------------------------------------------------->
    The problem I am having is with this piece of code

    Code:
    ?cp StatsBar::stat([tr class="row-%"][td]%[/td][td class="info"]%[/td][/tr],rowtype,item,value) display=hostingpackage|sharedip|dedicatedip|shorthostname|cpanelversion|cpanelrevision|sendmailpath|machinetype,rowcounter=mainstats ?>
    The order of the list above, hosting package, shared IP and dedicated IP and so on.... is no in that order, however that is the order I want it to be in.

    Is there a place I can find out more of these?

    Thanks!

  2. #2
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default

    Hi

    You can find the documentation of the API2 call "StatsBar::stat" here:
    ApiStatsBar < ApiDocs/Api2 < TWiki

    This function will always return an unsorted list of hashes. A great tool for "peeking under the hood" with APIs is the API Tracer:
    http://sdk.cpanel.net/utils/CustomEv...-Dumper.tar.gz
    Inside the tarball is a README. You'll need root to install it.
    NOTE: NEVER place this tracer on a production machine, as it records all data for API requests, which is likely to contain sensitive information.

    Once you know what the returned data is, you can use the (cPanel) Template Toolkit to sort/render the data as necessary.
    UsingCpttTags < AllDocumentation/AutomationIntegration < TWiki

    I think for your purposes, you're probably need to make your own template that can loop over or extract the individual stat and render each in the desired order.

    Regards,
    -DavidN

    ex. Tracer dump on a test box using the command you provided
    Code:
    --------------------
    statsbar:stat
    $apiv = 2
    $type = post
    -----
    $cfgref
    
    $VAR1 = {
              'rowcounter' => 'mainstats',
              'display' => 'hostingpackage|sharedip|dedicatedip|shorthostname|cpanelversion|cpanelrevision|sendmailpath|machinetype'
            };
    
    -----
    $dataref
    
    $VAR1 = [
              {
                'percent10' => 0,
                'percent5' => 0,
                'rowtype' => 'even',
                'percent20' => 0,
                'item' => 'Hosting package',
                'value' => 'default',
                'name' => 'hostingpackage',
                'langkey' => 'INDXHostingPackage',
                '_maxed' => 0,
                'module' => 'PkgInfo',
                'percent' => 0,
                'count' => undef,
                'max' => ' ',
                'id' => 'hostingpackage'
              },
              {
                'percent10' => 0,
                'percent5' => 0,
                'rowtype' => 'odd',
                'percent20' => 0,
                'item' => 'Server Name',
                'value' => 'mybox',
                'name' => 'shorthostname',
                'langkey' => 'INDXServername',
                '_maxed' => 0,
                'module' => 'Hostname',
                'percent' => 0,
                'count' => undef,
                'max' => ' ',
                'id' => 'shorthostname'
              },
              {
                'percent10' => 0,
                'percent5' => 0,
                'rowtype' => 'even',
                'percent20' => 0,
                'item' => 'cPanel Version',
                'value' => '11.25.0-STABLE',
                'name' => 'cpanelversion',
                'langkey' => 'INDXBuildVersion',
                '_maxed' => 0,
                'module' => 'Version',
                'percent' => 0,
                'count' => undef,
                'max' => ' ',
                'id' => 'cpanelversion'
              },
              {
                'percent10' => 0,
                'percent5' => 0,
                'rowtype' => 'odd',
                'percent20' => 0,
                'item' => 'Architecture',
                'value' => 'i686',
                'name' => 'machinetype',
                'langkey' => 'INDXMachineType',
                '_maxed' => 0,
                'module' => 'Serverinfo',
                'percent' => 0,
                'count' => undef,
                'max' => ' ',
                'id' => 'machinetype'
              },
              {
                'percent10' => 0,
                'percent5' => 0,
                'rowtype' => 'even',
                'percent20' => 0,
                'item' => 'cPanel Build',
                'value' => 30000,
                'name' => 'cpanelrevision',
                'langkey' => 'INDXRevision',
                '_maxed' => 0,
                'module' => 'Version',
                'percent' => 0,
                'count' => undef,
                'max' => ' ',
                'id' => 'cpanelrevision'
              },
              {
                'percent10' => 0,
                'percent5' => 0,
                'rowtype' => 'odd',
                'percent20' => 0,
                'item' => 'Shared IP Address',
                'value' => '10.1.1.1',
                'name' => 'sharedip',
                'langkey' => 'INDXSharedIp',
                '_maxed' => 0,
                'percent' => 0,
                'count' => undef,
                'max' => ' ',
                'id' => 'sharedip',
                'condition' => 1
              },
              {
                'percent10' => 0,
                'percent5' => 0,
                'rowtype' => 'even',
                'percent20' => 0,
                'item' => 'Path to sendmail',
                'value' => '/usr/sbin/sendmail',
                'name' => 'sendmailpath',
                'langkey' => 'INDXSendmailPath',
                '_maxed' => 0,
                'module' => 'Serverinfo',
                'percent' => 0,
                'count' => undef,
                'max' => ' ',
                'id' => 'sendmailpath'
              }
            ];
    
    --------------------
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  3. #3
    Member
    Join Date
    Jun 2010
    Posts
    67

    Default

    Sorted it out now, stats bar is not ordering properly and the technician I spoke with believed it was a 'bug'. I am waiting on cPanel support to reply with the solution to the 'bug'. Thanks for the API list you gave me.

  4. #4
    Member
    Join Date
    Jun 2010
    Posts
    67

    Default

    However I am looking for something that will show, for each account:

    Processes Running
    CPU Usage
    Memory Usage
    Server Time

Similar Threads & Tags
Similar threads

  1. Updated to 11.26.9 but shows 11.26.8 ins Stats bar
    By thobarn in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 09-14-2010, 04:28 AM
  2. Address bar immobilizer
    By martusi in forum cPanel Developers
    Replies: 0
    Last Post: 07-27-2009, 05:37 AM
  3. Can we remove sensitive stats from the cPanel side-bar? Possible?
    By jols in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 06-16-2009, 12:07 PM
  4. Shared IP in address bar
    By htsnet in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 05-11-2008, 11:51 PM
  5. Advert bar
    By patriotcow in forum cPanel Developers
    Replies: 20
    Last Post: 01-14-2005, 12:11 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube