From 05688e549ed17ce8b7c8b98082bae4d4e39e47f2 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Wed, 8 Mar 2023 21:53:23 +0100 Subject: [PATCH 1/5] web: remove the SVG format for icons According to https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text/Web_fonts All major browsers support WOFF/WOFF2 (Web Open Font Format versions 1 and 2). Even older browsers such as IE9 (released in 2011) support the WOFF format. We are leaving the other old formats also, as only SVG is huge. --- web/static/css/materialdesignicons.css | 2 +- .../fonts/materialdesignicons-webfont.svg | 4035 ----------------- 2 files changed, 1 insertion(+), 4036 deletions(-) delete mode 100644 web/static/fonts/materialdesignicons-webfont.svg diff --git a/web/static/css/materialdesignicons.css b/web/static/css/materialdesignicons.css index bc365b5ee2..34546d6cbd 100644 --- a/web/static/css/materialdesignicons.css +++ b/web/static/css/materialdesignicons.css @@ -2,7 +2,7 @@ @font-face { font-family: "Material Design Icons"; src: url("../fonts/materialdesignicons-webfont.eot?v=1.3.41"); - src: url("../fonts/materialdesignicons-webfont.eot?#iefix&v=1.3.41") format("embedded-opentype"), url("../fonts/materialdesignicons-webfont.woff2?v=1.3.41") format("woff2"), url("../fonts/materialdesignicons-webfont.woff?v=1.3.41") format("woff"), url("../fonts/materialdesignicons-webfont.ttf?v=1.3.41") format("truetype"), url("../fonts/materialdesignicons-webfont.svg?v=1.3.41#materialdesigniconsregular") format("svg"); + src: url("../fonts/materialdesignicons-webfont.eot?#iefix&v=1.3.41") format("embedded-opentype"), url("../fonts/materialdesignicons-webfont.woff2?v=1.3.41") format("woff2"), url("../fonts/materialdesignicons-webfont.woff?v=1.3.41") format("woff"), url("../fonts/materialdesignicons-webfont.ttf?v=1.3.41") format("truetype"); font-weight: normal; font-style: normal; } diff --git a/web/static/fonts/materialdesignicons-webfont.svg b/web/static/fonts/materialdesignicons-webfont.svg deleted file mode 100644 index 58f9f6e830..0000000000 --- a/web/static/fonts/materialdesignicons-webfont.svg +++ /dev/null @@ -1,4035 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From b0c8c15b38732436c3940acd01436363558afcad Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Wed, 8 Mar 2023 21:55:34 +0100 Subject: [PATCH 2/5] m/update: reuse the db connection within a process --- lib/Munin/Master/Update.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Munin/Master/Update.pm b/lib/Munin/Master/Update.pm index ed249cced5..8f68f51067 100644 --- a/lib/Munin/Master/Update.pm +++ b/lib/Munin/Master/Update.pm @@ -82,7 +82,7 @@ sub get_dbh { use Carp; $db_args{HandleError} = sub { confess(shift) }; - my $dbh = DBI->connect("dbi:$db_driver:dbname=$datafilename", $db_user, $db_passwd, \%db_args) or die $DBI::errstr; + my $dbh = DBI->connect_cached("dbi:$db_driver:dbname=$datafilename", $db_user, $db_passwd, \%db_args) or die $DBI::errstr; INFO 'get_dbh: $dbh->{Driver}->{Name} = ' . $dbh->{Driver}->{Name} . ($is_read_only ? "(ro)" : "(rw)"); @@ -216,7 +216,12 @@ sub _run_workers { $res = $worker->do_work(); }; - $worker->{dbh}->disconnect(); + # Disconnect via removing it from scope + # + # We don't want to call disconnect forcefully, in order to + # fully leverage the reference counting and the automatic call + # to ->DESTROY + delete($worker->{dbh}); my $worker_id = $worker->{ID}; if (! $res || $@) { From a90fb2525bed68a8690247e499c1f5b60756e04e Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Wed, 8 Mar 2023 21:58:27 +0100 Subject: [PATCH 3/5] m-n-d: reduce the speed of updates when too many plugins --- contrib/munin-node-debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/munin-node-debug b/contrib/munin-node-debug index 7f139bb3c2..fc75cbdc81 100755 --- a/contrib/munin-node-debug +++ b/contrib/munin-node-debug @@ -216,7 +216,7 @@ sub service } elsif ($line =~ m/^fetch (\w+)/) { my $plugin_number = get_plugin_number($1); for (my $i = 0; $i < $fields_per_plugin; $i ++) { - my $value = sin( (time / 3600) * $plugin_number + $i) * (4 ** $plugin_number); + my $value = sin( (time / 3600) * $plugin_number + $i) * (4 ** ($plugin_number%5)); $value = int($value * 1024) if ($plugin_number + $i) % 3; print $client get_ds($plugin_number, $i) . ".value $value\n"; From 2f6a642453e0bead18b55fa452fa509bdad0b82d Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Thu, 9 Mar 2023 21:11:49 +0100 Subject: [PATCH 4/5] m/httpd: untaint $PATH --- script/munin-httpd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/munin-httpd b/script/munin-httpd index fe81d2d5ed..406d68c358 100755 --- a/script/munin-httpd +++ b/script/munin-httpd @@ -13,6 +13,8 @@ use Munin::Master::Graph; use Munin::Master::HTML; use Munin::Common::Logger; +# Untaint $ENV{PATH} +$ENV{PATH} = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"; sub handle_request { my $self = shift; From a5c90f9eba157329679ba72f3fd55ebc3aea4b5d Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Thu, 9 Mar 2023 21:12:54 +0100 Subject: [PATCH 5/5] m/httpd: Adding config to nb of servers --- script/munin-httpd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script/munin-httpd b/script/munin-httpd index 406d68c358..ec38161144 100755 --- a/script/munin-httpd +++ b/script/munin-httpd @@ -43,6 +43,8 @@ my $debug = 0; my $stdout = 0; my $loglevel = 'info'; +my $max_servers = 10; + print_usage_and_exit() unless GetOptions( "listen=s" => \$listen, @@ -50,6 +52,7 @@ print_usage_and_exit() "stdout" => \$stdout, "loglevel=s" => \$loglevel, "version" => \&print_version_and_exit, + "max-servers=i" => \$max_servers, "help" => \&print_usage_and_exit, ); @@ -77,7 +80,7 @@ if ($stdout) { Munin::Common::Logger::INFO("Starting preforking munin http server at $host:$port"); -Munin::Master::Http->new( { host => $host, port => $port } )->run( prefork => 1, max_servers => 10 ); +Munin::Master::Http->new( { host => $host, port => $port } )->run( prefork => ($max_servers > 0), max_servers => $max_servers ); sub print_usage_and_exit {