X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fcollection3%2Fbin%2Findex.cgi;h=ba5b48a0937b8c42bd2557142fbe33565ab156c8;hb=c35203c82560eba66bb901aa22c5170fb8c389fb;hp=d581bfbee11fcbbfa65fc3202d33702a68e1a3b4;hpb=61011a9d336d85890eac845c5af23a8046e74c10;p=collectd.git diff --git a/contrib/collection3/bin/index.cgi b/contrib/collection3/bin/index.cgi index d581bfbe..ba5b48a0 100755 --- a/contrib/collection3/bin/index.cgi +++ b/contrib/collection3/bin/index.cgi @@ -20,6 +20,7 @@ use warnings; use lib ('../lib'); use utf8; +use Carp (qw(cluck confess)); use FindBin ('$RealBin'); use CGI (':cgi'); use CGI::Carp ('fatalsToBrowser'); @@ -27,11 +28,11 @@ use HTML::Entities ('encode_entities'); use Data::Dumper; -use Collectd::Graph::Config (qw(gc_read_config)); +use Collectd::Graph::Config (qw(gc_read_config gc_get_scalar)); use Collectd::Graph::TypeLoader (qw(tl_load_type)); use Collectd::Graph::Common (qw(get_files_from_directory get_all_hosts get_timespan_selection get_selected_files get_host_selection - get_plugin_selection)); + get_plugin_selection flush_files)); use Collectd::Graph::Type (); our $Debug = param ('debug') ? 1 : 0; @@ -145,7 +146,7 @@ HTML collection.cgi, Version 3 - HTML @@ -271,20 +272,28 @@ sub action_show_selection start_html (); show_selector (); - my $ident = {}; - my $all_files; + my $timespan; + my $types = {}; my $id_counter = 0; $all_files = get_selected_files (); + $timespan = get_timespan_selection (); if ($Debug) { print "
", Data::Dumper->Dump ([$all_files], ['all_files']), "
\n"; } + # Send FLUSH command to the daemon if necessary and possible. + flush_files ($all_files, + begin => time () - $timespan, + end => time (), + addr => gc_get_scalar ('UnixSockAddr', undef), + interval => gc_get_scalar ('Interval', 10)); + for (@$all_files) { my $file = $_; @@ -313,8 +322,6 @@ sub action_show_selection my $type = $_; my $graphs_num = $types->{$type}->getGraphsNum (); - my $timespan = get_timespan_selection (); - for (my $i = 0; $i < $graphs_num; $i++) { my $args = $types->{$type}->getGraphArgs ($i);