change: end of support for barcharts

fix: html

git-svn-id: https://svn.fhem.de/fhem/trunk@10353 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
hexenmeister 2016-01-03 20:19:23 +00:00
parent 274f46609c
commit 60b505f7f6

View File

@ -4154,544 +4154,6 @@ sub SYSMON_Log($$$) {
Log3 $hash, $loglevel, "SYSMON $instName: $sub.$xline " . $text;
}
#sub trim($)
#{
# my $string = shift;
# $string =~ s/^\s+//;
# $string =~ s/\s+$//;
# return $string;
#}
# --- SNX ---------------------------------------------------------------------
# SYSMON_ShowBarChartHtml(<device>,<options>);
# device: name of the linked sysmon instance
# options: perl hash { key=>value, key=>value, .. } containing options. possible keys are:
# - bars: comma separated list of bars to show. possible bars are:
# - us: uptime system
# - uf: uptime fhem
# - cf[|<core>]: cpu frequency - <core> is the target cpu core number [0..n]
# - cl[|<core>]: cpu load - <core> is the target cpu core number [0..n]
# - ct: cpu temperature
# - mr: memory ram
# - ms: memory swap
# - fs|<name> file system - <name> is the target reading name
# the default value (if you do not provide bars option) is: us,uf,cl,ct,cf,mr,ms,fs:fs_root
# a bar won't displayed if the appropriate reading doesn't exist (e.g. cpu_freq @ fritzbox) or is empty (e.g. cpu_temp @ fritz box), even if you defined the bar to show.
# - title_<bar>: bar title. if you use a bar in the bars option, but do not provide a title the default title will be displayed. possible bar names and their default title are:
# - us: uptime
# - uf: uptime fhem
# - cf: cpu% freq
# - cl: cpu% load
# - ct: cpu temp
# - mr: mem ram
# - ms: mem swap
# - fs: fs %
# - fsx: {fs_root=>"fs root"}
# - cfx:
# - clx:
# you can use the variable % within:
# - cf,cl: % will be replaced by the cpu core number
# - fs: % will be replaced by the reading name
# using bar names ending with x you can provide title for specific bars (e.g. cpu1, cpu2, fs_root, fs_boot).
# it has to be a perl hash too, where key is depending of the type:
# - fsx: name of the filesystem reading (e.g. fs_root, fs_boot)
# - cfx: cpu core number
# - clx: cpu core number
# - ctx: cpu core number
# if you provide a title for a specific bar (e.g title_cfx=>{1=>"cpu1 freq"}), this will be prefered and 'override' the general title (e.g. title_cf=>"cpu freq")
# - stat: display of statistic data [min, max, avg]. possible values:
# - 0: no statistic data
# - 1: colored ranges (min to avg, avg to max) as bar overlay, hover-info for pc, click-info for tablet/mobile
# - weblink: name of a weblink instance. if you use this method inside a weblink you can provide the name if the weblink instance. due to that the title will appear as a link targeting the weblink instance detail page.
# - title: the title of the chart. the default title is the name of the linked sysmon instance. if you supplied the weblink option this will be the default title.
# supply empty value to prevent title output.
# - color<type>: html/css color definition. possible type names and their default colors are:
# - Border: bar border (black)
# - Fill: bar content (tan)
# - Text: bar text (empty -> css style default)
# - Stat: statistic data [min, max, avg] indicatator (=border -> if you change border, this will changed as well)
# - MinAvg: statistic data range1 - min to avg
# - AvgMax: staristic data range2 - avg to max
# color can be any html/css color definition:
# - name: red
# - hex: #ff0000
# - rgb: rgb(255,0,0)
# rgba(255,0,0,.5)
#
# example usage inside a weblink instance:
# - no customization..
# define wlRasPi1 weblink htmlCode {SYSMON_ShowBarChartHtml("sysRaspi")}
# - define which bars to show (cpu load, cpu temperature and filesystem fs_root)..
# define wlRasPi2 weblink htmlCode {SYSMON_ShowBarChartHtml("sysRaspi",{bars=>"cl,ct,fs|fs_root"})}
# - show bars for each cpu core (in this case we've got 4 cores)..
# define wlRasPi3 weblink htmlCode {SYSMON_ShowBarChartHtml("sysRaspi",{bars=>"ct,cl,cl|0,cl|1,cl|2,cl|3"})}
# - customize bar titles (cpu load => CPULoad, uptime system => System Uptime, common filesystem FileSystem <readingName> and the specific root filesystem (reading fs_root) => Root)..
# define wlRasPi4 weblink htmlCode {SYSMON_ShowBarChartHtml("sysRaspi",{title_cl=>"CPULoad",title_us=>"System Uptime",title_fs=>"FileSystem %",title_fs2=>{fs_root=>"Root"}})}
# - customize colors (bar will be filled red, the text will be white)
# define wlRasPi5 weblink htmlCode {SYSMON_ShowBarChartHtml("sysRaspi",{colorFill=>"red",colorText=>"#fff"})}
# - let the chart title become a link to the weblink instance
# define wlRasPi6 weblink htmlCode {SYSMON_ShowBarChartHtml("sysRaspi",{weblink=>"wlRasPi6"})}
# - customize chart title
# define wlRasPi7 weblink htmlCode {SYSMON_ShowBarChartHtml("sysRaspi",{title=>"This is my Chart"})}
# - disable statistical data
# define wlRasPi8 weblink htmlCode {SYSMON_ShowBarChartHtml("sysRaspi",{stat=>0})}
# - mix previous options
# define wlRasPi9 weblink htmlCode {SYSMON_ShowBarChartHtml("sysRaspi",{weblink=>"wlRasPi9", title=>"Rasperry Pi", stat=>0, bars=>"cl,ct,us,fs|fs_root,fs|fs_boot", title_cl=>"CPU load", title_ct=>"CPU temperature", title_fs=>"FileSystem %", title_fsx=>{fs_root=>"Root"}, colorBorder=>"blue", colorFill=>"lightgray" ,colorText=>"blue"})}
sub SYSMON_ShowBarChartHtml($;$) {
my ($dev,$opt) = @_;
# extend with default options..
$opt->{colorBorder} = $opt->{colorBorder} || 'black';
$opt->{colorFill} = $opt->{colorFill} || 'tan';
$opt->{colorText} = $opt->{colorText} || ''; # use font color by style..
$opt->{colorStat} = $opt->{colorStat} || $opt->{colorBorder};
$opt->{colorMinAvg} = $opt->{colorMinAvg} || 'lightsalmon';
$opt->{colorAvgMax} = $opt->{colorAvgMax} || 'lightgreen';
$opt->{title} = defined($opt->{title}) ? $opt->{title} : ( $opt->{weblink} || $dev );
$opt->{weblink} = $opt->{weblink} || '';
$opt->{bars} = $opt->{bars} || 'uf,us,cl,ct,cf,mr,ms,fs|fs_root';
$opt->{title_uf} = $opt->{title_uf} || 'uptime fhem';
$opt->{title_us} = $opt->{title_us} || 'uptime';
$opt->{title_ct} = $opt->{title_ct} || 'cpu temp';
$opt->{title_cf} = $opt->{title_cf} || 'cpu% freq';
$opt->{title_cl} = $opt->{title_cl} || 'cpu% load';
$opt->{title_mr} = $opt->{title_mr} || 'mem ram';
$opt->{title_ms} = $opt->{title_ms} || 'mem swap';
$opt->{title_fs} = $opt->{title_fs} || 'fs %';
$opt->{title_fsx} = $opt->{title_fsx} || {fs_root=>'fs root'};
$opt->{stat} = defined($opt->{stat}) ? $opt->{stat} : 1;
# bar string to array/hash..
$opt->{barList} = ();
foreach my $bar (split(/\s*,+\s*/,$opt->{bars})){
my ($type,$param) = split(/\|/,$bar);
#push(@{$opt->{barList}},{id=>Data::GUID->new->as_string,type=>$type,param=>$param},);
push(@{$opt->{barList}},{id=>time=~s/[^0-9]//gr,type=>$type,param=>$param},);
}
# html templates..
my $htmlTitleSimple = '<div><b>#TITLE#</b></div>';
my $htmlTitleWeblink = '<div><a href="?detail=#WEBLINK#"><b>#TITLE#</b></a></div>';
my $htmlRow = ''
. '<tr>'
. ' <td>#NAME#</td>'
. ' <td>#VALUE#</td>'
. '</tr>';
my $htmlBarSimple = ''
. '<div style="position:relative;min-width:200px;border:1px solid '.$opt->{colorBorder}.';cursor:default;">'
. ' <div style="overflow:hidden;">'
. ' <div style="height:1.5em;background:'.$opt->{colorFill}.';width:#CURP#%;"></div>'
. ' <div style="position:absolute;top:.2em;height:1.3em;width:100%;text-align:center;color:'.$opt->{colorText}.'">#CURT#</div>'
. ' </div>'
. '</div>';
my $htmlBarStat = ''
. '<div id="#ID#" onclick="tgl(this)" style="position:relative;min-width:200px;border:1px solid '.$opt->{colorBorder}.';cursor:default;">'
. ' <div id="#ID#Cur" style="overflow:hidden;transition:height .4s, opacity .4s;">'
. ' <div style="height:1.5em;background:'.$opt->{colorFill}.';width:#CURP#%;"></div>'
. ' <div style="position:absolute;top:.2em;height:1.3em;width:100%;text-align:center;color:'.$opt->{colorText}.'" title="min: #MINT# | avg: #AVGT# | max: #MAXT#">#CURT#</div>'
. ' <div style="position:absolute;top:0;height:.3em;background:'.$opt->{colorAvgMax}.';border-right:1px solid '.$opt->{colorStat}.';width:#MAXP#%;"></div>'
. ' <div style="position:absolute;top:0;height:.3em;background:'.$opt->{colorMinAvg}.';border-right:1px solid '.$opt->{colorStat}.';width:#AVGP#%;"></div>'
. ' <div style="position:absolute;top:0;height:.3em;background:'.$opt->{colorFill}.';border-right:1px solid '.$opt->{colorStat}.';width:#MINP#%;"></div>'
. ' </div>'
. ' <div id="#ID#MAM" style="height:0;opacity:0;overflow:hidden;transition:height .4s, opacity .4s;">'
. ' <div style="position:relative;">'
. ' <div style="height:.5em;background:tan;width:#MINP#%;"></div>'
. ' </div>'
. ' <div style="position:relative;">'
. ' <div style="height:.5em;background:tan;width:#AVGP#%;"></div>'
. ' </div>'
. ' <div style="position:relative;">'
. ' <div style="height:.5em;background:tan;width:#MAXP#%;"></div>'
. ' </div>'
. ' <div style="position:absolute;top:0;height:1.5em;width:100%;text-align:center;color:'.$opt->{colorText}.'" title="min: #MINT# | avg: #AVGT# | max: #MAXT#">#MINT# < #AVGT# < #MAXT#</div>'
. ' </div>'
. '</div>';
my $htmlScript .= ''
. '<script>'
. 'function tgl(o) {'
. ' var c=document.getElementById(o.id+"Cur");'
. ' var m=document.getElementById(o.id+"MAM");'
. ' var s,h;'
. ' if (o.mam=="yes") { o.mam=""; s=c.style; h=m.style; } else { o.mam="yes"; s=m.style; h=c.style; }'
. ' s.height="auto"; s.opacity=1; h.height=0; h.opacity=0;'
. '}'
. '</script>';
# access sysmon data..
#my $sysmon = SYSMON_getValues($dev);
my $sysmon = {};
my $html='';
if(defined($main::defs{$dev}{READINGS})) {
foreach my $r (keys %{$main::defs{$dev}->{READINGS}}){
$sysmon->{$r} = $main::defs{$dev}{READINGS}{$r}{VAL};
}
} else {
$html = 'Unknown device: '.$dev;
}
# build bar chart html..
# ..title
if (defined($opt->{title}) and $opt->{title} ne ''){
if (defined($opt->{weblink}) and $opt->{weblink} ne ''){
$html .= $htmlTitleWeblink =~ s/#TITLE#/$opt->{title}/r =~ s/#WEBLINK#/$opt->{weblink}/r;
}
else{
$html .= $htmlTitleSimple =~ s/#TITLE#/$opt->{title}/r;
}
}
# ..bars
my $htmlBar = ($opt->{stat} eq 1) ? $htmlBarStat : $htmlBarSimple;
$html .= '<table>';
foreach my $bar (@{$opt->{barList}}){
$bar->{param} = $bar->{param} || '';
my $title = $opt->{'title_'.$bar->{type}.'x'}{$bar->{param}} || $opt->{'title_'.$bar->{type}};
if ($bar->{type} eq 'us'){
# uptime system / idle..
if (defined($sysmon->{uptime})){
my $upSystem = SYSMON_secsToReadable($sysmon->{uptime});
# idle..
if (defined($sysmon->{idletime})){
#25386 99.32 %
my (undef,$idleP,undef) = split(/\s+/,$sysmon->{idletime});
$upSystem .= " ($idleP % idle)";
}
$html .= $htmlRow
=~ s/#NAME#/$title/gr
=~ s/#VALUE#/$upSystem/gr;
}
}
elsif ($bar->{type} eq 'uf'){
# uptime fhem..
if (defined($sysmon->{fhemuptime})){
my $upFhem = SYSMON_secsToReadable($sysmon->{fhemuptime});
$html .= $htmlRow
=~ s/#NAME#/$title/gr
=~ s/#VALUE#/$upFhem/gr;
}
}
elsif ($bar->{type} eq 'cf'){
my $name = 'cpu'.$bar->{param}.'_freq';
my $nameS = $name.'_stat';
# cpu freq..
if (defined($sysmon->{$name})){
my %cf = ();
# min max avg..
if (defined($sysmon->{$nameS})){
#600.00 900.00 845.36
($cf{min}, $cf{max}, $cf{avg}) = split(/\s+/,$sysmon->{$nameS});
}
$cf{curP} = sprintf("%.1f",$sysmon->{$name}/10);
$cf{curT} = sprintf("%.0f",$sysmon->{$name})." MHz";
$cf{minP} = sprintf("%.1f",($cf{min}/10));
$cf{minT} = sprintf("%.0f",$cf{min})." MHz";
$cf{maxP} = sprintf("%.1f",($cf{max}/10));
$cf{maxT} = sprintf("%.0f",$cf{max})." MHz";
$cf{avgP} = sprintf("%.1f",($cf{avg}/10));
$cf{avgT} = sprintf("%.0f",$cf{avg})." MHz";
$cf{title} = $title =~ s/%/$bar->{param}/gr;
$html .= $htmlRow
=~ s/#NAME#/$cf{title}/gr
=~ s/#VALUE#/$htmlBar/gr
=~ s/#ID#/$bar->{id}/gr
=~ s/#CURP#/$cf{curP}/gr =~ s/#CURT#/$cf{curT}/gr
=~ s/#MINP#/$cf{minP}/gr =~ s/#MINT#/$cf{minT}/gr
=~ s/#MAXP#/$cf{maxP}/gr =~ s/#MAXT#/$cf{maxT}/gr
=~ s/#AVGP#/$cf{avgP}/gr =~ s/#AVGT#/$cf{avgT}/gr;
}
}
elsif ($bar->{type} eq 'ct'){
# cpu temp..
if (defined($sysmon->{cpu_temp}) and $sysmon->{cpu_temp} > 0){
my %ct = ();
# min max avg..
if (defined($sysmon->{cpu_temp_stat})){
#40.62 42.24 41.54
($ct{min}, $ct{max}, $ct{avg}) = split(/\s+/,$sysmon->{cpu_temp_stat});
}
$ct{curP} = sprintf("%.1f",$sysmon->{cpu_temp});
$ct{curT} = $ct{curP}." &deg;C";
$ct{minP} = sprintf("%.1f",$ct{min});
$ct{minT} = $ct{minP}." &deg;C";
$ct{maxP} = sprintf("%.1f",$ct{max});
$ct{maxT} = $ct{maxP}." &deg;C";
$ct{avgP} = sprintf("%.1f",$ct{avg});
$ct{avgT} = $ct{avgP}." &deg;C";
$ct{title} = $title =~ s/%/$bar->{param}/gr;
$html .= $htmlRow
=~ s/#NAME#/$ct{title}/gr
=~ s/#VALUE#/$htmlBar/gr
=~ s/#ID#/$bar->{id}/gr
=~ s/#CURP#/$ct{curP}/gr =~ s/#CURT#/$ct{curT}/gr
=~ s/#MINP#/$ct{minP}/gr =~ s/#MINT#/$ct{minT}/gr
=~ s/#MAXP#/$ct{maxP}/gr =~ s/#MAXT#/$ct{maxT}/gr
=~ s/#AVGP#/$ct{avgP}/gr =~ s/#AVGT#/$ct{avgT}/gr;
}
}
elsif ($bar->{type} eq 'cl'){
my $name = 'stat_cpu'.$bar->{param}.'_percent';
my $nameS = 'cpu'.$bar->{param}.'_idle_stat';
# cpu load..
if (defined($sysmon->{$name})){
my %cl = ();
#0.28 0.00 0.20 99.43 0.02 0.00 0.07
(undef,undef,undef,$cl{I},undef,undef,undef) = split(/\s+/,$sysmon->{$name});
# min max avg..
if ($opt->{stat} eq 1 and defined($sysmon->{$nameS})){
#92.53 99.75 98.84
($cl{min},$cl{max},$cl{avg}) = split(/\s+/,$sysmon->{$nameS});
}
$cl{curP} = sprintf("%.1f",100-$cl{I});
$cl{curT} = $cl{curP}." %";
$cl{minP} = sprintf("%.1f",100-$cl{max});
$cl{minT} = $cl{minP}." %";
$cl{maxP} = sprintf("%.1f",100-$cl{min});
$cl{maxT} = $cl{maxP}." %";
$cl{avgP} = sprintf("%.1f",100-$cl{avg});
$cl{avgT} = $cl{avgP}." %";
$cl{title} = $title =~ s/%/$bar->{param}/gr;
$html .= $htmlRow
=~ s/#NAME#/$cl{title}/gr
=~ s/#VALUE#/$htmlBar/gr
=~ s/#ID#/$bar->{id}/gr
=~ s/#CURP#/$cl{curP}/gr =~ s/#CURT#/$cl{curT}/gr
=~ s/#MINP#/$cl{minP}/gr =~ s/#MINT#/$cl{minT}/gr
=~ s/#MAXP#/$cl{maxP}/gr =~ s/#MAXT#/$cl{maxT}/gr
=~ s/#AVGP#/$cl{avgP}/gr =~ s/#AVGT#/$cl{avgT}/gr;
}
}
elsif ($bar->{type} =~ /^m[r|s]$/){
my $name = ($bar->{type} eq 'mr') ? 'ram' : 'swap';
my $nameS = $name.'_used_stat';
#mem ram / swap..
if (defined($sysmon->{$name})){
my %mx = ();
#Total: 927.08 MB, Used: 47.86 MB, 5.16 %, Free: 879.22 MB
if($sysmon->{$name} ne 'n/a') {
(undef,$mx{T},$mx{Un},undef,$mx{U},undef,$mx{P},undef,undef,$mx{F},undef) = split(/[\s,]+/,$sysmon->{$name});
# min max avg..
if (defined($sysmon->{$nameS})){
#..
($mx{min},$mx{max},$mx{avg}) = split(/\s+/,$sysmon->{$nameS});
}
#if ($mx{T} gt 1024){ # geht ned..
#if (int($mx{T}) gt 1024){ # geht ned..
if (length($mx{T}) gt 6){
$mx{U} /= 1024;
$mx{T} /= 1024;
$mx{min} /= 1024;
$mx{max} /= 1024;
$mx{avg} /= 1024;
$mx{Un} = 'GB';
}
$mx{curP} = sprintf("%.1f",$mx{U}/$mx{T}*100);
$mx{curT} = sprintf("%.0f",$mx{U})." / ".sprintf("%.0f",$mx{T})." ".$mx{Un};
$mx{minP} = sprintf("%.1f",$mx{min}/$mx{T}*100);
$mx{minT} = sprintf("%.0f",$mx{min})." ".$mx{Un};
$mx{maxP} = sprintf("%.1f",$mx{max}/$mx{T}*100);
$mx{maxT} = sprintf("%.0f",$mx{max})." ".$mx{Un};
$mx{avgP} = sprintf("%.1f",$mx{avg}/$mx{T}*100);
$mx{avgT} = sprintf("%.0f",$mx{avg})." ".$mx{Un};
$html .= $htmlRow
=~ s/#NAME#/$title/gr
=~ s/#VALUE#/$htmlBar/gr
=~ s/#ID#/$bar->{id}/gr
=~ s/#CURP#/$mx{curP}/gr =~ s/#CURT#/$mx{curT}/gr
=~ s/#MINP#/$mx{minP}/gr =~ s/#MINT#/$mx{minT}/gr
=~ s/#MAXP#/$mx{maxP}/gr =~ s/#MAXT#/$mx{maxT}/gr
=~ s/#AVGP#/$mx{avgP}/gr =~ s/#AVGT#/$mx{avgT}/gr;
}
}
}
elsif ($bar->{type} eq 'fs'){
#storage..
if (defined($sysmon->{$bar->{param}})){
my %fs = ();
#Total: 14831 MB, Used: 2004 MB, 15 %, Available: 12176 MB at /
(undef,$fs{T},$fs{Un},undef,$fs{U},undef,$fs{P},undef,undef,$fs{F},undef) = split(/[\s,]+/,$sysmon->{$bar->{param}});
if ($fs{T} gt 0){
if (scalar($fs{T}) > 10000){ # geht ned..
#if (int($fs{T}) gt 1024){ # geht ned..
#if (length($fs{T}) gt 4){
$fs{U} /= 1024;
$fs{T} /= 1024;
$fs{Un} = 'GB';
}
$fs{curP} = sprintf("%.1f",$fs{U}/$fs{T}*100);
$fs{curT} = sprintf("%.1f",$fs{U})." / ".sprintf("%.1f",$fs{T})." ".$fs{Un};
#$fs{minP} = sprintf("%.1f",($fs{min}/$fs{T}*100));
#$fs{minT} = sprintf("%.0f",$fs{min})." ".$fs{Un};
#$fs{maxP} = sprintf("%.1f",$fs{max}/$fs{T}*100);
#$fs{maxT} = sprintf("%.0f",$fs{max})." ".$fs{Un};
#$fs{avgP} = sprintf("%.1f",$fs{avg}/$fs{T}*100);
#$fs{avgT} = sprintf("%.0f",$fs{avg})." ".$fs{Un};
$fs{title} = $title =~ s/%/$bar->{param}/gr;
$html .= $htmlRow
=~ s/#NAME#/$fs{title}/gr
=~ s/#VALUE#/$htmlBarSimple/gr
=~ s/#ID#/$bar->{id}/gr
=~ s/#CURP#/$fs{curP}/gr =~ s/#CURT#/$fs{curT}/gr;
#=~ s/#MINP#/$fs{minP}/gr =~ s/#MINT#/$fs{minT}/gr
#=~ s/#MAXP#/$fs{maxP}/gr =~ s/#MAXT#/$fs{maxT}/gr
#=~ s/#AVGP#/$fs{avgP}/gr =~ s/#AVGT#/$fs{avgT}/gr;
}
}
}
}
$html .= '</table>';
$html .= $htmlScript if ($opt->{stat} eq 1);
return $html;
}
#sub SYSMON_secsToReadable($){
# my $secs = shift;
# my $y = floor($secs / 60/60/24/365);
# my $d = floor($secs/60/60/24) % 365;
# my $h = floor(($secs / 3600) % 24);
# my $m = floor(($secs / 60) % 60);
# my $s = $secs % 60;
# my $string = '';
# $string .= $y.'y ' if ($y > 0);
# $string .= $d.'d ' if ($d > 0);
# $string .= $h.'h ' if ($h > 0);
# $string .= $m.'m ' if ($m > 0);
# $string .= $s.'s' if ($s > 0);
# return $string;
#}
# --- SNX ---------------------------------------------------------------------
## -----------------------------------------------------------------------------
## Visualisation module. provided by snx.
##
## usage:
## SYSMON_weblinkHeader(<weblink device>[,<text>]) : create a clickable device header
## SYSMON_ShowBarChartHtml(<sysmon device>[,<bar color>[,<border color>]]) : create a bar chart for sysmon device
##
## example:
## define wlSysmon weblink htmlCode {SYSMON_weblinkHeader('wlSysmon').SYSMON_ShowBarChartHtml('sysmon')}
## define wlSysmon weblink htmlCode {SYSMON_weblinkHeader('wlSysmon','Cubietruck').SYSMON_ShowBarChartHtml('sysmon','steelblue','gray')}
##
## -----------------------------------------------------------------------------
sub SYSMON_weblinkHeader_alt($;$){
my $dev = shift;
my $text = shift||$dev;
return '<div><a href="?detail='.$dev.'"><b>'.$text.'</b></a></div>';
}
sub SYSMON_ShowBarChartHtml_alt($;$$){
my $dev = shift;
my $colFill = shift || 'lightCoral';
my $colBorder = shift || 'black';
my $htmlRow .= ''
. '<tr>'
. ' <td>#NAME#</td>'
. ' <td>#VALUE#</td>'
. '</tr>';
my $htmlBar .= ''
. '<div style="position:relative;height:1.1em;min-width:200px;border:1px solid '.$colBorder.';overflow:hidden;">'
. ' <div style="position:absolute;height:1.1em;background:'.$colFill.';width:#PERC#%;">'
. ' </div>'
. ' <p style="position:absolute;height:1.1em;width:100%;text-align:center;margin:0">#TEXT#</p>'
. '</div>';
# access sysmon data..
#my $sysmon = SYSMON_getValues($dev);
my $sysmon = {};
foreach my $r (keys %{$main::defs{$dev}->{READINGS}}){
$sysmon->{$r} = $main::defs{$dev}{READINGS}{$r}{VAL};
}
my $html = '<table>';
# cpu load..
if (defined($sysmon->{'stat_cpu_percent'})){
#0.28 0.00 0.20 99.43 0.02 0.00 0.07
my (undef,undef,undef,$cpuI,undef,undef,undef) = split(/\s+/,$sysmon->{'stat_cpu_percent'});
my $cpuLoadP = sprintf("%.1f",(100-$cpuI));
my $cpuLoadT = $cpuLoadP." %";
$html .= $htmlRow =~ s/#NAME#/cpu load/r =~ s/#VALUE#/$htmlBar/r =~ s/#PERC#/$cpuLoadP/r =~ s/#TEXT#/$cpuLoadT/r;
}
# cpu temp..
if (defined($sysmon->{'cpu_temp'})){
my $cpuTempT = $sysmon->{'cpu_temp'}." &deg;C";
my $cpuTempP = $sysmon->{'cpu_temp'};
$html .= $htmlRow =~ s/#NAME#/cpu temp/r =~ s/#VALUE#/$htmlBar/r =~ s/#PERC#/$cpuTempP/r =~ s/#TEXT#/$cpuTempT/r;
}
# cpu freq..
if (defined($sysmon->{'cpu_freq'})){
my $cpuFreqT = $sysmon->{'cpu_freq'}." MHz";
my $cpuFreqP = $sysmon->{'cpu_freq'}/10;
$html .= $htmlRow =~ s/#NAME#/cpu freq/r =~ s/#VALUE#/$htmlBar/r =~ s/#PERC#/$cpuFreqP/r =~ s/#TEXT#/$cpuFreqT/r;
}
#mem ram..
if (defined($sysmon->{'ram'})){
#Total: 927.08 MB, Used: 47.86 MB, 5.16 %, Free: 879.22 MB
my (undef,$ramT,$ramUn,undef,$ramU,undef,$ramP,undef,undef,$ramF,undef) = split(/[\s,]+/,$sysmon->{'ram'});
$ramT = sprintf("%.0f",$ramU)." / ".sprintf("%.0f",$ramT)." ".$ramUn;
$html .= $htmlRow =~ s/#NAME#/mem ram/r =~ s/#VALUE#/$htmlBar/r =~ s/#PERC#/$ramP/r =~ s/#TEXT#/$ramT/r;
}
#mem swap..
if (defined($sysmon->{'swap'})){
#Total: 100.00 MB, Used: 0.00 MB, 0.00 %, Free: 100.00 MB
my (undef,$swapT,$swapUn,undef,$swapU,undef,$swapP,undef,undef,$swapF,undef) = split(/[\s,]+/,$sysmon->{'swap'});
$swapT = sprintf("%.0f",$swapU)." / ".sprintf("%.0f",$swapT)." ".$swapUn;
$html .= $htmlRow =~ s/#NAME#/mem swap/r =~ s/#VALUE#/$htmlBar/r =~ s/#PERC#/$swapP/r =~ s/#TEXT#/$swapT/r;
}
#sd-card..
if (defined($sysmon->{'fs_root'})){
#Total: 14831 MB, Used: 2004 MB, 15 %, Available: 12176 MB at /
#my $sd = R("$dev:fs_root");
my (undef,$sdT,undef,undef,$sdU,undef,$sdP,undef,undef,$sdF,undef) = split(/[\s,]+/,$sysmon->{'fs_root'});
$sdT = sprintf("%.1f",($sdU/1024))." / ".sprintf("%.1f",($sdT/1024))." GB";
$html .= $htmlRow =~ s/#NAME#/root fs/r =~ s/#VALUE#/$htmlBar/r =~ s/#PERC#/$sdP/r =~ s/#TEXT#/$sdT/r;
}
# uptime system / idle..
if (defined($sysmon->{'uptime'})){
my $upSystem = SYSMON_secsToReadable($sysmon->{'uptime'});
if (defined($sysmon->{uptime})){
#25386 99.32 %
my (undef,$idle,undef) = split(/\s+/,$sysmon->{'idletime'});
$upSystem .= " ($idle % idle)";
}
$html .= $htmlRow =~ s/#NAME#/system uptime/r =~ s/#VALUE#/$upSystem/r;
}
# uptime fhem..
if (defined($sysmon->{'fhemuptime'})){
my $upFhem = SYSMON_secsToReadable($sysmon->{'fhemuptime'});
$html .= $htmlRow =~ s/#NAME#/fhem uptime/r =~ s/#VALUE#/$upFhem/r;
}
$html .= '</table>';
return $html;
}
sub SYSMON_secsToReadable($){
my $secs = shift;
my $y = floor($secs / 60/60/24/365);
my $d = floor($secs/60/60/24) % 365;
my $h = floor(($secs / 3600) % 24);
my $m = floor(($secs / 60) % 60);
my $s = $secs % 60;
my $string = '';
$string .= $y.'y ' if ($y > 0);
$string .= $d.'d ' if ($d > 0);
$string .= $h.'h ' if ($h > 0);
$string .= $m.'m ' if ($m > 0);
$string .= $s.'s' if ($s > 0);
return $string;
}
# -----------------------------------------------------------------------------
1;
@ -4717,7 +4179,6 @@ Raspberry Pi (Debian Wheezy), BeagleBone Black, FritzBox 7390, WR703N under Open
<br><br>
<code>define &lt;name&gt; SYSMON [MODE[:[USER@]HOST][:PORT]] [&lt;M1&gt;[ &lt;M2&gt;[ &lt;M3&gt;[ &lt;M4&gt;]]]]</code><br>
<br>
This statement creates a new SYSMON instance. The parameters M1 to M4 define the refresh interval for various Readings (statistics). The parameters are to be understood as multipliers for the time defined by INTERVAL_BASE. Because this time is fixed at 60 seconds, the Mx-parameter can be considered as time intervals in minutes.<br>
If one (or more) of the multiplier is set to zero, the corresponding readings is deactivated.
<br>
@ -4740,10 +4201,9 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
fhemuptime, fhemuptime_text, idletime, idletime_text, uptime, uptime_text, starttime, starttime_text<br><br>
</li>
</ul>
To query a remote system at least the address (HOST) must be specified. Accompanied by the port and / or user name, if necessary. The password (if needed) has to be defined once with the command 'set password <password>'. For MODE parameter are 'telnet' and 'local' only allowed. 'local' does not require any other parameters and can also be omitted.
To query a remote system at least the address (HOST) must be specified. Accompanied by the port and / or user name, if necessary. The password (if needed) has to be defined once with the command 'set password &lt;password&gt;'. For MODE parameter are 'telnet' and 'local' only allowed. 'local' does not require any other parameters and can also be omitted.
<br>
<br>
<b>Readings:</b>
<br><br>
<ul>
@ -4885,7 +4345,7 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
</li>
<br>
<li>fw_version_info<br>
Information on the installed firmware version: <VersionNum> <creation date> <time>
Information on the installed firmware version: &lt;VersionNum&gt; &lt;creation date&gt; &lt;time&gt;
</li>
<br>
<b>DSL Informations (FritzBox)</b>
@ -4976,105 +4436,7 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
<br>
</ul>
Sample output:<br>
<ul>
<table style="border: 1px solid black;">
<tr><td style="border-bottom: 1px solid black;"><div class="dname">cpu_freq</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>900</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">cpu_temp</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>49.77</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">cpu_temp_avg</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>49.7</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">eth0</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>RX: 2954.22 MB, TX: 3469.21 MB, Total: 6423.43 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">eth0_diff</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>RX: 6.50 MB, TX: 0.23 MB, Total: 6.73 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">fhemuptime</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>11231</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">fhemuptime_text&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>0 days, 03 hours, 07 minutes</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">idletime</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>931024 88.35 %</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">idletime_text</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>10 days, 18 hours, 37 minutes (88.35 %)</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">loadavg</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>0.14 0.18 0.22</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">ram</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>Total: 485 MB, Used: 140 MB, 28.87 %, Free: 345 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">swap</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>n/a</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">uptime</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>1053739</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">uptime_text</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>12 days, 04 hours, 42 minutes</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">wlan0</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>RX: 0.00 MB, TX: 0.00 MB, Total: 0 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">wlan0_diff</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>RX: 0.00 MB, TX: 0.00 MB, Total: 0.00 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">fs_root</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>Total: 7404 MB, Used: 3533 MB, 50 %, Available: 3545 MB at /</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">fs_boot</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>Total: 56 MB, Used: 19 MB, 33 %, Available: 38 MB at /boot</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname">fs_usb1</div></td>
<td style="border-bottom: 1px solid black;"><div>Total: 30942 MB, Used: 6191 MB, 21 %, Available: 24752 MB at /media/usb1&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname">stat_cpu</div></td>
<td style="border-bottom: 1px solid black;"><div>10145283 0 2187286 90586051 542691 69393 400342&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname">stat_cpu_diff</div></td>
<td style="border-bottom: 1px solid black;"><div>2151 0 1239 2522 10 3 761&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname">stat_cpu_percent</div></td>
<td style="border-bottom: 1px solid black;"><div>4.82 0.00 1.81 93.11 0.05 0.00 0.20&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td><div class="dname">stat_cpu_text</div></td>
<td><div>user: 32.17 %, nice: 0.00 %, sys: 18.53 %, idle: 37.72 %, io: 0.15 %, irq: 0.04 %, sirq: 11.38 %&nbsp;&nbsp;</div></td>
<td><div>2013-11-27 00:05:36</div></td>
</tr>
</table>
</ul><br>
<br>
<b>Get:</b><br><br>
<ul>
<li>interval_base<br>
@ -5101,9 +4463,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
Displays known LAN Devices (FritzBox only).
</li>
<br>
</ul><br>
</ul>
<br>
<b>Set:</b><br><br>
<ul>
<li>interval_multipliers<br>
@ -5122,8 +4483,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
Specify the password for remote access (usually only necessary once).
</li>
<br>
</ul><br>
</ul>
<br>
<b>Attributes:</b><br><br>
<ul>
<li>filesystems &lt;reading name&gt;[:&lt;mountpoint&gt;[:&lt;comment&gt;]],...<br>
@ -5179,8 +4540,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
fbwlan, fbnightctrl, fbnewmessages, fbdecttemp, fbversion, fbdsl, powerinfo
</li>
<br>
</ul><br>
</ul>
<br>
<b>Plots:</b><br><br>
<ul>
predefined gplot files:<br>
@ -5212,8 +4573,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
SM_DB_RAM.gplot<br>
</code>
</ul>
</ul><br>
</ul>
<br>
<b>HTML output method (see Weblink): SYSMON_ShowValuesHTML(&lt;SYSMON-Instance&gt;[,&lt;Liste&gt;])</b><br><br>
<ul>
The module provides a function that returns selected Readings as HTML.<br>
@ -5226,21 +4587,23 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
If no list specified, a predefined selection is used (all values are displayed).<br><br>
<code>define sysv1 weblink htmlCode {SYSMON_ShowValuesHTML('sysmon')}</code><br>
<code>define sysv2 weblink htmlCode {SYSMON_ShowValuesHTML('sysmon', ('date:Datum', 'cpu_temp:CPU Temperatur: &deg;C:%.1f'', 'cpu_freq:CPU Frequenz: MHz'))}</code>
</ul><br>
</ul>
<br>
<b>Text output method (see Weblink): SYSMON_ShowValuesHTMLTitled(&lt;SYSMON-Instance&gt;[,&lt;Title&gt;,&lt;Liste&gt;])</b><br><br>
<ul>
According to SYSMON_ShowValuesHTML, but with a Title text above. If no title provided, device alias will be used (if any)<br>
</ul><br>
</ul>
<br>
<b>Text output method (see Weblink): SYSMON_ShowValuesText(&lt;SYSMON-Instance&gt;[,&lt;Liste&gt;])</b><br><br>
<ul>
According to SYSMON_ShowValuesHTML, but formatted as plain text.<br>
</ul><br>
</ul>
<br>
<b>Text output method (see Weblink): SYSMON_ShowValuesTextTitled(&lt;SYSMON-Instance&gt;[,&lt;Title&gt;,&lt;Liste&gt;])</b><br><br>
<ul>
According to SYSMON_ShowValuesHTMLTitled, but formatted as plain text.<br>
</ul><br>
</ul>
<br>
<b>Reading values with perl: SYSMON_getValues(&lt;name&gt;[, &lt;array of desired keys&gt;])</b><br><br>
<ul>
Returns a hash ref with desired values. If no array is passed, all values are returned.<br>
@ -5248,8 +4611,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
{(SYSMON_getValues("sysmon",("cpu_freq","cpu_temp")))->{"cpu_temp"}}<br>
{join(" ", values (SYSMON_getValues("sysmon")))}<br>
{join(" ", values (SYSMON_getValues("sysmon",("cpu_freq","cpu_temp"))))}<br>
</ul><br>
</ul>
<br>
<b>Examples:</b><br><br>
<ul>
<code>
@ -5344,10 +4707,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
attr wl_sysmon_power_bat group system<br>
</code>
</ul>
</ul>
<!-- ================================ -->
=end html
=begin html_DE
@ -5399,7 +4760,6 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
Als MODE sind derzeit 'telnet' und 'local' erlaubt. 'local' erfordert keine weiteren Angaben und kann auch ganz weggelassen werden.
<br>
<br>
<b>Readings:</b>
<br><br>
<ul>
@ -5547,7 +4907,7 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
</li>
<br>
<li>fw_version_info<br>
Angaben zu der installierten Firmware-Version: <VersionNr> <Erstelldatum> <Zeit>
Angaben zu der installierten Firmware-Version: &lt;VersionNr&gt; &lt;Erstelldatum&gt; &lt;Zeit&gt;
</li>
<br>
<b>DSL Informationen (FritzBox)</b>
@ -5638,105 +4998,7 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
<br>
</ul>
Beispiel-Ausgabe:<br>
<ul>
<table style="border: 1px solid black;">
<tr><td style="border-bottom: 1px solid black;"><div class="dname">cpu_freq</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>900</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">cpu_temp</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>49.77</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">cpu_temp_avg</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>49.7</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">eth0</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>RX: 2954.22 MB, TX: 3469.21 MB, Total: 6423.43 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">eth0_diff</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>RX: 6.50 MB, TX: 0.23 MB, Total: 6.73 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">fhemuptime</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>11231</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">fhemuptime_text&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>0 days, 03 hours, 07 minutes</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">idletime</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>931024 88.35 %</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">idletime_text</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>10 days, 18 hours, 37 minutes (88.35 %)</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">loadavg</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>0.14 0.18 0.22</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">ram</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>Total: 485 MB, Used: 140 MB, 28.87 %, Free: 345 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">swap</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>n/a</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">uptime</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>1053739</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">uptime_text</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>12 days, 04 hours, 42 minutes</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">wlan0</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>RX: 0.00 MB, TX: 0.00 MB, Total: 0 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">wlan0_diff</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>RX: 0.00 MB, TX: 0.00 MB, Total: 0.00 MB</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">fs_root</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>Total: 7404 MB, Used: 3533 MB, 50 %, Available: 3545 MB at /</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname"><div class="dname">fs_boot</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>Total: 56 MB, Used: 19 MB, 33 %, Available: 38 MB at /boot</div></td>
<td style="border-bottom: 1px solid black;"><div class="dname"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname">fs_usb1</div></td>
<td style="border-bottom: 1px solid black;"><div>Total: 30942 MB, Used: 6191 MB, 21 %, Available: 24752 MB at /media/usb1&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname">stat_cpu</div></td>
<td style="border-bottom: 1px solid black;"><div>10145283 0 2187286 90586051 542691 69393 400342&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname">stat_cpu_diff</div></td>
<td style="border-bottom: 1px solid black;"><div>2151 0 1239 2522 10 3 761&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td style="border-bottom: 1px solid black;"><div class="dname">stat_cpu_percent</div></td>
<td style="border-bottom: 1px solid black;"><div>4.82 0.00 1.81 93.11 0.05 0.00 0.20&nbsp;&nbsp;</div></td>
<td style="border-bottom: 1px solid black;"><div>2013-11-27 00:05:36</div></td>
</tr>
<tr><td><div class="dname">stat_cpu_text</div></td>
<td><div>user: 32.17 %, nice: 0.00 %, sys: 18.53 %, idle: 37.72 %, io: 0.15 %, irq: 0.04 %, sirq: 11.38 %&nbsp;&nbsp;</div></td>
<td><div>2013-11-27 00:05:36</div></td>
</tr>
</table>
</ul><br>
<br>
<b>Get:</b><br><br>
<ul>
<li>interval<br>
@ -5763,8 +5025,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
<li>list_lan_devices<br>
Listet bekannte Ger&auml;te im LAN (nur FritzBox).
</li>
</ul><br>
</ul>
<br>
<b>Set:</b><br><br>
<ul>
<li>interval_multipliers<br>
@ -5785,8 +5047,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
Definiert das Passwort f&uuml;r den Remote-Zugriff (i.d.R. nur einmalig notwendig).
</li>
<br>
</ul><br>
</ul>
<br>
<b>Attributes:</b><br><br>
<ul>
<li>filesystems &lt;reading name&gt;[:&lt;mountpoint&gt;[:&lt;comment&gt;]],...<br>
@ -5849,8 +5111,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
fbwlan, fbnightctrl, fbnewmessages, fbdecttemp, fbversion, fbdsl, powerinfo
</li>
<br>
</ul><br>
</ul>
<br>
<b>Plots:</b><br><br>
<ul>
F&uuml;r dieses Modul sind bereits einige gplot-Dateien vordefiniert:<br>
@ -5882,8 +5144,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
SM_DB_RAM.gplot<br>
</code>
</ul>
</ul><br>
</ul>
<br>
<b>HTML-Ausgabe-Methode (f&uuml;r ein Weblink): SYSMON_ShowValuesHTML(&lt;SYSMON-Instanz&gt;[,&lt;Liste&gt;])</b><br><br>
<ul>
Das Modul definiert eine Funktion, die ausgew&auml;hlte Readings in HTML-Format ausgibt. <br>
@ -5892,30 +5154,30 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
Der zweite Parameter ist optional und gibt eine Liste der anzuzeigende Readings
im Format <code>&lt;ReadingName&gt;[:&lt;Comment&gt;[:&lt;Postfix&gt;[:&lt;FormatString&gt;]]]</code> an.<br>
Dabei gibt <code>ReadingName</code> den anzuzeigenden Reading an, der Wert aus <code>Comment</code> wird als der Anzeigename verwendet
und <code>Postfix</code> wird nach dem eihentlichen Wert angezeigt (so k&ouml;nnen z.B. Einheiten wie MHz angezeigt werden). Mit Hilfe von FormatString kann die Ausgabe beeinflusst werden (s. sprintf in PerlDoku).<br>
und <code>Postfix</code> wird nach dem eihentlichen Wert angezeigt (so k&ouml;nnen z.B. Einheiten wie MHz angezeigt werden).
Mit Hilfe von FormatString kann die Ausgabe beeinflusst werden (s. sprintf in PerlDoku).<br>
Falls kein <code>Comment</code> angegeben ist, wird eine intern vordefinierte Beschreibung angegeben.
Bei benutzerdefinierbaren Readings wird ggf. <code>Comment</code> aus der Definition verwendet.<br>
Wird keine Liste angegeben, wird eine vordefinierte Auswahl verwendet (alle Werte).<br><br>
<code>define sysv1 weblink htmlCode {SYSMON_ShowValuesHTML('sysmon')}</code><br>
<code>define sysv2 weblink htmlCode {SYSMON_ShowValuesHTML('sysmon', ('date:Datum', 'cpu_temp:CPU Temperatur: &deg;C', 'cpu_freq:CPU Frequenz: MHz'))}</code>
</ul><br>
</ul>
<br>
<b>HTML-Ausgabe-Methode (f&uuml;r ein Weblink): SYSMON_ShowValuesHTMLTitled(&lt;SYSMON-Instance&gt;[,&lt;Title&gt;,&lt;Liste&gt;])</b><br><br>
<ul>
Wie SYSMON_ShowValuesHTML, aber mit einer &Uuml;berschrift dar&uuml;ber. Wird keine &Uuml;berschrift angegeben, wird alias des Moduls genutzt (falls definiert).<br>
</ul><br>
</ul>
<br>
<b>Text-Ausgabe-Methode (see Weblink): SYSMON_ShowValuesText(&lt;SYSMON-Instance&gt;[,&lt;Liste&gt;])</b><br><br>
<ul>
Analog SYSMON_ShowValuesHTML, jedoch formatiert als reines Text.<br>
</ul><br>
</ul>
<br>
<b>HTML-Ausgabe-Methode (f&uuml;r ein Weblink): SYSMON_ShowValuesTextTitled(&lt;SYSMON-Instance&gt;[,&lt;Title&gt;,&lt;Liste&gt;])</b><br><br>
<ul>
Wie SYSMON_ShowValuesText, aber mit einer &Uuml;berschrift dar&uuml;ber.<br>
</ul><br>
</ul>
<br>
<b>Readings-Werte mit Perl lesen: SYSMON_getValues(&lt;name&gt;[, &lt;Liste der gew&uuml;nschten Schl&uuml;ssel&gt;])</b><br><br>
<ul>
Liefert ein Hash-Ref mit den gew&uuml;nschten Werten. Wenn keine Liste (array) &uuml;bergeben wird, werden alle Werte geliefert.<br>
@ -5923,8 +5185,8 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
{(SYSMON_getValues("sysmon",("cpu_freq","cpu_temp")))->{"cpu_temp"}}<br>
{join(" ", values (SYSMON_getValues("sysmon")))}<br>
{join(" ", values (SYSMON_getValues("sysmon",("cpu_freq","cpu_temp"))))}<br>
</ul><br>
</ul>
<br>
<b>Beispiele:</b><br><br>
<ul>
<code>
@ -6019,8 +5281,10 @@ If one (or more) of the multiplier is set to zero, the corresponding readings is
attr wl_sysmon_power_bat group system<br>
</code>
</ul>
</ul>
=end html_DE
=cut