summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9304721)
raw | patch | inline | side by side (parent: 9304721)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 5 Mar 2009 08:30:06 +0000 (09:30 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 5 Mar 2009 08:36:44 +0000 (09:36 +0100) |
contrib/collection3/etc/collection.conf | patch | blob | history | |
contrib/collection3/lib/Collectd/Graph/Common.pm | patch | blob | history |
index cc13b4c339b4cd19b7a631e0835cc8f77c9820e8..b7e76b2b7eef3cd1f2b3900a9352424156253963 100644 (file)
+#DataDir "/var/lib/collectd/rrd"
GraphWidth 400
#UnixSockAddr "/var/run/collectd-unixsock"
<Type apache_bytes>
diff --git a/contrib/collection3/lib/Collectd/Graph/Common.pm b/contrib/collection3/lib/Collectd/Graph/Common.pm
index 6f26fd826b164dec5ade1fc70d56873a90a97dcb..0deefd6368f638412f496db4deca5a87bed25344 100644 (file)
use vars (qw($ColorCanvas $ColorFullBlue $ColorHalfBlue));
+use Collectd::Unixsock ();
use Carp (qw(confess cluck));
use CGI (':cgi');
use Exporter;
+use Collectd::Graph::Config (qw(gc_get_scalar));
$ColorCanvas = 'FFFFFF';
$ColorFullBlue = '0000FF';
flush_files
));
-our $DataDir = '/var/lib/collectd/rrd';
+our $DefaultDataDir = '/var/lib/collectd/rrd';
return (1);
sub ident_to_filename
{
my $ident = shift;
+ my $data_dir = gc_get_scalar ('DataDir', $DefaultDataDir);
my $ret = '';
}
else
{
- $ret .= "$DataDir/";
+ $ret .= "$data_dir/";
}
if (!$ident->{'hostname'})
{
my $dh;
my @ret = ();
+ my $data_dir = gc_get_scalar ('DataDir', $DefaultDataDir);
- opendir ($dh, "$DataDir") or confess ("opendir ($DataDir): $!");
+ opendir ($dh, "$data_dir") or confess ("opendir ($data_dir): $!");
while (my $entry = readdir ($dh))
{
next if ($entry =~ m/^\./);
- next if (!-d "$DataDir/$entry");
+ next if (!-d "$data_dir/$entry");
push (@ret, sanitize_hostname ($entry));
}
closedir ($dh);
my @hosts = @_;
my $ret = {};
my $dh;
+ my $data_dir = gc_get_scalar ('DataDir', $DefaultDataDir);
if (!@hosts)
{
for (@hosts)
{
my $host = $_;
- opendir ($dh, "$DataDir/$host") or next;
+ opendir ($dh, "$data_dir/$host") or next;
while (my $entry = readdir ($dh))
{
my $plugin;
my $plugin_instance = '';
next if ($entry =~ m/^\./);
- next if (!-d "$DataDir/$host/$entry");
+ next if (!-d "$data_dir/$host/$entry");
if ($entry =~ m#^([^-]+)-(.+)$#)
{
sub get_files_for_host
{
my $host = sanitize_hostname (shift);
- return (get_files_from_directory ("$DataDir/$host", 2));
+ my $data_dir = gc_get_scalar ('DataDir', $DefaultDataDir);
+ return (get_files_from_directory ("$data_dir/$host", 2));
} # get_files_for_host
sub _filter_ident
my $ident = shift;
my $all_files;
my @ret = ();
+ my $data_dir = gc_get_scalar ('DataDir', $DefaultDataDir);
#if ($ident->{'hostname'})
#{
#}
#else
#{
- $all_files = get_files_from_directory ($DataDir, 3);
+ $all_files = get_files_from_directory ($data_dir, 3);
#}
@ret = grep { _filter_ident ($ident, $_) == 0 } (@$all_files);