cacti Apache Web Hits the graph is empty

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

cc
Cacti User
Posts: 71
Joined: Fri Sep 27, 2002 3:09 am
Location: CH

Hi

Post by cc »

It looks:

perl /srv/www/htdocs/cacti/scripts/webhits.pl /var/log/httpd/access_log
/usr/bin/rrdtool update /srv/www/htdocs/cacti/rra/system_webhits.rrd --template system_webhits N:U

(Optional) Log Path
/var/log/httpd/access_log

Regards
Christoph
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

Now at least we know that cacti is working properly. The problem is that webhits.pl does not deliver correct values to cacti.

Try to run "perl /srv/www/htdocs/cacti/scripts/webhits.pl /var/log/httpd/access_log" manually and check if you receive correct value. If yes then there may be some problems with your cron user (because it is cron running cmd.php and webhits.pl every 5 min).

- bulek
cc
Cacti User
Posts: 71
Joined: Fri Sep 27, 2002 3:09 am
Location: CH

Hi

Post by cc »

When I'm doing manually I get the answer:

szhdns:/srv/www/htdocs/cacti/scripts # perl webhits.pl /var/log/httpd/access_log
3449szhdns:/srv/www/htdocs/cacti/scripts #

But still nothing on the graph.
When I have a problem with the cron user, why I get all others graphs ?

Regards
Christoph
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

Let's look at error messages. In your crontab file you have a line similar to the one:
*/5 * * * * cactiuser php /var/www/html/cacti/cmd.php > /dev/null 2>&1

Change it to let's say:
*/5 * * * * cactiuser php /var/www/html/cacti/cmd.php > /tmp/err.log 2>&1

Wait about 10 min and look into "/tmp/err.log". Try to locate error message related to webhits.pl.

- bulek
cc
Cacti User
Posts: 71
Joined: Fri Sep 27, 2002 3:09 am
Location: CH

Hi

Post by cc »

I did all changes at crontab, but the err.log file is empty.
cc
Cacti User
Posts: 71
Joined: Fri Sep 27, 2002 3:09 am
Location: CH

Hi bulek

Post by cc »

I changed at crontab from cactiuser to root , and now is working !

Best Regards
christoph
pelillom
Posts: 2
Joined: Fri Mar 14, 2003 8:26 am

webhits.pl -- no data

Post by pelillom »

I am having the same problem under RH8.

If I run perl webhits.pl /usr/local/apache2/logs/access_log
I get back /usr/local/apache2

????

The file is rx-r--r--, the cron is run as root, but still nothing, any suggestions?
cc
Cacti User
Posts: 71
Joined: Fri Sep 27, 2002 3:09 am
Location: CH

Hi

Post by cc »

Hi

1. Pls try to set the access_log to rw-r--r-- for user root and not for cactiuser.
2. Go to the the Data Sources system_webhits edit and
set the path to your access_log:
/usr/local/apache2/logs/access_log
3. Try again with perl webhits.pl /usr/local/apache2/logs/access_log

Regards
Chris
monideth

cacti Apache Web Hits the graph is empty

Post by monideth »

Try changing the permission of the /var/log/httpd directory to have executable persmission:

drwxr-xr-x 2 root root 4096 Apr 1 11:49 httpd

Note: I am not sure what security implications this poses.

Regards,

Mon
jigma

Re: webhits.pl -- no data

Post by jigma »

pelillom wrote:I am having the same problem under RH8.

If I run perl webhits.pl /usr/local/apache2/logs/access_log
I get back /usr/local/apache2

????

The file is rx-r--r--, the cron is run as root, but still nothing, any suggestions?
I think this is to do with how the script gets the number of hits.

Basically it runs "wc -l" which counts the number of newline characters in a file and prints that out...along with the name of the file. So the out put looks like this:

[jigma@statgn2 pts/2] wc -l /var/log/apache2/access_log
8384 /var/log/apache2/access_log

Then the script has to try and grab only the number part and not the file name. The regular expression that is being used to do the second part is getting caught out by the number in "apache2".

I modifed my script (<cacti dir>/scripts/webhits.pl) and changed the regular expression line like below:

old regex: $webhits =~ s/.*\s(.*[0-9])//; (delete this line)

New regex: $webhits =~ m/(\d+)/; (add this line)

The file now looks like this:


#!/usr/bin/perl

if ($ARGV[0] eq "") {
$log_path = "/var/log/apache2/access_log";
}else{
$log_path = $ARGV[0];
}

$webhits = `wc -l $log_path`;
$webhits =~ m/(\d+)/;

print $1;



Let me know how you get on.

j.d+SPAMSUX0r+@paradise.net.nz
(remove +SPAMSUX0r+)
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests