X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fcacti.pm;h=0220ff7d9f527f78819630691c194ea81c5f3502;hb=a111293b6aa333fdfe727df17eaf4a66ba9c6672;hp=a1447ac7b394f27d22b1e15ff6e1826c87538411;hpb=6cd1eaed3f43ff8d3e649f76eb2083587d8d63d1;p=freeside.git diff --git a/FS/FS/part_export/cacti.pm b/FS/FS/part_export/cacti.pm index a1447ac7b..0220ff7d9 100644 --- a/FS/FS/part_export/cacti.pm +++ b/FS/FS/part_export/cacti.pm @@ -55,6 +55,8 @@ tie my %options, 'Tie::IxHash', 'delete_graphs' => { label => 'Delete associated graphs and data sources when unprovisioning', type => 'checkbox', }, + 'include_path' => { label => 'Path to cacti include dir (relative to script_path)', + default => '../site/include/' }, 'cacti_graph_template_id' => { 'label' => 'Graph Template', 'type' => 'custom', @@ -193,6 +195,7 @@ sub _delete_queue { 'hostname' => $svc_broadband->ip_addr, 'script_path' => $self->option('script_path'), 'delete_graphs' => $self->option('delete_graphs'), + 'include_path' => $self->option('include_path'), ); return ($queue,$error); } @@ -251,6 +254,8 @@ sub ssh_insert { . trailslash($opt{'script_path'}) . q(freeside_cacti.php --get-graph-templates --host-template=) . $opt{'template_id'}; + $cmd .= q( --include-path=') . $self->option('include_path') . q(') + if $self->option('include_path'); my $ginfo = { map { $_ ? ($_ => undef) : () } split(/\n/,ssh_cmd(%opt, 'command' => $cmd)) }; # Add extra config info @@ -343,6 +348,8 @@ sub ssh_delete { . q('); $cmd .= q( --delete-graphs) if $opt{'delete_graphs'}; + $cmd .= q( --include-path=') . $opt{'include_path'} . q(') + if $opt{'include_path'}; my $response = ssh_cmd(%opt, 'command' => $cmd); die "Error removing from cacti: " . $response if $response; @@ -420,6 +427,8 @@ sub process_graphs { . q(freeside_cacti.php --get-graphs --ip=') . $svc->ip_addr . q('); + $cmd .= q( --include-path=') . $self->option('include_path') . q(') + if $self->option('include_path'); my @graphs = map { [ split(/\t/,$_) ] } split(/\n/, ssh_cmd( 'host' => $self->machine, @@ -501,7 +510,7 @@ sub process_graphs { } unlink($thumbfile); } else { - $svchtml .= qq(

File $thumbfile does not exist, skipping

); + $svchtml .= qq(

Error loading graph: $$graph[0]

); } $job->update_statustext(49 + int($i / @graphs) * 50); }