Awstats mod - uses dynamic pages (non static)

Discussion in 'Tips/Tricks/Mods' started by djtremors, Nov 8, 2006.

  1. jnsc

    jnsc rotaredoM Moderator

    Hi djtremors,

    Regarding the global stats user, this might interests you.

    http://howtoforge.com/forums/showthread.php?t=20334


    Regards
    Jonas
     
  2. swieep

    swieep New Member

    SkipHosts

    Hi DJ Tremors,

    I put a few SkipHosts in the /etc/awstats/ config files.

    But this morning they where gone, are the config files overwritten with default values every night?

    I do not want to add the SkipHosts values to the default model config file..
     
  3. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    yeah it does get overwritten. If it is a global setting that you want for all sites, put it in the awstats.model.conf as that file is never overwritten and is used as the master conf file which the site file include the master.

    If you want it per site and is different on each site then you may need to modify the awstats.php file to include a local version of the site... ie

    PHP:
    After this line (around line 147):
                        
    exec"echo 'Include \"/etc/awstats/awstats.model.conf\"' >> /etc/awstats/awstats.".$web_real_name.".conf" );

    Add :
                        if ( 
    file_exists("/etc/awstats/awstats.".$web_real_name.".local") ) exec"echo 'Include \"/etc/awstats/awstats.".$web_real_name.".local\"' > /etc/awstats/awstats.".$web_real_name.".conf" );
    (edited for correctness thanks to swieep)

    Now you can add your changes (make sure the master doesn't double up) to the /etc/awstats/awstats.{site}.local file
    This hasn't been tested and this is a quick patch but it should check if the "local" file exists and will update the sites conf file to include it on next run...

    give it a try. let me know and if it works well enough and people want it, i could include it in....
     
    Last edited: Apr 21, 2008
  4. swieep

    swieep New Member

    Hi djtremors

    I found 2 awstats.model.conf

    > locate awstats.model.conf
    /etc/awstats/awstats.model.conf
    /home/admispconfig/ispconfig/web/ispc.awstats/awstats.model.conf

    And they are different which one to use (or remove)..

    > diff /etc/awstats/awstats.model.conf /home/admispconfig/ispconfig/web/ispc.awstats/awstats.model.conf
    203c203
    < DirData="/home/admispconfig/ispconfig/web/ispc.awstats.data"
    ---
    > DirData="."
    328c328
    < AllowAccessFromWebToAuthenticatedUsersOnly=1
    ---
    > AllowAccessFromWebToAuthenticatedUsersOnly=0
    339c339
    < ##AllowAccessFromWebToFollowingAuthenticatedUsers=""
    ---
    > AllowAccessFromWebToFollowingAuthenticatedUsers=""

     
  5. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    /etc/awstats/awstats.model.conf is the LIVE one.

    It's also important that the following IS TRUELY set as it stops people from 1 website accessing another websites stats just because they have passed the htaccess passwords.. each site has a list of allowed users to vist the stats, per site.

    AllowAccessFromWebToAuthenticatedUsersOnly=1

    so ignore the /home/admispconfig/ispconfig/web/ispc.awstats/awstats.model.conf
    as it is not used by the /stats pages.
     
  6. swieep

    swieep New Member

    Hi,

    Thank you for the quick reply..

    When I created the local file and runned the crontab entry for awstats I got an error.

    Found out you used just one >

    exec( "echo 'Include \"/etc/awstats/awstats.".$web_real_name.".local\"' > /etc/awstats

    Changed it to two >> and now the conf file is complet with the SkipHosts in it from the .local file

    exec( "echo 'Include \"/etc/awstats/awstats.".$web_real_name.".local\"' >> /etc/awstats


    Thanks it seems that is will work the way I want.. maybe you can use it by default in you next release(s)

     
  7. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    Um, it shouldn't be a >> as this will append to the file if it exists causing you to multiply your entries every time it runs.

    Double check that but running your cron command again and check that the lines aren't being readded again and again with each run.

    it's 2am here right now and I might be cross eyed.. :p
     
  8. swieep

    swieep New Member

    Hi,

    No, the entry's are not double.. The problem was without the >> the file only contains the .local info, in this case only SkipHosts and awstats was complaining about not finding the needed files etc.

    Now with the >> everynight the file is recreated with the needed SkipHosts..

     
    Last edited: Apr 20, 2008
  9. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    Actually, your quite correct since the main site file is overwritten it can't double up anyway... and a single > overwrites.. oh der....., stupid me.....

    Is the awstats.model.conf file have it's SkipHosts entry removed? I don't think it will work with it listed twice nor will it overwrite the other properly.

    Does your server do reverse lookups, if so you must use the name of the IP and not use the IP itself.. or just put both. SkipHosts only works on new updates and previous ones are basically too late.
     
  10. swieep

    swieep New Member

    Hi,

    I did not remove the SkipHost from the model.conf and it works as designed. That is from now the hosts are skipped the one alread in the stats are not skipped.

    So thank you for your solution it works very nice..

    I have to make a list what I have changes so when a update of ispconfig is needed, I have to redo my steps ;)
    (spamd, clamd and now custom awstats)


     
  11. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    Yeah it's very annoying having to redo the addons and I haven't got time to make a package right now (too many projects, hacks and mods on other projects)...
    What ISPConfig developers should do is provide an upgrade without the whole package and loss of certificates etc.etc. Or even supply a patch to run against the release so my own mods I like (like the sticky menus as per my website) don't have to be reapplied every time.. :(
     
  12. swieep

    swieep New Member

    True.. true..

    The Sticky menu's I read once, but forgot about it so I wil have a look and install it..

     
  13. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    basically it was a javascript modification to ispconfig to keep the left side folders that are opened truely opened and not collapse every time you click a link on ispconfig.. was really annoying to having to search and open the links each time especially where ispconfig always takes you back to the status page and then you got to go back to the site link and click it and go back to the spot you were in... baaaaaad design. no excuses boys....
     
  14. radim_h

    radim_h Member HowtoForge Supporter

    line 196 error

    Hello,

    i'm still using this awstats script, as i don't like webalizer and static awstats.
    I have just kept awstats directories and have not used instalator after the problem with not updating ISPconfig and everything works fine now..

    I'd like just get rid of that message
    Warning: array_merge(): Argument #1 is not an array in /root/ispconfig/scripts/shell/awstats.php on line 196

    which probably causes that global admin login is added after each processed site instead of once in whole .htaccess
    Do you have idea how to fix it, please?


    +there is one more little problem - if set in /etc/awstats/awstats.model.conf Language="auto" (which has to use language depending on browser language setting - First available language accepted by browser=auto) it is always showing awstats in English i have to use Lang="cz"but then it is showing Czech also for English speakign customers...


    BTW: haven't you think about update awstats in package from 6.5 to last stable 6.7 ? .o) http://awstats.sourceforge.net/#DOWNLOAD
     
    Last edited: Jun 21, 2008
  15. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    Firstly the awstats.model.conf is loading every site so it's kinda like a global template which is generalised with every site. So if the language=auto doesn't work then I can only guess it's an awstats issue. If you can get 1 site working without using the main template (remove the Include in the testing sites awstats conf file before cron runs again as it overwrites), then we can work out what could be going wrong with the config.

    With that array_merge problem, try adding :

    $directory_array = array();

    in this section
    PHP:
    function dir_array($dir){
      
    // INSERT HERE
      
    if ($dirstream = @opendir($dir)) {
        while (
    false !== ($filename readdir($dirstream))) {
          if (
    $filename!="." && $filename!=".."){
            if (
    is_file($dir."/".$filename) && !is_link($dir."/".$filename)){
              
    $directory_array[$dir."/".$filename] = filemtime($dir."/".$filename);
            }
            if (
    is_dir($dir."/".$filename)) $directory_array array_merge($directory_arraydir_array($dir."/".$filename));
          }
        }
      }
     
  16. radim_h

    radim_h Member HowtoForge Supporter

    $directory_array = array();

    i tried now just the first part, adding $directory_array = array();

    error message has dissapeared, but
    awstatsadmin:xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    is still added after each page, has it to be this way, or is it supposed be adde just at once in whole .htpasswd ?
     
  17. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    the global password file is suppose to have only 1 listing of the main admin. it's only because i was lazy that I copied the list of the "per site" users password file to the global one which already included the admin from a previous users site so you end up with multiples of the admin.
    I had since changed it (Finally, lazy bastard i am) months ago and the update is on my site www.djtremors.com

    just copy the awstats.php from the download package and manually copy it across, no need really to reinstall the whole thing. I don't think it would break the existing site (backup your one in case of course ;) )
     
  18. radim_h

    radim_h Member HowtoForge Supporter

    Hello!
    tried bit later then your answer here was .,

    i have installed new ispconfig server today, just manually copied your 1.4.1 awstats to appropriate directories and it is still same, one global password after each web site and one of the end of .htpasswd as bonus...

    i also tried change permissions on files in
    /home/admispconfig/ispconfig/web/ispc.awstats from root:root to admispconfig:admispconfig but nothing changed :(

    what im i doing wrong?

    BTW: haven't you think to update awstats in package from version 6.5 to last stable 6.7 ? http://awstats.sourceforge.net/#DOWNLOAD
    are the awstats 6.5 scripts modified anyhow or could i copy 6.7 over package directories?

    EDIT:
    yes it should be updated to awstats 6.7, it also solved problem with language="auto" , hope i didn't miss something
     
    Last edited: Jun 21, 2008
  19. djtremors

    djtremors ISPConfig Developer ISPConfig Developer

    Did you remember to run the cron command line manually as copying the script over the old one isn't enough unless you wait a day for the script to run overnight.
    Check the file modified date of the global password file and see if it was changed since the time you copied the new version over the old one.

    yes your right, I could upgrade the awstats to 6.7 but I am a man of the community these days and work on more protects and hacks than I should be... ie
    ispconfig
    dtc (www.gplhost.org)
    Xenaholic (my new Xen free enterprise project)
    cerberus helpdesk mods
    osticket mods
    etc.
    etc.

    i really should cut things down a little.

    but you can quite easily do the update yourselves if you basically copy the correct folders from awstats over the ones I supply and basically it's patched.. backup of course.

    hopefully in time when i rebuild my DTC development server, I'll also build my little ispconfig mod development environment again and fix things up...
    I need it done anyway as I have a squirrelmail mod to populate the preferences of the user so it doesn't email out as web##[email protected] but their proper email address.. ispconfigs SQL query joining is for the insane...
     
  20. radim_h

    radim_h Member HowtoForge Supporter

    Hello,
    ad 6.7.- as i wrote in edit, there was no problem installing 6.7over 6.5 and it also solved the mentioned problem with"language="auto" in 6.5 model.conf

    of course i ran the script manually :)

    Should be that cause by distro or something? i'm using Debian Etch...
    which part of sode is wipping out multiple global admin entries?
     

Share This Page