mirror of https://github.com/mikaku/Monitorix.git
added a complete graph for generic sensors (in /sys/devices). #159
This commit is contained in:
parent
7997ca5f95
commit
eb20c7d077
1
Changes
1
Changes
|
@ -2,6 +2,7 @@ N.N.N - DD-MMM-2015
|
|||
====================
|
||||
- Added a complete graph for Linux Traffic Control with the 'tc' command. [#74]
|
||||
- Added a complete graph for Chrony using the 'chronyc' command.
|
||||
- Added a complete graph for generic sensors (in /sys/devices). [#159]
|
||||
- Added the option 'cmd' in 'libvirt.pm' in order to be able to execute a
|
||||
custom command like 'virsh -r -c qemu:///session'.
|
||||
(suggested by Pavel Bauer, pbauer AT algotech.cz)
|
||||
|
|
|
@ -0,0 +1,553 @@
|
|||
#
|
||||
# Monitorix - A lightweight system monitoring tool.
|
||||
#
|
||||
# Copyright (C) 2005-2016 by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
package gensens;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Monitorix;
|
||||
use RRDs;
|
||||
use POSIX qw(strftime);
|
||||
use Exporter 'import';
|
||||
our @EXPORT = qw(gensens_init gensens_update gensens_cgi);
|
||||
|
||||
sub gensens_init {
|
||||
my $myself = (caller(0))[3];
|
||||
my ($package, $config, $debug) = @_;
|
||||
my $rrd = $config->{base_lib} . $package . ".rrd";
|
||||
my $gensens = $config->{gensens};
|
||||
|
||||
my $info;
|
||||
my @rra;
|
||||
my @tmp;
|
||||
my $n;
|
||||
|
||||
my @average;
|
||||
my @min;
|
||||
my @max;
|
||||
my @last;
|
||||
|
||||
if(-e $rrd) {
|
||||
$info = RRDs::info($rrd);
|
||||
for my $key (keys %$info) {
|
||||
if(index($key, 'rra[') == 0) {
|
||||
if(index($key, '.rows') != -1) {
|
||||
push(@rra, substr($key, 4, index($key, ']') - 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(scalar(@rra) < 12 + (4 * $config->{max_historic_years})) {
|
||||
logger("$myself: Detected size mismatch between 'max_historic_years' (" . $config->{max_historic_years} . ") and $rrd (" . ((scalar(@rra) -12) / 4) . "). Resizing it accordingly. All historical data will be lost. Backup file created.");
|
||||
rename($rrd, "$rrd.bak");
|
||||
}
|
||||
}
|
||||
|
||||
if(!(-e $rrd)) {
|
||||
logger("Creating '$rrd' file.");
|
||||
for($n = 1; $n <= $config->{max_historic_years}; $n++) {
|
||||
push(@average, "RRA:AVERAGE:0.5:1440:" . (365 * $n));
|
||||
push(@min, "RRA:MIN:0.5:1440:" . (365 * $n));
|
||||
push(@max, "RRA:MAX:0.5:1440:" . (365 * $n));
|
||||
push(@last, "RRA:LAST:0.5:1440:" . (365 * $n));
|
||||
}
|
||||
eval {
|
||||
RRDs::create($rrd,
|
||||
"--step=60",
|
||||
"DS:gensens0_s1:GAUGE:120:U:U",
|
||||
"DS:gensens0_s2:GAUGE:120:U:U",
|
||||
"DS:gensens0_s3:GAUGE:120:U:U",
|
||||
"DS:gensens0_s4:GAUGE:120:U:U",
|
||||
"DS:gensens0_s5:GAUGE:120:U:U",
|
||||
"DS:gensens0_s6:GAUGE:120:U:U",
|
||||
"DS:gensens0_s7:GAUGE:120:U:U",
|
||||
"DS:gensens0_s8:GAUGE:120:U:U",
|
||||
"DS:gensens0_s9:GAUGE:120:U:U",
|
||||
"DS:gensens1_s1:GAUGE:120:U:U",
|
||||
"DS:gensens1_s2:GAUGE:120:U:U",
|
||||
"DS:gensens1_s3:GAUGE:120:U:U",
|
||||
"DS:gensens1_s4:GAUGE:120:U:U",
|
||||
"DS:gensens1_s5:GAUGE:120:U:U",
|
||||
"DS:gensens1_s6:GAUGE:120:U:U",
|
||||
"DS:gensens1_s7:GAUGE:120:U:U",
|
||||
"DS:gensens1_s8:GAUGE:120:U:U",
|
||||
"DS:gensens1_s9:GAUGE:120:U:U",
|
||||
"RRA:AVERAGE:0.5:1:1440",
|
||||
"RRA:AVERAGE:0.5:30:336",
|
||||
"RRA:AVERAGE:0.5:60:744",
|
||||
@average,
|
||||
"RRA:MIN:0.5:1:1440",
|
||||
"RRA:MIN:0.5:30:336",
|
||||
"RRA:MIN:0.5:60:744",
|
||||
@min,
|
||||
"RRA:MAX:0.5:1:1440",
|
||||
"RRA:MAX:0.5:30:336",
|
||||
"RRA:MAX:0.5:60:744",
|
||||
@max,
|
||||
"RRA:LAST:0.5:1:1440",
|
||||
"RRA:LAST:0.5:30:336",
|
||||
"RRA:LAST:0.5:60:744",
|
||||
@last,
|
||||
);
|
||||
};
|
||||
my $err = RRDs::error;
|
||||
if($@ || $err) {
|
||||
logger("$@") unless !$@;
|
||||
if($err) {
|
||||
logger("ERROR: while creating $rrd: $err");
|
||||
if($err eq "RRDs::error") {
|
||||
logger("... is the RRDtool Perl package installed?");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
push(@{$config->{func_update}}, $package);
|
||||
logger("$myself: Ok") if $debug;
|
||||
}
|
||||
|
||||
sub gensens_update {
|
||||
my $myself = (caller(0))[3];
|
||||
my ($package, $config, $debug) = @_;
|
||||
my $rrd = $config->{base_lib} . $package . ".rrd";
|
||||
my $gensens = $config->{gensens};
|
||||
|
||||
my $n;
|
||||
my $rrdata = "N";
|
||||
|
||||
foreach my $sg (sort keys %{$gensens->{list}}) {
|
||||
my @ls = split(',', $gensens->{list}->{$sg});
|
||||
for($n = 0; $n < 9; $n++) {
|
||||
my $val;
|
||||
my $str;
|
||||
|
||||
$val = 0;
|
||||
$str = trim($ls[$n] || "");
|
||||
if($gensens->{desc}->{$str}) {
|
||||
if(open(IN, $gensens->{desc}->{$str})) {
|
||||
my $unit;
|
||||
|
||||
$val = <IN>;
|
||||
$val = trim($val);
|
||||
$unit = $gensens->{unit}->{$str} || 0;
|
||||
$val /= $unit if $unit > 1;
|
||||
$val *= $unit if $unit > 0 && $unit < 1;
|
||||
close(IN);
|
||||
} else {
|
||||
logger("$myself: ERROR: unable to open '$gensens->{desc}->{$str}'.");
|
||||
}
|
||||
}
|
||||
$rrdata .= ":$val";
|
||||
}
|
||||
}
|
||||
|
||||
RRDs::update($rrd, $rrdata);
|
||||
logger("$myself: $rrdata") if $debug;
|
||||
my $err = RRDs::error;
|
||||
logger("ERROR: while updating $rrd: $err") if $err;
|
||||
}
|
||||
|
||||
sub gensens_cgi {
|
||||
my ($package, $config, $cgi) = @_;
|
||||
|
||||
my $gensens = $config->{gensens};
|
||||
my @rigid = split(',', ($gensens->{rigid} || ""));
|
||||
my @limit = split(',', ($gensens->{limit} || ""));
|
||||
my $tf = $cgi->{tf};
|
||||
my $colors = $cgi->{colors};
|
||||
my $graph = $cgi->{graph};
|
||||
my $silent = $cgi->{silent};
|
||||
my $zoom = "--zoom=" . $config->{global_zoom};
|
||||
my %rrd = (
|
||||
'new' => \&RRDs::graphv,
|
||||
'old' => \&RRDs::graph,
|
||||
);
|
||||
my $version = "new";
|
||||
my $pic;
|
||||
my $picz;
|
||||
my $picz_width;
|
||||
my $picz_height;
|
||||
|
||||
my $u = "";
|
||||
my $width;
|
||||
my $height;
|
||||
my @riglim;
|
||||
my $temp_scale = "Celsius";
|
||||
my @IMG;
|
||||
my @IMGz;
|
||||
my @tmp;
|
||||
my @tmpz;
|
||||
my @CDEF;
|
||||
my $n;
|
||||
my $n2;
|
||||
my $str;
|
||||
my $err;
|
||||
my @LC = (
|
||||
"#4444EE",
|
||||
"#EEEE44",
|
||||
"#44EEEE",
|
||||
"#EE44EE",
|
||||
"#888888",
|
||||
"#E29136",
|
||||
"#44EE44",
|
||||
"#448844",
|
||||
"#EE4444",
|
||||
);
|
||||
|
||||
$version = "old" if $RRDs::VERSION < 1.3;
|
||||
my $rrd = $config->{base_lib} . $package . ".rrd";
|
||||
my $title = $config->{graph_title}->{$package};
|
||||
my $IMG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
|
||||
my $imgfmt_uc = uc($config->{image_format});
|
||||
my $imgfmt_lc = lc($config->{image_format});
|
||||
|
||||
$title = !$silent ? $title : "";
|
||||
|
||||
if(lc($config->{temperature_scale}) eq "f") {
|
||||
$temp_scale = "Fahrenheit";
|
||||
}
|
||||
|
||||
# text mode
|
||||
#
|
||||
if(lc($config->{iface_mode}) eq "text") {
|
||||
if($title) {
|
||||
main::graph_header($title, 2);
|
||||
print(" <tr>\n");
|
||||
print(" <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
}
|
||||
my (undef, undef, undef, $data) = RRDs::fetch("$rrd",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"AVERAGE",
|
||||
"-r $tf->{res}");
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while fetching $rrd: $err\n") if $err;
|
||||
my $line1;
|
||||
my $line2;
|
||||
my $line3;
|
||||
print(" <pre style='font-size: 12px; color: $colors->{fg_color}';>\n");
|
||||
print(" ");
|
||||
for($n = 0; $n < 2; $n++) {
|
||||
$line1 = "";
|
||||
foreach my $i (split(',', $gensens->{list}->{$n})) {
|
||||
$i = trim($i);
|
||||
$str = $i;
|
||||
$str = sprintf("%10s", substr($str, 0, 10));
|
||||
$line1 .= " ";
|
||||
$line2 .= sprintf(" %10s", $str);
|
||||
$line3 .= "-----------";
|
||||
}
|
||||
if($line1) {
|
||||
my $i = length($line1);
|
||||
$str = "_gensens" . ($n + 1);
|
||||
printf(sprintf("%${i}s", sprintf("%s", trim($config->{graphs}->{$str}))));
|
||||
}
|
||||
}
|
||||
print("\n");
|
||||
print("Time$line2\n");
|
||||
print("----$line3 \n");
|
||||
my $line;
|
||||
my @row;
|
||||
my $time;
|
||||
my $n2;
|
||||
my $n3;
|
||||
my $from;
|
||||
my $to;
|
||||
for($n = 0, $time = $tf->{tb}; $n < ($tf->{tb} * $tf->{ts}); $n++) {
|
||||
$line = @$data[$n];
|
||||
$time = $time - (1 / $tf->{ts});
|
||||
printf(" %2d$tf->{tc} ", $time);
|
||||
for($n2 = 0; $n2 < 2; $n2++) {
|
||||
$n3 = 0;
|
||||
foreach my $i (split(',', $gensens->{list}->{$n2})) {
|
||||
$from = $n2 * 9 + $n3++;
|
||||
$to = $from + 1;
|
||||
my ($j) = @$line[$from..$to];
|
||||
@row = ($j);
|
||||
printf("%10d ", @row);
|
||||
}
|
||||
}
|
||||
print("\n");
|
||||
}
|
||||
print(" </pre>\n");
|
||||
if($title) {
|
||||
print(" </td>\n");
|
||||
print(" </tr>\n");
|
||||
main::graph_footer();
|
||||
}
|
||||
print(" <br>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# graph mode
|
||||
#
|
||||
if($silent eq "yes" || $silent eq "imagetag") {
|
||||
$colors->{fg_color} = "#000000"; # visible color for text mode
|
||||
$u = "_";
|
||||
}
|
||||
if($silent eq "imagetagbig") {
|
||||
$colors->{fg_color} = "#000000"; # visible color for text mode
|
||||
$u = "";
|
||||
}
|
||||
|
||||
for($n = 0; $n < keys(%{$gensens->{list}}); $n++) {
|
||||
$str = $u . $package . $n . "." . $tf->{when} . ".$imgfmt_lc";
|
||||
push(@IMG, $str);
|
||||
unlink("$IMG_DIR" . $str);
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
$str = $u . $package . $n . "z." . $tf->{when} . ".$imgfmt_lc";
|
||||
push(@IMGz, $str);
|
||||
unlink("$IMG_DIR" . $str);
|
||||
}
|
||||
}
|
||||
|
||||
my (@ls, $max, @sg);
|
||||
|
||||
$max = max(scalar(@sg = split(',', $gensens->{list}->{0}), @sg = split(',', $gensens->{list}->{1})));
|
||||
|
||||
# Temperatures
|
||||
if($title) {
|
||||
main::graph_header($title, 2);
|
||||
print(" <tr>\n");
|
||||
}
|
||||
|
||||
@riglim = @{setup_riglim($rigid[0], $limit[0])};
|
||||
undef(@tmp);
|
||||
undef(@tmpz);
|
||||
undef(@CDEF);
|
||||
@ls = split(',', $gensens->{list}->{0});
|
||||
for($n = 0; $n < 9; $n++) {
|
||||
my $str = trim($ls[$n] || "");
|
||||
if($str) {
|
||||
$str = $gensens->{map}->{$str} ? $gensens->{map}->{$str} : $str;
|
||||
$str = sprintf("%-20s", substr($str, 0, 20));
|
||||
push(@tmp, "LINE2:gsen" . $n . $LC[$n] . ":$str");
|
||||
push(@tmp, "GPRINT:gsen" . $n . ":LAST: Cur\\:%5.1lf%s");
|
||||
push(@tmp, "GPRINT:gsen" . $n . ":MIN: Min\\:%5.1lf%s");
|
||||
push(@tmp, "GPRINT:gsen" . $n . ":MAX: Max\\:%5.1lf%s\\n");
|
||||
push(@tmpz, "LINE2:gsen" . $n . $LC[$n] . ":$str");
|
||||
next;
|
||||
}
|
||||
last;
|
||||
}
|
||||
while($n < $max) {
|
||||
push(@tmp, "COMMENT: \\n");
|
||||
$n++;
|
||||
}
|
||||
if($title) {
|
||||
print(" <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
}
|
||||
if(lc($config->{show_gaps}) eq "y") {
|
||||
push(@tmp, "AREA:wrongdata#$colors->{gap}:");
|
||||
push(@tmpz, "AREA:wrongdata#$colors->{gap}:");
|
||||
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
|
||||
}
|
||||
($width, $height) = split('x', $config->{graph_size}->{medium});
|
||||
$pic = $rrd{$version}->("$IMG_DIR" . "$IMG[0]",
|
||||
"--title=$config->{graphs}->{_gensens1} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=$imgfmt_uc",
|
||||
"--vertical-label=$temp_scale",
|
||||
"--width=$width",
|
||||
"--height=$height",
|
||||
@riglim,
|
||||
$zoom,
|
||||
@{$cgi->{version12}},
|
||||
@{$cgi->{version12_small}},
|
||||
@{$colors->{graph_colors}},
|
||||
"DEF:gsen0=$rrd:gensens0_s1:AVERAGE",
|
||||
"DEF:gsen1=$rrd:gensens0_s2:AVERAGE",
|
||||
"DEF:gsen2=$rrd:gensens0_s3:AVERAGE",
|
||||
"DEF:gsen3=$rrd:gensens0_s4:AVERAGE",
|
||||
"DEF:gsen4=$rrd:gensens0_s5:AVERAGE",
|
||||
"DEF:gsen5=$rrd:gensens0_s6:AVERAGE",
|
||||
"DEF:gsen6=$rrd:gensens0_s7:AVERAGE",
|
||||
"DEF:gsen7=$rrd:gensens0_s8:AVERAGE",
|
||||
"DEF:gsen8=$rrd:gensens0_s9:AVERAGE",
|
||||
@CDEF,
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[0]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[0]",
|
||||
"--title=$config->{graphs}->{_gensens1} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=$imgfmt_uc",
|
||||
"--vertical-label=$temp_scale",
|
||||
"--width=$width",
|
||||
"--height=$height",
|
||||
@riglim,
|
||||
$zoom,
|
||||
@{$cgi->{version12}},
|
||||
@{$cgi->{version12_small}},
|
||||
@{$colors->{graph_colors}},
|
||||
"DEF:gsen0=$rrd:gensens0_s1:AVERAGE",
|
||||
"DEF:gsen1=$rrd:gensens0_s2:AVERAGE",
|
||||
"DEF:gsen2=$rrd:gensens0_s3:AVERAGE",
|
||||
"DEF:gsen3=$rrd:gensens0_s4:AVERAGE",
|
||||
"DEF:gsen4=$rrd:gensens0_s5:AVERAGE",
|
||||
"DEF:gsen5=$rrd:gensens0_s6:AVERAGE",
|
||||
"DEF:gsen6=$rrd:gensens0_s7:AVERAGE",
|
||||
"DEF:gsen7=$rrd:gensens0_s8:AVERAGE",
|
||||
"DEF:gsen8=$rrd:gensens0_s9:AVERAGE",
|
||||
@CDEF,
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[0]: $err\n") if $err;
|
||||
}
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /gensens0/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[0] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[0] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
$picz_height = $picz->{image_height} * $config->{global_zoom};
|
||||
} else {
|
||||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[0] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[0] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[0] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
if($title) {
|
||||
print(" </td>\n");
|
||||
}
|
||||
|
||||
# CPU frequency
|
||||
@riglim = @{setup_riglim($rigid[1], $limit[1])};
|
||||
undef(@tmp);
|
||||
undef(@tmpz);
|
||||
undef(@CDEF);
|
||||
@ls = split(',', $gensens->{list}->{1});
|
||||
for($n = 0; $n < 9; $n++) {
|
||||
my $str = trim($ls[$n] || "");
|
||||
if($str) {
|
||||
$str = $gensens->{map}->{$str} ? $gensens->{map}->{$str} : $str;
|
||||
$str = sprintf("%-20s", substr($str, 0, 20));
|
||||
push(@tmp, "LINE2:gsen" . $n . $LC[$n] . ":$str");
|
||||
push(@tmp, "GPRINT:gsen" . $n . ":LAST: Cur\\:%4.0lf%s");
|
||||
push(@tmp, "GPRINT:gsen" . $n . ":MIN: Min\\:%4.0lf%s");
|
||||
push(@tmp, "GPRINT:gsen" . $n . ":MAX: Max\\:%4.0lf%s\\n");
|
||||
push(@tmpz, "LINE2:gsen" . $n . $LC[$n] . ":$str");
|
||||
next;
|
||||
}
|
||||
last;
|
||||
}
|
||||
while($n < $max) {
|
||||
push(@tmp, "COMMENT: \\n");
|
||||
$n++;
|
||||
}
|
||||
if($title) {
|
||||
print(" <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
}
|
||||
if(lc($config->{show_gaps}) eq "y") {
|
||||
push(@tmp, "AREA:wrongdata#$colors->{gap}:");
|
||||
push(@tmpz, "AREA:wrongdata#$colors->{gap}:");
|
||||
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
|
||||
}
|
||||
($width, $height) = split('x', $config->{graph_size}->{medium});
|
||||
$pic = $rrd{$version}->("$IMG_DIR" . "$IMG[1]",
|
||||
"--title=$config->{graphs}->{_gensens2} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=$imgfmt_uc",
|
||||
"--vertical-label=Hz",
|
||||
"--width=$width",
|
||||
"--height=$height",
|
||||
@riglim,
|
||||
$zoom,
|
||||
@{$cgi->{version12}},
|
||||
@{$cgi->{version12_small}},
|
||||
@{$colors->{graph_colors}},
|
||||
"DEF:gsen0=$rrd:gensens1_s1:AVERAGE",
|
||||
"DEF:gsen1=$rrd:gensens1_s2:AVERAGE",
|
||||
"DEF:gsen2=$rrd:gensens1_s3:AVERAGE",
|
||||
"DEF:gsen3=$rrd:gensens1_s4:AVERAGE",
|
||||
"DEF:gsen4=$rrd:gensens1_s5:AVERAGE",
|
||||
"DEF:gsen5=$rrd:gensens1_s6:AVERAGE",
|
||||
"DEF:gsen6=$rrd:gensens1_s7:AVERAGE",
|
||||
"DEF:gsen7=$rrd:gensens1_s8:AVERAGE",
|
||||
"DEF:gsen8=$rrd:gensens1_s9:AVERAGE",
|
||||
@CDEF,
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[1]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[1]",
|
||||
"--title=$config->{graphs}->{_gensens2} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=$imgfmt_uc",
|
||||
"--vertical-label=Hz",
|
||||
"--width=$width",
|
||||
"--height=$height",
|
||||
@riglim,
|
||||
$zoom,
|
||||
@{$cgi->{version12}},
|
||||
@{$cgi->{version12_small}},
|
||||
@{$colors->{graph_colors}},
|
||||
"DEF:gsen0=$rrd:gensens1_s1:AVERAGE",
|
||||
"DEF:gsen1=$rrd:gensens1_s2:AVERAGE",
|
||||
"DEF:gsen2=$rrd:gensens1_s3:AVERAGE",
|
||||
"DEF:gsen3=$rrd:gensens1_s4:AVERAGE",
|
||||
"DEF:gsen4=$rrd:gensens1_s5:AVERAGE",
|
||||
"DEF:gsen5=$rrd:gensens1_s6:AVERAGE",
|
||||
"DEF:gsen6=$rrd:gensens1_s7:AVERAGE",
|
||||
"DEF:gsen7=$rrd:gensens1_s8:AVERAGE",
|
||||
"DEF:gsen8=$rrd:gensens1_s9:AVERAGE",
|
||||
@CDEF,
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[1]: $err\n") if $err;
|
||||
}
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /gensens1/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[1] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[1] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
$picz_height = $picz->{image_height} * $config->{global_zoom};
|
||||
} else {
|
||||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[1] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[1] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[1] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
if($title) {
|
||||
print(" </td>\n");
|
||||
print(" </tr>\n");
|
||||
main::graph_footer();
|
||||
}
|
||||
print(" <br>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,9 +1,9 @@
|
|||
.\" Monitorix manpage.
|
||||
.\" Copyright (C) 2005-2015 by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
.\" Copyright (C) 2005-2016 by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
.\"
|
||||
.\" This is the man page for the monitorix.conf configuration file.
|
||||
.\"
|
||||
.TH monitorix.conf 5 "Sep 2015" 3.8.0 "Monitorix configuration file"
|
||||
.TH monitorix.conf 5 "Oct 2016" 3.9.0 "Monitorix configuration file"
|
||||
.SH NAME
|
||||
monitorix.conf \- Configuration file for Monitorix.
|
||||
.SH DESCRIPTION
|
||||
|
@ -783,7 +783,86 @@ This list complements the \fBlist\fP option only for the graphs: MB and CPU temp
|
|||
</desc>
|
||||
.RE
|
||||
.P
|
||||
Please note that in the default graph all names are limited to 5 characters, in order to fit up to 9 different values. In the zoomed graphs the limit is 8 characters.
|
||||
Please note that in the default graph all names are limited to 5 characters in order to fit up to 9 different values. In the zoomed graphs the limit is 8 characters.
|
||||
.SS Generic sensors statistics (gensens.rrd)
|
||||
This graph is able to monitor up to 9 temperatures and CPU frequencies which, depending of your machine, should appear in the \fI/sys/devices\fP directory.
|
||||
.P
|
||||
.BI list
|
||||
.RS
|
||||
This is a fixed list that can only hold two keys (0 and 1). Each key though can hold up to 9 different entries separated by comma which corresponds to the names of the sensors present in your computer. The key 0 is only for temperature sensors and the key 1 is for CPU frequencies. All this is hard-coded and a bit rigid currently but it might change in the future.
|
||||
.P
|
||||
An example would be:
|
||||
.P
|
||||
.RS
|
||||
<list>
|
||||
.br
|
||||
0 = temp0, temp1
|
||||
.br
|
||||
1 = cpu0, cpu1, cpu2, cpu3
|
||||
.br
|
||||
</list>
|
||||
.RE
|
||||
.RE
|
||||
.BI desc
|
||||
.RS
|
||||
In this option you must associate the complete pathname of the file from where to get the value of each entry defined in the \fIBlist\fP. Following the settings in the example above:
|
||||
.P
|
||||
.RS
|
||||
<desc>
|
||||
.br
|
||||
temp0 = /sys/devices/virtual/thermal/thermal_zone0/temp
|
||||
.br
|
||||
temp1 = /sys/devices/virtual/thermal/thermal_zone1/temp
|
||||
.br
|
||||
cpu0 = /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
|
||||
.br
|
||||
cpu1 = /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq
|
||||
.br
|
||||
cpu2 = /sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq
|
||||
.br
|
||||
cpu3 = /sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq
|
||||
.br
|
||||
</desc>
|
||||
.RE
|
||||
.RE
|
||||
.BI unit
|
||||
.RS
|
||||
With this option you can define the order of magnitude associated to a specific value. This is normally used only in temperatures because these sensors tend to give the value in 1000ths of degrees Celsius. Therefore you can define something like this:
|
||||
.P
|
||||
.RS
|
||||
<unit>
|
||||
.br
|
||||
temp0 = 1000
|
||||
.br
|
||||
temp1 = 1000
|
||||
.br
|
||||
</unit>
|
||||
.RE
|
||||
.RE
|
||||
.BI map
|
||||
.RS
|
||||
With this option you can optionally rename any of the sensor names defined in the \fBlist\fP option. Following the above example:
|
||||
.P
|
||||
.RS
|
||||
<map>
|
||||
.br
|
||||
temp0 = Temperature Zone 0
|
||||
.br
|
||||
temp1 = Temperature Zone 1
|
||||
.br
|
||||
cpu0 = CPU0 frequency
|
||||
.br
|
||||
cpu1 = CPU1 frequency
|
||||
.br
|
||||
cpu2 = CPU2 frequency
|
||||
.br
|
||||
cpu3 = CPU3 frequency
|
||||
.br
|
||||
</map>
|
||||
.RE
|
||||
.P
|
||||
All the names are limited to 20 characters.
|
||||
.RE
|
||||
.SS NVIDIA temperatures and usage (nvidia.rrd)
|
||||
This graph requires to have installed the official NVIDIA drivers.
|
||||
.P
|
||||
|
@ -2500,7 +2579,7 @@ This is where you can enter the upper-limit and lower-limit values (separated by
|
|||
.SH AUTHOR
|
||||
Monitorix is written by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2005-2015 Jordi Sanfeliu
|
||||
Copyright \(co 2005-2016 Jordi Sanfeliu
|
||||
.br
|
||||
Licensed under the GNU General Public License version 2 (GPLv2).
|
||||
.SH SEE ALSO
|
||||
|
|
|
@ -77,6 +77,7 @@ secure_log_date_format = %b %e
|
|||
proc = y
|
||||
hptemp = n
|
||||
lmsens = n
|
||||
gensens = n
|
||||
nvidia = n
|
||||
disk = n
|
||||
fs = y
|
||||
|
@ -197,6 +198,29 @@ secure_log_date_format = %b %e
|
|||
</lmsens>
|
||||
|
||||
|
||||
# GENSENS graph
|
||||
# -----------------------------------------------------------------------------
|
||||
<gensens>
|
||||
<list>
|
||||
0 = temp0
|
||||
1 = cpu0
|
||||
</list>
|
||||
<desc>
|
||||
temp0 = /sys/devices/virtual/thermal/thermal_zone0/temp
|
||||
cpu0 = /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
|
||||
</desc>
|
||||
<unit>
|
||||
temp0 = 1000
|
||||
</unit>
|
||||
<map>
|
||||
temp0 = Temperature Zone 0
|
||||
cpu0 = CPU0 frequency
|
||||
</map>
|
||||
rigid = 0, 0
|
||||
limit = 100, 100
|
||||
</gensens>
|
||||
|
||||
|
||||
# NVIDIA graph
|
||||
# -----------------------------------------------------------------------------
|
||||
<nvidia>
|
||||
|
@ -787,7 +811,7 @@ logo_bottom = logo_bot.png
|
|||
remote = 300x100
|
||||
</graph_size>
|
||||
|
||||
graph_name = system, kern, proc, hptemp, lmsens, nvidia, disk, fs, zfs, du, net, netstat, tc, libvirt, process, serv, mail, port, user, ftp, apache, nginx, lighttpd, mysql, varnish, pagespeed, squid, nfss, nfsc, bind, ntp, chrony, fail2ban, icecast, raspberrypi, phpapc, memcached, apcupsd, nut, wowza, int, verlihub
|
||||
graph_name = system, kern, proc, hptemp, lmsens, gensens, nvidia, disk, fs, zfs, du, net, netstat, tc, libvirt, process, serv, mail, port, user, ftp, apache, nginx, lighttpd, mysql, varnish, pagespeed, squid, nfss, nfsc, bind, ntp, chrony, fail2ban, icecast, raspberrypi, phpapc, memcached, apcupsd, nut, wowza, int, verlihub
|
||||
|
||||
<graph_title>
|
||||
system = System load average and usage
|
||||
|
@ -795,6 +819,7 @@ graph_name = system, kern, proc, hptemp, lmsens, nvidia, disk, fs, zfs, du, net,
|
|||
proc = Kernel usage per processor
|
||||
hptemp = HP ProLiant System Health
|
||||
lmsens = LM-Sensors and GPU temperatures
|
||||
gensens = Generic sensor statistics
|
||||
nvidia = NVIDIA temperatures and usage
|
||||
disk = Disk drive temperatures and health
|
||||
fs = Filesystem usage and I/O activity
|
||||
|
@ -850,6 +875,8 @@ graph_name = system, kern, proc, hptemp, lmsens, nvidia, disk, fs, zfs, du, net,
|
|||
_lmsens3 = MB and CPU temperatures
|
||||
_lmsens4 = Fan speeds
|
||||
_lmsens5 = GPU temperatures
|
||||
_gensens1 = Temperatures
|
||||
_gensens2 = CPU frequency
|
||||
_nvidia1 = NVIDIA temperatures
|
||||
_nvidia2 = CPU usage
|
||||
_nvidia3 = Memory usage
|
||||
|
|
Loading…
Reference in New Issue