summaryrefslogtreecommitdiff
path: root/FS/FS/part_export/cacti.pm
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-11-24 02:32:41 -0600
committerJonathan Prykop <jonathan@freeside.biz>2015-11-24 14:32:59 -0600
commit60cad35f8b6bebefd8c9d78a83d70e0d5ddd68bf (patch)
treed1cf7387a384c6ca7883a387938a6ef64ca17a11 /FS/FS/part_export/cacti.pm
parentf579cdd720020917d5c6a67eb99fa2e12cda6543 (diff)
RT#38989: Incorrect paths when cacti is installed from source
Diffstat (limited to 'FS/FS/part_export/cacti.pm')
-rw-r--r--FS/FS/part_export/cacti.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/FS/FS/part_export/cacti.pm b/FS/FS/part_export/cacti.pm
index 7de97946c..2e1177f24 100644
--- a/FS/FS/part_export/cacti.pm
+++ b/FS/FS/part_export/cacti.pm
@@ -53,6 +53,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',
@@ -191,6 +193,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);
}
@@ -249,6 +252,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
@@ -341,6 +346,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;
@@ -417,6 +424,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,
@@ -498,7 +507,7 @@ sub process_graphs {
}
unlink($thumbfile);
} else {
- $svchtml .= qq(<P STYLE="color: #FF0000">File $thumbfile does not exist, skipping</P>);
+ $svchtml .= qq(<P STYLE="color: #FF0000">Error loading graph: $$graph[0]</P>);
}
$job->update_statustext(49 + int($i / @graphs) * 50);
}