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.

Domain Stats Question

Discussion in 'cPanel Developers' started by kishu27, Mar 30, 2011.

  1. kishu27

    kishu27 Member

    Joined:
    Feb 16, 2011
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hi Guys,

    I tried searching on this over forum but couldn't get a result. Please help me if you have any knowledge on this.

    I have enables the analogstats on a cpanel, and I get a loadful of results when I access
    http://<mydomain>.com:2082/cpsess6709669186/tmp/seoplugi/analog/3.html?post_login=35925291883492

    However when I use the API2 Module Stats:listanalog but all I get is a empty dataset:

    Code:
    Array
    (
        [cpanelresult] => Array
            (
                [data] => Array
                    (
                        [0] => Array
                            (
                                [txt] => <domain>.com
                                [ssl] => 0
                                [domain] => <domain>.com
                            )
    
                    )
    
                [event] => Array
                    (
                        [result] => 1
                    )
    
                [module] => Stats
                [apiversion] => 2
                [func] => listanalog
            )
    
    )
     
  2. 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 Kishu,

    That would be the correct behavior for Stats:listanalog. It's purpose to simply list the available domain log files present in you home directory.

    If you need the raw information from the file (in you case, tmp/seoplugi/analog/3.html), you'll have to fetch and scrap that information yourself. cPanel does not generate or provide an API for these reports. The report files are generated by the log process software (ie, analog, awstats, webalizer)

    Regards,
    -DavidN
     
    #2 cPanelDavidN, Apr 5, 2011
    Last edited: Apr 5, 2011
  3. kishu27

    kishu27 Member

    Joined:
    Feb 16, 2011
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hi David,

    Thanks a lot for the reply. However I dont see any part in the resulting code that would point me a path to the results HTML file. Is there a logical way I can generate the path out of the API response codes?

    Best regards,
    Kishu
     
  4. 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
    Yes, as the documentation states, you can take the $response['cpanelresult']['data'][0]['domain'] and ['ssl'] values and plug them into the following URL to get a list of available reports:
    :2083/frontend/x3/stats/analog.html?domain=$domain&ssl=$ssl

    This is really the same as if you use the API1 Stats::analoglist function. Below is the output of the two and how they differ (using my test account, "cppirum", and it's two domains [well, primary and subdomain]):

    Code:
    List from API2 Stats::listanalog
    array(1) {
      ["cpanelresult"]=>
      array(5) {
        ["apiversion"]=>
        int(2)
        ["data"]=>
        array(2) {
          [0]=>
          array(3) {
            ["domain"]=>
            string(11) "cppirum.net"
            ["ssl"]=>
            int(0)
            ["txt"]=>
            string(11) "cppirum.net"
          }
          [1]=>
          array(3) {
            ["domain"]=>
            string(16) "pear.cppirum.net"
            ["ssl"]=>
            int(0)
            ["txt"]=>
            string(16) "pear.cppirum.net"
          }
        }
        ["func"]=>
        string(10) "listanalog"
        ["event"]=>
        array(1) {
          ["result"]=>
          int(1)
        }
        ["module"]=>
        string(5) "Stats"
      }
    }
    
    List from API1 Stats::analoglist
    array(7) {
      ["apiversion"]=>
      string(1) "1"
      ["type"]=>
      string(5) "event"
      ["module"]=>
      string(5) "Stats"
      ["func"]=>
      string(10) "analoglist"
      ["source"]=>
      string(6) "module"
      ["data"]=>
      array(1) {
        ["result"]=>
        string(73) "<a href="/tmp/cppirum/analog/pear.cppirum.net/3.html">Mar 2011</a><br />
    "
      }
      ["event"]=>
      array(1) {
        ["result"]=>
        int(1)
      }
    }
    
    
     
  5. kishu27

    kishu27 Member

    Joined:
    Feb 16, 2011
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Awesome.. Thanks David, you're are a savior :)
     
Loading...

Share This Page