From c29f1c33254ce20fb4638df33b51d112c62f3dc1 Mon Sep 17 00:00:00 2001 From: Andreas Bachlechner <62039342+bachandi@users.noreply.github.com> Date: Mon, 28 Feb 2022 22:09:49 +0100 Subject: [PATCH] Add alt_scaling_for_timeleft, alt_scaling_for_battery_voltage and alt_scaling_for_voltage config options to nut module. This option sets the alternative scaling option for the corresponding plots. --- lib/nut.pm | 19 +++++++++++++++++++ man/man5/monitorix.conf.5 | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/lib/nut.pm b/lib/nut.pm index 3d58079..8eec38a 100644 --- a/lib/nut.pm +++ b/lib/nut.pm @@ -259,6 +259,16 @@ sub skipscale_string { } } +sub altscaling_options { + my ($altscaling) = @_; + my @scaling_options; + if ($altscaling) { + push(@scaling_options, "--alt-autoscale"); + push(@scaling_options, "--alt-y-grid"); + } + return @scaling_options; +} + sub nut_cgi { my ($package, $config, $cgi) = @_; my @output; @@ -321,6 +331,9 @@ sub nut_cgi { my $ignore_error_output = lc($nut->{ignore_error_output} || "") eq "y" ? 1 : 0; my $skipscale_for_transfer_voltage = lc($nut->{skipscale_for_transfer_voltage} || "") eq "y" ? 1 : 0; my $skipscale_for_shutdown_level = lc($nut->{skipscale_for_shutdown_level} || "") eq "y" ? 1 : 0; + my $alt_scaling_for_voltage = lc($nut->{alt_scaling_for_voltage} || "") eq "y" ? 1 : 0; + my $alt_scaling_for_timeleft = lc($nut->{alt_scaling_for_timeleft} || "") eq "y" ? 1 : 0; + my $alt_scaling_for_battery_voltage = lc($nut->{alt_scaling_for_battery_voltage} || "") eq "y" ? 1 : 0; # text mode # @@ -514,6 +527,7 @@ sub nut_cgi { "--vertical-label=Volts", "--width=$width", "--height=$height", + altscaling_options($alt_scaling_for_voltage), @extra, @riglim, $zoom, @@ -541,6 +555,7 @@ sub nut_cgi { "--width=$width", "--height=$height", @full_size_mode, + altscaling_options($alt_scaling_for_voltage), @extra, @riglim, $zoom, @@ -817,6 +832,7 @@ sub nut_cgi { "--vertical-label=Volts", "--width=$width", "--height=$height", + altscaling_options($alt_scaling_for_battery_voltage), @extra, @riglim, $zoom, @@ -840,6 +856,7 @@ sub nut_cgi { "--width=$width", "--height=$height", @full_size_mode, + altscaling_options($alt_scaling_for_battery_voltage), @extra, @riglim, $zoom, @@ -906,6 +923,7 @@ sub nut_cgi { "--vertical-label=Minutes", "--width=$width", "--height=$height", + altscaling_options($alt_scaling_for_timeleft), @extra, @riglim, $zoom, @@ -930,6 +948,7 @@ sub nut_cgi { "--vertical-label=Minutes", "--width=$width", "--height=$height", + altscaling_options($alt_scaling_for_timeleft), @full_size_mode, @extra, @riglim, diff --git a/man/man5/monitorix.conf.5 b/man/man5/monitorix.conf.5 index ceabd80..2e24c23 100644 --- a/man/man5/monitorix.conf.5 +++ b/man/man5/monitorix.conf.5 @@ -4234,6 +4234,27 @@ This option, when enabled via \fIy\fP, ignores the shutdown level graph when sca .P Default value: \fIn\fP .RE +.P +.BI alt_scaling_for_voltage +.RS +This option, when enabled via \fIy\fP, sets alternate plot axis scaling for the voltage graph. This can be useful to improve the scaling in some cases. +.P +Default value: \fIn\fP +.RE +.P +.BI alt_scaling_for_timeleft +.RS +This option, when enabled via \fIy\fP, sets alternate plot axis scaling for the time left graph. This can be useful to improve the scaling in some cases. +.P +Default value: \fIn\fP +.RE +.P +.BI alt_scaling_for_battery_voltage +.RS +This option, when enabled via \fIy\fP, sets alternate plot axis scaling for the battery voltage graph. This can be useful to improve the scaling in some cases. +.P +Default value: \fIn\fP +.RE .SS Wowza Media Server (wowza.pm) This graph is able to monitor an unlimited number of Wowza servers. .P