From: Florian Forster Date: Tue, 12 Aug 2008 09:31:40 +0000 (+0200) Subject: Merge branch 'collectd-4.4' X-Git-Tag: collectd-4.5.0~79 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=5e700757575fa6606cf201947cb0efb57ce12e6d;hp=f782b37840e50f3e21af5c6b8b200fa640730ee7;p=collectd.git Merge branch 'collectd-4.4' --- diff --git a/configure.in b/configure.in index a67f2a11..2b85a2bd 100644 --- a/configure.in +++ b/configure.in @@ -50,6 +50,18 @@ case $host_os in esac AC_MSG_RESULT([$ac_system]) +if test "x$ac_system" = "xLinux" +then + AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources]) + if test -z "$KERNEL_DIR" + then + KERNEL_DIR="/lib/modules/`uname -r`/source" + fi + + KERNEL_CFLAGS="-I$KERNEL_DIR/include" + AC_SUBST(KERNEL_CFLAGS) +fi + # # Checks for header files. # @@ -278,8 +290,13 @@ have_net_ip_vs_h="no" have_ip_vs_h="no" if test "x$ac_system" = "xLinux" then + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $KERNEL_CFLAGS" + AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"]) AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"]) + + CFLAGS=$SAVE_CFLAGS fi # For quota module @@ -1683,15 +1700,6 @@ then LDFLAGS=$SAVE_LDFLAGS fi -if test "x$ac_system" = "xLinux" -then - AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources]) - if test -z "$KERNEL_DIR" - then - KERNEL_DIR="/lib/modules/`uname -r`/source" - fi -fi - with_own_libiptc="no" AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])], [ @@ -1737,7 +1745,7 @@ fi if test "x$with_libiptc" = "xyes" then SAVE_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -I$KERNEL_DIR/include" + CFLAGS="$CFLAGS $KERNEL_CFLAGS" AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [], [ diff --git a/contrib/collection3/bin/graph.cgi b/contrib/collection3/bin/graph.cgi index c84199df..7c29bb01 100755 --- a/contrib/collection3/bin/graph.cgi +++ b/contrib/collection3/bin/graph.cgi @@ -9,7 +9,8 @@ use Carp (qw(confess cluck)); use CGI (':cgi'); use RRDs (); -use Collectd::Graph::TypeLoader (qw(tl_read_config tl_load_type)); +use Collectd::Graph::Config (qw(gc_read_config gc_get_scalar)); +use Collectd::Graph::TypeLoader (qw(tl_load_type)); use Collectd::Graph::Common (qw(sanitize_type get_selected_files epoch_to_rfc1123)); @@ -18,6 +19,7 @@ use Collectd::Graph::Type (); our $Debug = param ('debug'); our $Begin = param ('begin'); our $End = param ('end'); +our $GraphWidth = param ('width'); if ($Debug) { @@ -27,7 +29,17 @@ Content-Type: text/plain HTTP } -tl_read_config ("$RealBin/../etc/collection3.conf"); +gc_read_config ("$RealBin/../etc/collection.conf"); + +if ($GraphWidth) +{ + $GraphWidth =~ s/\D//g; +} + +if (!$GraphWidth) +{ + $GraphWidth = gc_get_scalar ('GraphWidth', 400); +} { # Sanitize begin and end times $End ||= 0; @@ -93,15 +105,29 @@ for (@$files) } my $expires = time (); +# IF (End is `now') +# OR (Begin is before `now' AND End is after `now') if (($End == 0) || (($Begin <= $expires) && ($End >= $expires))) { # 400 == width in pixels - my $timespan = $expires - $Begin; - $expires += int ($timespan / 400); + my $timespan; + + if ($End == 0) + { + $timespan = $expires - $Begin; + } + else + { + $timespan = $End - $Begin; + } + $expires += int ($timespan / 400.0); } +# IF (End is not `now') +# AND (End is before `now') +# ==> Graph will never change again! elsif (($End > 0) && ($End < $expires)) { - $expires += 366 * 86400; + $expires += (366 * 86400); } elsif ($Begin > $expires) { @@ -112,6 +138,11 @@ print STDOUT header (-Content_type => 'image/png', -Last_Modified => epoch_to_rfc1123 ($obj->getLastModified ()), -Expires => epoch_to_rfc1123 ($expires)); +if ($Debug) +{ + print "\$expires = $expires;\n"; +} + my $args = $obj->getRRDArgs (0); if ($Debug) @@ -135,7 +166,7 @@ else } $| = 1; - RRDs::graph ('-', '-a', 'PNG', @timesel, @$args); + RRDs::graph ('-', '-a', 'PNG', '--width', $GraphWidth, @timesel, @$args); if (my $err = RRDs::error ()) { print STDERR "RRDs::graph failed: $err\n"; diff --git a/contrib/collection3/bin/index.cgi b/contrib/collection3/bin/index.cgi index b0001d26..d581bfbe 100755 --- a/contrib/collection3/bin/index.cgi +++ b/contrib/collection3/bin/index.cgi @@ -27,7 +27,8 @@ use HTML::Entities ('encode_entities'); use Data::Dumper; -use Collectd::Graph::TypeLoader (qw(tl_read_config tl_load_type)); +use Collectd::Graph::Config (qw(gc_read_config)); +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)); @@ -57,7 +58,7 @@ if (!exists ($Actions{$action})) exit 1; } -tl_read_config ("$RealBin/../etc/collection3.conf"); +gc_read_config ("$RealBin/../etc/collection.conf"); $Actions{$action}->(); exit (0); @@ -107,6 +108,14 @@ sub start_html { return if ($html_started); + my $end; + my $begin; + my $timespan; + + $end = time (); + $timespan = get_timespan_selection (); + $begin = $end - $timespan; + if (can_handle_xhtml ()) { print <collection.cgi, Version 3 +