I am new to Cacti, even if I already put it on a few servers. Until now, I just used the basic available graphs, without searching to do something new. But now, I have to do some of them, so I am into the documentation for a few days.
Actuallty, I am trying to check webhits on my server.
So I put the script webhits as defined on the Cacti website :
Code: Select all
#!/usr/bin/perl
if ($ARGV[0] eq "") {
$log_path = "/usr/local/apache/logs/access_log";
}else{
$log_path = $ARGV[0];
}
$webhits = `wc -l $log_path`;
$webhits =~ s/[\s]*([0-9]+).*//;
print $1;
Code: Select all
bash-2.05b$ whoami
nobody
bash-2.05b$ perl webhits.pl
2398
Now, in Cacti, I did the above stuff :
Data Input Method:
Name: Apache Hits
Input type: Script/Command
Input string: perl <path_cacti>/scripts/webhits.pl
Output fields: webhits with the "Update RRD File" checkboxes
Data Template:
Name: Unix - Apache Hits
Data Input Method: Apache Hits
Internal Data Source Name: apache_hits
Output Field: webhits - Apache Hits
Data Source:
Selected Data Template: Unix - Apache Hits
Host: Localhost
Data Source Path: <path_rra>/localhost_apache_hits_18.rrd
Graph Management:
Selected Graph Template: Unix - Apache Hits
Host: Localhost
Data Source [apache_hits]: Localhost - Apache Hits (apache_hits)
I did all of this, as I read the cacti manual, so I guess it should work. But, unfortunatly, it doesn't. The graph stay empty.
Any idea ?