cacti Apache Web Hits the graph is empty
Moderators: Developers, Moderators
Hi
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
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
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
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
Hi
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
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
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
*/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
webhits.pl -- no data
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?
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?
Hi
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
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
cacti Apache Web Hits the graph is empty
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
drwxr-xr-x 2 root root 4096 Apr 1 11:49 httpd
Note: I am not sure what security implications this poses.
Regards,
Mon
Re: webhits.pl -- no data
I think this is to do with how the script gets the number of hits.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?
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+)
Who is online
Users browsing this forum: No registered users and 3 guests