I am having this same problem using 'ramanage.pl', a script that runs Argus's racount on packet capture files. At first I thought maybe a bug in cactid was causing it to timeout prematurely - the script has to run on large data files and takes several minutes to return results. A 'time -h' reports ramanage.pl runtime on a 157M file (it was running on a 1G file in unofficial tests):
7m3.22s real 2m56.11s user 3m45.55s sys
But once I ran cactid by hand, I got the following output:
---debug output ---------------------------------------------------------------
CACTID: CACTID: Version 0.8.6d starting
CACTID: MYSQL: Connecting to MySQL database 'cacti' on 'localhost'...
CACTID: DEBUG: PHP Script Server Routine Started
CACTID: DEBUG: PHP Script Server About to FORK Child Process
CACTID: DEBUG: PHP Script Server Child FORK Success
CACTID: DEBUG: Confirmed PHP Script Server Running
CACTID: DEBUG: Initial Value of Active Threads is 0
CACTID: DEBUG: Valid Thread to be Created
CACTID: DEBUG: The Value of Active Threads is 1
CACTID: DEBUG: In Poller, About to Start Polling of Host
CACTID: MYSQL: Connecting to MySQL database 'cacti' on 'localhost'...
CACTID: Host[1] SNMP Result: Host does not require SNMP
CACTID: DEBUG: SQLCMD: update host set status='3',status_event_count='0', status_fail_date='0000-00-00 00:00:00',status_rec_date='0000-00-00 00:00:00',status_last_error='',min_time='0.000000',max_time='0.000000',cur_time='0.000000',avg_time='0.000000',total_polls='25',failed_polls='0',availability='100.0000' where id='1'
CACTID: Host[1] DEBUG: The POPEN returned the following File Descriptor 9
CACTID: Host[1] ERROR: The POPEN timed out
CACTID: Host[1] WARNING: Result from SCRIPT not valid. Partial Result: U...
CACTID: Host[1] SCRIPT: perl /usr/local/www/data-dist/cacti/scripts/ramanage.pl ip /var/log/argus/argus.out, output: U
CACTID: DEBUG: SQLCMD: insert into poller_output (local_data_id,rrd_name,time,output) values (16,'','2005-03-05 16:08:18','U')
CACTID: Host[1] DEBUG: HOST COMPLETE: About to Exit Host Polling Thread Function
CACTID: DEBUG: The Value of Active Threads is 0
CACTID: DEBUG: SQLCMD: replace into settings (name,value) values ('date',NOW())
CACTID: DEBUG: SQLCMD: insert into poller_time (poller_id, start_time, end_time) values (0, NOW(), NOW())
CACTID: DEBUG: Thread Cleanup Complete
CACTID: DEBUG: PHP Script Server Shutdown Started
CACTID: DEBUG: PHP Script Server Pipes Closed
CACTID: DEBUG: Allocated Variable Memory Freed
CACTID: DEBUG: MYSQL Free & Close Completed
CACTID: Execution Time: 435.7545 s, Threads: 5, Hosts: 1
---debug output------------------------------------------------------------------
cactid also does not update my .rrd file either. I should also point
out that cmd.php will complete a successful run but not update my .rrd file.
I'm just starting out with cacti, so I'm not clear why that is yet and how these two issues are related.
When run manually, this script consistintently returns its results in colon delimited format. Ex:
4025
17565
11302261:6095265:5206995
I'm using cacti v0.8.6.c and I've included the ramanage.pl script below. If more info is necessary, please let me know.
thanks,
njc
---ramanage.pl-------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;
my $ra_bin = "/usr/local/bin/racount";
my $ra_expr = $ARGV[0] or die &Usage();
my $ra_file = $ARGV[1] or die &Usage();
print &GetRAData() ."\n";
sub GetRAData () {
my $proto;
my $record;
my $total_pkts;
my $src_pkts;
my $dst_pkts;
my $total_bytes;
my $src_bytes;
my $dst_bytes;
my $result;
my $RAResult = `$ra_bin -r $ra_file \-\- $ra_expr`;
foreach ( split(/\n/,$RAResult) ) {
if ( m/sum/ ) {
s/^\s+(.*)$/$1/g;
s/\s+/ /g;
( $proto,
$record,
$total_pkts,
$src_pkts,
$dst_pkts,
$total_bytes,
$src_bytes,
$dst_bytes ) = split(/\s/);
}
}
if ( !defined($total_bytes) ) {
$result = "0:0:0:0:0:0:0";
}
else {
$record = int( $record / 300 );
$total_pkts = int( $total_pkts / 300 );
$src_pkts = int( $src_pkts / 300 );
$dst_pkts = int( $dst_pkts / 300 );
$total_bytes = int( $total_bytes / 300 );
$src_bytes = int( $src_bytes / 300 );
$dst_bytes = int( $dst_bytes / 300 );
$result = $record .":".
$total_pkts .":".
$src_pkts .":".
$dst_pkts .":".
$total_bytes .":".
$src_bytes .":".
$dst_bytes;
}
return $result;
}
sub Usage() {
print "Usage: $0 <raexpr> <rafile>\n";
exit 0;
}
---ramanage.pl--------------------------------------------------------------------