This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Webalizer Stats - Centos 7 - Working Fix
#1
Webalizer Stats - Centos 7 - Working Fix
I noticed my Webalizer stats wasn't working in my Sentora Centos 7 install so I searched and found that package wasn't available for Centos 7 in the past. Well, the package is now available so all you need to do is run the following command in SSH and restart your services. All is working great now!

Code:
yum install webalizer


I just wanted to let everyone know.  Big Grin

(09-23-2018, 01:21 AM)james30263 Wrote: I noticed my Webalizer stats wasn't working in my Sentora Centos 7 install so I searched and found that package wasn't available for Centos 7 in the past. Well, the package is now available so all you need to do is run the following command in SSH and restart your services. All is working great now!

Code:
yum install webalizer


I just wanted to let everyone know.  Big Grin

So it looks like I got ahead of myself. Webalizer stats work however It shows the panels site for all accounts. So I guess I need to figure out how to correct this. Anyone have any ideas on how to make it display the sites properly for each account?
Reply
Thanks given by:
#2
RE: Webalizer Stats - Centos 7 - Working Fix
(09-23-2018, 01:21 AM)james30263 Wrote: I noticed my Webalizer stats wasn't working in my Sentora Centos 7 install so I searched and found that package wasn't available for Centos 7 in the past. Well, the package is now available so all you need to do is run the following command in SSH and restart your services. All is working great now!

Code:
yum install webalizer


I just wanted to let everyone know.  Big Grin


So it looks like I got ahead of myself. Webalizer stats work however It shows the panels site for all accounts. So I guess I need to figure out how to correct this. Anyone have any ideas on how to make it display the sites properly for each account?

Just to be clear, do you think that it is showing the panel's overall stats regardless of which site you choose to view, or is it showing the correct stats for the correct individual site, but with the wrong label/URL?

Checking my servers, it looks like the stats/URLs of pages visited are for the correct sites BUT they are all labelled with the panel's URL instead of the individual vhost's URLs, but I might be reading it wrong.

Keith
Reply
Thanks given by:
#3
RE: Webalizer Stats - Centos 7 - Working Fix
So the url is showing the panel url but the website data is from one of my clients sites. It shows the same data for all clients.
Reply
Thanks given by:
#4
RE: Webalizer Stats - Centos 7 - Working Fix
(09-23-2018, 06:40 AM)james30263 Wrote: So the url is showing the panel url but the website data is from one of my clients sites. It shows the same data for all clients.

Ah OK, I'm going to have a look for myself and see if I can figure out what's going on as it must be the same on my servers...

Keith
Reply
Thanks given by:
#5
RE: Webalizer Stats - Centos 7 - Working Fix
Ok, I have a couple of suggestions/theories:

1) Because you had to install Webalizer after you did the Sentora installation, there is a line in the installation script that will have been missed and will probably need to be run (to delete the default conf file). Depending on your OS it is one of these:

CentOS:

Code:
rm -rf /etc/webalizer.conf

or Debian/Ubuntu:

Code:
rm -rf /etc/webalizer/webalizer.conf


2) For some reason, the code that runs Webalizer has command line options in a certain order which no longer seem to pass the virtual host's domain to Webalizer correctly, so I have rewritten it on my servers and it now should pass the correct website name and URLs for the generation of Webalizer stats for each website you host. I'm on CentOS 7 so this should work for you (Debian/Ubuntu users might need to adjust the edit path etc.):


Code:
vi /etc/sentora/panel/modules/webalizer_stats/hooks/OnDaemonHour.hook.php

Replace the contents of this file with this code:

Code:
<?php

/**
 * @copyright 2014-2015 Sentora Project (http://www.sentora.org/) 
 * Sentora is a GPL fork of the ZPanel Project whose original header follows:
 *
 * ZPanel - Visitor Stats zpanel plugin, written by RusTus: www.zpanelcp.com.
 *
 * changes P;Peyremorte : reduced duplicate strings constructions
 */
echo fs_filehandler::NewLine() . "BEGIN Webalizer Stats" . fs_filehandler::NewLine();
if ( ui_module::CheckModuleEnabled( 'Webalizer Stats' ) ) {
    GenerateWebalizerStats();
}
else {
    echo "Webalizer Stats Module DISABLED." . fs_filehandler::NewLine();
}
echo "END Webalizer Stats" . fs_filehandler::NewLine();

function GenerateWebalizerStats()
{
    global $zdbh;
    $sql      = $zdbh->prepare( "SELECT * FROM x_vhosts LEFT JOIN x_accounts ON x_vhosts.vh_acc_fk=x_accounts.ac_id_pk WHERE vh_deleted_ts IS NULL" );
    $sql->execute();
    echo "Generating webalizer stats html..." . fs_filehandler::NewLine();
    while ( $rowvhost = $sql->fetch() ) {
      $basedir = ctrl_options::GetSystemOption( 'sentora_root' ) . "modules/webalizer_stats/stats/" . $rowvhost[ 'ac_user_vc' ] . "/" . $rowvhost[ 'vh_name_vc' ];
      if ( !file_exists( $basedir ) ) {
          @mkdir( $basedir, 0755, TRUE );
        }

        /** set webalizer command dependant on OS */
        if ( sys_versions::ShowOSPlatformVersion() == "Windows" ) {
            $command = ctrl_options::GetSystemOption( 'sentora_root' ) .
                'modules/webalizer_stats/bin/webalizer.exe';
        }
        else {
            chmod( ctrl_options::GetSystemOption( 'sentora_root' ) . "modules/webalizer_stats/bin/webalizer", 4777 );
            $command = "webalizer";
        }

        /** all other args and flags are the same so keep them outsite to avoid duplication */
        $flag        = '-o';

        $secondFlags = '-d -F clf';

        $domain = '-n' . $rowvhost[ 'vh_name_vc' ];

        $logFile = realpath( ctrl_options::GetSystemOption( 'log_dir' ) .
            'domains/' .
            $rowvhost[ 'ac_user_vc' ] .
            '/' .
            $rowvhost[ 'vh_name_vc' ] .
            '-access.log' );

        $statsPath = ctrl_options::GetSystemOption( 'sentora_root' ) .
            "modules/webalizer_stats/stats/" .
            $rowvhost[ 'ac_user_vc' ] .
            '/' .
            $rowvhost[ 'vh_name_vc' ];

        /** build arg array, this is in the required order! do not just change the order of this array */
        $args = array(
            $logFile,
            $domain,
            $flag,
            $statsPath,
            $secondFlags,
        );

        echo "Generating stats for: " . $rowvhost[ 'ac_user_vc' ] . "/" . $rowvhost[ 'vh_name_vc' ] . fs_filehandler::NewLine();
        $returnValue = ctrl_system::systemCommand( $command, $args );
        echo (0 === $returnValue ? 'Succeeded' : 'Failed') . fs_filehandler::NewLine();
    }
}

?>

and save the new file.

Give the daemon a chance to run and see if this makes a difference to your Webalizer stats. If not let me know!

Keith
Reply
Thanks given by: james30263
#6
RE: Webalizer Stats - Centos 7 - Working Fix
Holy Cow Keith! You are on it! It works perfect! Thanks Brother  Big Grin

TGates & Me.B, can we get the Webalizer code added back into the install script for Centos 7 since everything works again?

It would save a lot of headaches for others. Then again they can just read this post.  Cool
Reply
Thanks given by:
#7
RE: Webalizer Stats - Centos 7 - Working Fix
(09-23-2018, 10:52 AM)james30263 Wrote: Holy Cow Keith! You are on it! It works perfect! Thanks Brother  Big Grin

TGates & Me.B, can we get the Webalizer code added back into the install script for Centos 7 since everything works again?

It would save a lot of headaches for others. Then again they can just read this post.  Cool

I might be missing something, but I didn't think it had been removed from the install script? I can see it in both the latest release (1.0.3) and the latest version in the master repository?

However the code changes I made in the daemon hook file are probably something that should be tested and possibly incorporated into the master repository if others are having the hostname/URL issue we discussed... I know it was happening on my servers and I just hadn't spotted it, so maybe others are having the same error? Easy for people to check - view the Webalizer stats for your various vhost sites and see if they name each site correctly at the top where it says "Usage Statistics for", or if they all have the hostname of your panel instead.

Keith
Reply
Thanks given by:
#8
RE: Webalizer Stats - Centos 7 - Working Fix
(09-23-2018, 11:28 AM)fearworks Wrote: I might be missing something, but I didn't think it had been removed from the install script? I can see it in both the latest release (1.0.3) and the latest version in the master repository?

However the code changes I made in the daemon hook file are probably something that should be tested and possibly incorporated into the master repository if others are having the hostname/URL issue we discussed... I know it was happening on my servers and I just hadn't spotted it, so maybe others are having the same error? Easy for people to check - view the Webalizer stats for your various vhost sites and see if they name each site correctly at the top where it says "Usage Statistics for", or if they all have the hostname of your panel instead.

Keith

I will need to look at my logs to see why the Webalizer package didn't install using the install script. I had to manually install the Webalizer package. Did your install using the script?
Reply
Thanks given by:
#9
RE: Webalizer Stats - Centos 7 - Working Fix
(09-24-2018, 02:31 AM)james30263 Wrote: I will need to look at my logs to see why the Webalizer package didn't install using the install script. I had to manually install the Webalizer package. Did your install using the script?

Yes, I've been installing Sentora for a few months and I don't recall having a problem with it... is it possible that it was just unavailable from the relevant source for a short while which coincided with the time you installed Sentora? That was what I thought you meant anyway when I first read your original post.

Other than that I don't know...  Undecided

Keith.
Reply
Thanks given by:
#10
RE: Webalizer Stats - Centos 7 - Working Fix
I have always had this issue. Changing the code listed above did nothing for webalizer properly labeling the domain rather than the panel domain on the page.

Any ideas?
Everyone makes mistakes, but to truly screw up it takes the root password!
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Webalizer Stats not work - how to fix it ? domyhost 4 6 ,983 09-22-2024, 02:35 PM
Last Post: TGates
OS - Ubuntu 18.04 or Centos 8 Qrash 1 5 ,326 01-18-2021, 07:48 PM
Last Post: Jettaman
How to run multiple version PHP with Apache (use Sentora panel) on Centos ??? BigBang 4 9 ,316 12-23-2020, 03:31 PM
Last Post: djkashdui1

Forum Jump:


Users browsing this thread: 5 Guest(s)