mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
CHANGED: updated
98_fheminfo.pm: remove release, featurelevel, uptime 98_uptime.pm: new command module to show FHEM uptime git-svn-id: https://svn.fhem.de/fhem/trunk@14703 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
43e7f7df80
commit
88326f4f83
@ -1,5 +1,7 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||
# Do not insert empty lines here, update check depends on it.
|
||||
- changed: 98_fheminfo.pm: remove release, featurelevel, uptime infos
|
||||
- added: 98_uptime.pm: new command module to show FHEM uptime
|
||||
- change: 93_DbLog: V2.19.0, replace internal DBMODEL by MODEL completely
|
||||
- update: 88_HMCCU: Version 4.1
|
||||
- feature: 93_DbRep: V5.5.0, new command restoreMySQL, use new Internal
|
||||
|
@ -73,16 +73,12 @@ sub CommandFheminfo($$) {
|
||||
#
|
||||
sub _fi2_Count() {
|
||||
my $uniqueID = getUniqueId();
|
||||
my $release = "5.8";
|
||||
my $feature = $featurelevel ? $featurelevel : $release;
|
||||
my $os = $^O;
|
||||
my $perl = sprintf("%vd", $^V);
|
||||
|
||||
%fhemInfo = ();
|
||||
|
||||
$fhemInfo{$c_system}{'uniqueID'} = $uniqueID;
|
||||
$fhemInfo{$c_system}{'release'} = $release;
|
||||
$fhemInfo{$c_system}{'feature'} = $feature;
|
||||
$fhemInfo{$c_system}{'os'} = $os;
|
||||
$fhemInfo{$c_system}{'perl'} = $perl;
|
||||
$fhemInfo{$c_system}{'revision'} = _fi2_findRev();
|
||||
@ -171,19 +167,15 @@ sub _fi2_Send() {
|
||||
|
||||
sub _fi2_TelnetTable($) {
|
||||
my ($doSend) = shift;
|
||||
my $upTime = _fi2_Uptime();
|
||||
my $str;
|
||||
$str .= "Following statistics data will be sent to server:\n(see Logfile level 4 for server response)\n\n" if($doSend == 1);
|
||||
$str .= "System Info\n";
|
||||
$str .= sprintf(" Release%*s: %s\n",6," ",$fhemInfo{$c_system}{'release'});
|
||||
$str .= sprintf(" FeatureLevel%*s: %s\n",0," ",$fhemInfo{$c_system}{'feature'});
|
||||
$str .= sprintf(" ConfigType%*s: %s\n",3," ",$fhemInfo{$c_system}{'configType'});
|
||||
$str .= sprintf(" SVN revision%*s: %s\n",0," ",$fhemInfo{$c_system}{'revision'})
|
||||
if (defined($fhemInfo{$c_system}{'revision'}));
|
||||
$str .= sprintf(" OS%*s: %s\n",11," ",$fhemInfo{$c_system}{'os'});
|
||||
$str .= sprintf(" Perl%*s: %s\n",9," ",$fhemInfo{$c_system}{'perl'});
|
||||
$str .= sprintf(" uniqueID%*s: %s\n",5," ",_fi2_shortId());
|
||||
$str .= sprintf(" upTime%*s: %s\n",7," ",$upTime);
|
||||
|
||||
my @keys = keys %fhemInfo;
|
||||
foreach my $type (sort @keys)
|
||||
@ -201,19 +193,15 @@ sub _fi2_TelnetTable($) {
|
||||
|
||||
sub _fi2_HtmlTable($) {
|
||||
my ($doSend) = shift;
|
||||
my $upTime = _fi2_Uptime();
|
||||
my $result = "<html><table>";
|
||||
$result .= "<tr><td colspan='3'>Following statistics data will be sent to server:</br>(see Logfile level 4 for server response)</td></tr>" if($doSend == 1);
|
||||
$result .= "<tr><td><b>System Info</b></td></tr>";
|
||||
$result .= "<tr><td> </td><td>Release:</td><td>$fhemInfo{$c_system}{'release'}</td></tr>";
|
||||
$result .= "<tr><td> </td><td>FeatureLevel:</td><td>$fhemInfo{$c_system}{'feature'}</td></tr>";
|
||||
$result .= "<tr><td> </td><td>ConfigType:</td><td>$fhemInfo{$c_system}{'configType'}</td></tr>";
|
||||
$result .= "<tr><td> </td><td>SVN rev:</td><td>$fhemInfo{$c_system}{'revision'}</td></tr>"
|
||||
if (defined($fhemInfo{$c_system}{'revision'}));
|
||||
$result .= "<tr><td> </td><td>OS:</td><td>$fhemInfo{$c_system}{'os'}</td></tr>";
|
||||
$result .= "<tr><td> </td><td>Perl:</td><td>$fhemInfo{$c_system}{'perl'}</td></tr>";
|
||||
$result .= "<tr><td> </td><td>uniqueId:</td><td>"._fi2_shortId()."</td></tr>";
|
||||
$result .= "<tr><td> </td><td>upTime:</td><td>$upTime</td></tr>";
|
||||
$result .= "<tr><td colspan=3> </td></tr>";
|
||||
$result .= "<tr><td><b>Modules</b></td><td><b>Model</b></td><td><b>Count</b></td></tr>";
|
||||
|
||||
@ -231,27 +219,6 @@ sub _fi2_HtmlTable($) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub _fi2_Uptime() {
|
||||
my $diff = time - $fhem_started;
|
||||
my ($d,$h,$m,$ret);
|
||||
|
||||
($d,$diff) = _fi2_Div($diff,86400);
|
||||
($h,$diff) = _fi2_Div($diff,3600);
|
||||
($m,$diff) = _fi2_Div($diff,60);
|
||||
|
||||
$ret = "";
|
||||
$ret .= "$d days, " if($d > 1);
|
||||
$ret .= "1 day, " if($d == 1);
|
||||
$ret .= sprintf("%02s:%02s:%02s", $h, $m, $diff);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub _fi2_Div($$) {
|
||||
my ($p1,$p2) = @_;
|
||||
return (int($p1/$p2), $p1 % $p2);
|
||||
}
|
||||
|
||||
sub _fi2_findRev() {
|
||||
my $cf = 'controls_fhem.txt';
|
||||
my $filename = (-e "./$cf") ? "./$cf" : AttrVal("global","modpath",".")."/FHEM/$cf";
|
||||
@ -312,20 +279,18 @@ sub _fi2_shortId() {
|
||||
<br>
|
||||
<br>
|
||||
The optional parameter <code>send</code> transmitts the collected data
|
||||
to a central server in order to support the development of FHEM. The
|
||||
transmitted data is processed graphically. The results can be viewed
|
||||
on <a href="https://fhem.de/stats/statistics.html">http://fhem.de/stats/statistics.html</a>.
|
||||
to a central server in order to support the development of FHEM. <br/>
|
||||
The submitted data is processed graphically. The results can be viewed
|
||||
on <a href="https://fhem.de/stats/statistics.html">http://fhem.de/stats/statistics.html</a>.<br/>
|
||||
The IP address will not be stored in database, only used for region determination during send.
|
||||
<br>
|
||||
<br>
|
||||
Features:<br>
|
||||
<ul>
|
||||
<li>FHEM release and FeatureLevel (will be removed soon)</li>
|
||||
<li>ConfigType (configDB|configFILE)</li>
|
||||
<li>SVN rev number</li>
|
||||
<li>Operating System Information</li>
|
||||
<li>Installed Perl version</li>
|
||||
<li>Uptime (not sent to server)</li>
|
||||
<li>Defined modules</li>
|
||||
<li>Defined models per module</li>
|
||||
</ul>
|
||||
|
77
fhem/FHEM/98_uptime.pm
Normal file
77
fhem/FHEM/98_uptime.pm
Normal file
@ -0,0 +1,77 @@
|
||||
=for comment
|
||||
|
||||
# $Id$
|
||||
|
||||
This script 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
|
||||
any later version.
|
||||
|
||||
The GNU General Public License can be found at
|
||||
http://www.gnu.org/copyleft/gpl.html.
|
||||
A copy is found in the textfile GPL.txt and important notices to the license
|
||||
from the author is found in LICENSE.txt distributed with these scripts.
|
||||
|
||||
This script 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.
|
||||
|
||||
=cut
|
||||
|
||||
package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub uptime_Initialize($$) {
|
||||
my %hash = (
|
||||
Fn => "CommandUptime",
|
||||
Hlp => ",show FHEM uptime",
|
||||
);
|
||||
$cmds{uptime} = \%hash;
|
||||
}
|
||||
|
||||
sub CommandUptime($$) {
|
||||
my ($cl,$param) = @_;
|
||||
my @args = split("[ \t]+", $param);
|
||||
|
||||
my $diff = time - $fhem_started;
|
||||
my ($d,$h,$m,$ret);
|
||||
|
||||
($d,$diff) = _upT_Div($diff,86400);
|
||||
($h,$diff) = _upT_Div($diff,3600);
|
||||
($m,$diff) = _upT_Div($diff,60);
|
||||
|
||||
$ret = "";
|
||||
$ret .= "$d days, " if($d > 1);
|
||||
$ret .= "1 day, " if($d == 1);
|
||||
$ret .= sprintf("%02s:%02s:%02s", $h, $m, $diff);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
sub _upT_Div($$) {
|
||||
my ($p1,$p2) = @_;
|
||||
return (int($p1/$p2), $p1 % $p2);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=pod
|
||||
=item command
|
||||
=item summary show FHEM uptime
|
||||
=item summary_DE zeigt FHEM Laufzeit an
|
||||
=begin html
|
||||
|
||||
<a name="uptime"></a>
|
||||
<h3>uptime/h3>
|
||||
<ul>
|
||||
<code>uptime</code>
|
||||
<br>
|
||||
<br>
|
||||
uptime shows FHEM uptime since last FHEM (re-)start.
|
||||
<br>
|
||||
</ul>
|
||||
|
||||
=end html
|
||||
=cut
|
Loading…
Reference in New Issue
Block a user