]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
Hinzugefügt:
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 17 Jul 2006 15:36:55 +0000 (15:36 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 17 Jul 2006 15:36:55 +0000 (15:36 +0000)
  * Hddtemp war nicht in der ISO...
  * Smartmontools für HDD-Überwachung.
  * MBMon zur Temperatur- und Drehzahl-Überwachung.
  * ./make.sh build-only <pak>
Anmerkung:
  * Die Graphen sind noch nicht ganz implementiert.
    Muss nochmal aufgeräumt und vor allem die Sprach-
    bezeichnungen müssen angepasst werden.

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@210 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/cfgroot/mbmon-settings [new file with mode: 0644]
html/cgi-bin/hddgraph.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
lfs/configroot
lfs/hddtemp
lfs/mbmon [new file with mode: 0644]
lfs/smartmontools [new file with mode: 0644]
make.sh
src/ROOTFILES.i386
src/scripts/makegraphs

diff --git a/config/cfgroot/mbmon-settings b/config/cfgroot/mbmon-settings
new file mode 100644 (file)
index 0000000..c36c2ee
--- /dev/null
@@ -0,0 +1,4 @@
+GRAPH_HDD=1
+GRAPH_TEMP=1
+GRAPH_FAN=1
+GRAPH_VOLT=1
index 71cfef014f462fe21f14bdfff3905ea8a090ebee..3ccd93867ae9923e15b273cc226649809101387f 100644 (file)
@@ -6,27 +6,17 @@
 #
 # (c) The SmoothWall Team
 #
-# $Id: graphs.cgi,v 1.9.2.6 2005/02/22 22:21:55 gespinasse Exp $
-#
-# 2006-02-23 modified by weizen_42 for hddgraphs
-#
-# 2006-02-xx weizen_42        several modifications
-# 2006-03-31 weizen_42        link to homepage
-# 2006-04-22 weizen_42        v0.1.1 install below proxygraphs in status menu
-#
 
 use strict;
 
 # enable only the following on debugging purpose
-#use warnings;
-#use CGI::Carp 'fatalsToBrowser';
+# use warnings;
+# use CGI::Carp 'fatalsToBrowser';
 
 require '/var/ipfire/general-functions.pl';
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
-my $version = 'v0.1.1';
-
 my %cgiparams=();
 my @cgigraphs=();
 my @graphs=();
@@ -35,32 +25,263 @@ my @graphs=();
 
 my $graphdir = "/home/httpd/html/graphs";
 
+&Header::getcgihash(\%cgiparams);
+
 $ENV{'QUERY_STRING'} =~ s/&//g;
 @cgigraphs = split(/graph=/,$ENV{'QUERY_STRING'});
 $cgigraphs[1] = '' unless defined $cgigraphs[1];
 
+my %mbmon_settings = ();
+my %mbmon_values = ();
+&General::readhash("/var/log/mbmon-values", \%mbmon_values);
+my $key;
+
+if ( $cgiparams{'ACTION'} eq $Lang::tr{'save'} )
+{
+  $mbmon_settings{'GRAPH_TEMP'} = ($cgiparams{'TEMP'} eq 'on');
+  $mbmon_settings{'GRAPH_FAN'} = ($cgiparams{'FAN'} eq 'on');
+  $mbmon_settings{'GRAPH_VOLT'} = ($cgiparams{'VOLT'} eq 'on');
+  $mbmon_settings{'GRAPH_HDD'} = ($cgiparams{'HDD'} eq 'on');
+
+  foreach my $line (sort keys %cgiparams) 
+  {
+    if ( index($line, "LINE-") != -1 )
+    {
+      $mbmon_settings{$line} = 'on';
+    }
+
+    if ( index($line, "LABEL-") != -1 )
+    {
+      $mbmon_settings{$line} = $cgiparams{$line};
+    }
+  }
+
+  &General::writehash("${General::swroot}/mbmon/settings", \%mbmon_settings);
+}
+else
+{
+  &General::readhash("${General::swroot}/mbmon/settings", \%mbmon_settings);
+}
+
+my $selected_temp = '';
+my $selected_fan = '';
+my $selected_volt = '';
+my $selected_hdd = '';
+
+$selected_temp = "checked='checked'" if ( $mbmon_settings{'GRAPH_TEMP'} == 1 );
+$selected_fan  = "checked='checked'" if ( $mbmon_settings{'GRAPH_FAN'} == 1 );
+$selected_volt = "checked='checked'" if ( $mbmon_settings{'GRAPH_VOLT'} == 1 );
+$selected_hdd = "checked='checked'" if ( $mbmon_settings{'GRAPH_HDD'} == 1 );
+
+my %mbmon_graphs = ();
+foreach $key ( sort(keys %mbmon_values) ) 
+{
+  $mbmon_graphs{$key} = "checked='checked'" if ( $mbmon_settings{'LINE-'.$key} eq 'on' );
+  if ( !defined($mbmon_settings{'LABEL-'.$key}) )
+  {
+    $mbmon_settings{'LABEL-'.$key} = $key;
+  }
+}
+
 &Header::openpage($Lang::tr{'harddisk temperature graphs'}, 1, '');
 
 &Header::openbigbox('100%', 'left');
 
-  &Header::openbox('100%', 'center', $Lang::tr{'harddisk temperature'});
+###############
+# DEBUG DEBUG
+#&Header::openbox('100%', 'left', 'DEBUG');
+#my $debugCount = 0;
+#foreach my $line (sort keys %cgiparams) {
+#  print "$line = $cgiparams{$line}<br />\n";
+#  $debugCount++;
+#}
+#print "&nbsp;Count: $debugCount\n";
+#&Header::closebox();
+# DEBUG DEBUG
+###############
 
-  if (-e "$graphdir/hddtemp-day.png") 
+if ($cgigraphs[1] =~ /(temp|fan|volt)/) 
+{
+  my $graph = $cgigraphs[1];
+  my $graphname = $Lang::tr{"mbmon $cgigraphs[1]"};
+  &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
+
+  if (-e "$graphdir/mbmon-${graph}-day.png") 
   {
-    my $ftime = localtime((stat("$graphdir/hddtemp-day.png"))[9]);
+    my $ftime = localtime((stat("$graphdir/mbmon-${graph}-day.png"))[9]);
     print "<center>";
     print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br /><hr />\n";
-    print "<img src='/graphs/hddtemp-day.png' border='0' /><hr />";
-    print "<img src='/graphs/hddtemp-week.png' border='0' /><hr />";
-    print "<img src='/graphs/hddtemp-month.png' border='0' /><hr />";
-    print "<img src='/graphs/hddtemp-year.png' border='0' />";
+    print "<img src='/graphs/mbmon-${graph}-day.png' border='0' /><hr />";
+    print "<img src='/graphs/mbmon-${graph}-week.png' border='0' /><hr />";
+    print "<img src='/graphs/mbmon-${graph}-month.png' border='0' /><hr />";
+    print "<img src='/graphs/mbmon-${graph}-year.png' border='0' />";
   }
   else 
   {
     print $Lang::tr{'no information available'};
   }
-  
   &Header::closebox();
+  print "<div align='center'><table width='80%'><tr><td align='center'>";
+  print "<a href='/cgi-bin/mbmongraph.cgi'>";
+  print "$Lang::tr{'back'}</a></td></tr></table></div>\n";
+}
+elsif ($cgigraphs[1] =~ /(hdd)/) 
+{
+  my $graph = $cgigraphs[1];
+  my $graphname = $Lang::tr{"harddisk temperature"};
+  &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
+
+    if (-e "$graphdir/hddtemp-day.png")
+     {
+      my $ftime = localtime((stat("$graphdir/hddtemp-day.png"))[9]);
+      print "<center>";
+      print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br /><hr />\n";
+      print "<img src='/graphs/hddtemp-day.png' border='0' /><hr />";
+      print "<img src='/graphs/hddtemp-week.png' border='0' /><hr />";
+      print "<img src='/graphs/hddtemp-month.png' border='0' /><hr />";
+      print "<img src='/graphs/hddtemp-year.png' border='0' />";
+      if ( -e "/var/log/hddgraph_smartctl_out" ) 
+      {
+        my $output = `/bin/cat /var/log/hddgraph_smartctl_out`;
+        $output = &Header::cleanhtml($output);
+        print "<hr><pre>$output</pre>\n";
+      }
+    }
+    else 
+    {
+      print $Lang::tr{'no information available'};
+    }
+  &Header::closebox();
+  print "<div align='center'><table width='80%'><tr><td align='center'>";
+  print "<a href='/cgi-bin/mbmongraph.cgi'>";
+  print "$Lang::tr{'back'}</a></td></tr></table></div>\n";
+}
+else 
+{
+  if ( $mbmon_settings{'GRAPH_TEMP'} == 1 )
+  {
+    &Header::openbox('100%', 'center', "$Lang::tr{'mbmon temp'} $Lang::tr{'graph'}");
+    if (-e "$graphdir/mbmon-temp-day.png") 
+    {
+      my $ftime = localtime((stat("$graphdir/mbmon-temp-day.png"))[9]);
+      print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
+      print "<a href='/cgi-bin/mbmongraph.cgi?graph=temp'>";
+      print "<img src='/graphs/mbmon-temp-day.png' border='0' />";
+      print "</a>";
+    }
+    else 
+    {
+      print $Lang::tr{'no information available'};
+    }
+    print "<br />\n";
+    &Header::closebox();
+  }
+
+  if ( $mbmon_settings{'GRAPH_FAN'} == 1 )
+  {
+    &Header::openbox('100%', 'center', "$Lang::tr{'mbmon fan'} $Lang::tr{'graph'}");
+    if (-e "$graphdir/mbmon-fan-day.png") 
+    {
+      my $ftime = localtime((stat("$graphdir/mbmon-fan-day.png"))[9]);
+      print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
+      print "<a href='/cgi-bin/mbmongraph.cgi?graph=fan'>";
+      print "<img src='/graphs/mbmon-fan-day.png' border='0' />";
+      print "</a>";
+    }
+    else 
+    {
+      print $Lang::tr{'no information available'};
+    }
+    print "<br />\n";
+    &Header::closebox();
+  }
+
+  if ( $mbmon_settings{'GRAPH_VOLT'} == 1 )
+  {
+    &Header::openbox('100%', 'center', "$Lang::tr{'mbmon volt'} $Lang::tr{'graph'}");
+    if (-e "$graphdir/mbmon-volt-day.png") 
+    {
+      my $ftime = localtime((stat("$graphdir/mbmon-volt-day.png"))[9]);
+      print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
+      print "<a href='/cgi-bin/mbmongraph.cgi?graph=volt'>";
+      print "<img src='/graphs/mbmon-volt-day.png' border='0' />";
+      print "</a>";
+    } 
+    else 
+    {
+      print $Lang::tr{'no information available'};
+    }
+    print "<br />\n";
+    &Header::closebox();
+  }
+
+  if ( $mbmon_settings{'GRAPH_HDD'} == 1 )
+  {
+    &Header::openbox('100%', 'center', $Lang::tr{'harddisk temperature'});
+    if (-e "$graphdir/hddtemp-day.png")
+     {
+      my $ftime = localtime((stat("$graphdir/hddtemp-day.png"))[9]);
+      print "<center>";
+      print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br /><hr />\n";
+      print "<a href='/cgi-bin/hddgraph.cgi?graph=hdd'>";
+      print "<img src='/graphs/hddtemp-day.png' border='0' /><hr />";
+      print "</a>";
+    }
+    else 
+    {
+      print $Lang::tr{'no information available'};
+    }
+    print "<br />\n";
+    &Header::closebox();
+  }
+
+  &Header::openbox('100%', 'center', $Lang::tr{'settings'});
+print <<END
+<form method='post' action='$ENV{'SCRIPT_NAME'}'>
+<table width='100%'>
+<tr><td colspan='2'><input type='checkbox' name='TEMP' $selected_temp />&nbsp;$Lang::tr{'mbmon temp'} $Lang::tr{'graph'}</td></tr>
+<tr><td colspan='2'><input type='checkbox' name='FAN' $selected_fan />&nbsp;$Lang::tr{'mbmon fan'} $Lang::tr{'graph'}</td></tr>
+<tr><td colspan='2'><input type='checkbox' name='VOLT' $selected_volt />&nbsp;$Lang::tr{'mbmon volt'} $Lang::tr{'graph'}</td></tr>
+<tr><td colspan='2'><input type='checkbox' name='HDD' $selected_hdd />&nbsp;$Lang::tr{'harddisk temperature'}-$Lang::tr{'graph'}</td></tr>
+</table>
+<hr />
+<table width='100%' border='0' cellspacing='1' cellpadding='0'>
+<tr><td align='center' width='10%'><b>$Lang::tr{'mbmon display'}</b></td><td align='center' width='15%'>&nbsp;</td><td align='center' width='15%'><b>$Lang::tr{'mbmon value'}</b></td><td align='left'><b>$Lang::tr{'mbmon label'}</b></td></tr>
+END
+;
+
+my $i = 0;
+foreach $key ( sort(keys %mbmon_values) ) 
+{
+  if ( $i % 2 )
+  {
+    print("<tr bgcolor='$Header::table2colour'>");
+  }
+  else 
+  {
+    print("<tr bgcolor='$Header::table1colour'>");
+  }
+  $mbmon_settings{'LABEL-'.$key} = &Header::cleanhtml($mbmon_settings{'LABEL-'.$key});
+  print("<td align='center'><input type='checkbox' name='LINE-$key' $mbmon_graphs{$key}/></td>");
+  print("<td>$key</td><td align='center'>$mbmon_values{$key}</td>\n");
+  print("<td>&nbsp;<input type='text' name='LABEL-$key' value='$mbmon_settings{'LABEL-'.$key}' size='25' /></td></tr>\n");
+  $i++;
+}
+
+print <<END
+</table>
+
+<table width='100%'>
+<tr><td class='base' valign='top'>&nbsp;</td><td width='40%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td></tr>
+</table>
+
+</form>
+END
+;
+  &Header::closebox();
+}
+
+&Header::closebox();
 
 &Header::closebigbox();
 &Header::closepage();
index e127c395e5708e37a467d9bc363e6fe54fd9524d..66ba3247795d6780fe69057b1bb3357418618898 100644 (file)
 'urlfilter update information' => 'Eine aktualisierte Version steht zum Download bereit. Besuchen Sie <a href="http://www.urlfilter.net" target="_blank">http://www.urlfilter.net</a> für weitere Informationen.',
 'display webinterface effects' => 'Überblendeffekte einschalten',
 'outgoing firewall' => 'Ausgehende Firewall',
+'mbmon graphs' => 'mbmon-Diagramme',
+'mbmon settings' => 'mbmongraph Einstellungen',
+'mbmon display' => 'Anzeigen',
+'mbmon value' => 'Wert',
+'mbmon label' => 'Label',
+'mbmon fan' => 'Fan Speed',
+'mbmon fan in' => 'Fan Speed in',
+'mbmon temp' => 'Temperature',
+'mbmon temp in' => 'Temperature in',
+'mbmon volt' => 'Voltage',
 
 ); 
 
index ae7f14a9e8a4969ffd09f37a6782e7ef11ba9da5..c1bdf3ab6808b30fe385973f76b61039807e1edd 100644 (file)
 'urlfilter update information' => 'There is an updated version available for download. Visit <a href="http://www.urlfilter.net" target="_blank">http://www.urlfilter.net</a> for more information.',
 'display webinterface effects' => 'Activate effects',
 'outgoing firewall' => 'Outgoing Firewall',
+'mbmon graphs' => 'mbmon Graphs',
+'mbmon settings' => 'mbmongraph Settings',
+'mbmon display' => 'Display',
+'mbmon value' => 'Value',
+'mbmon label' => 'Label',
+'mbmon fan' => 'Fan Speed',
+'mbmon fan in' => 'Fan Speed in',
+'mbmon temp' => 'Temperature',
+'mbmon temp in' => 'Temperature in',
+'mbmon volt' => 'Voltage',
 
 );
index ac117420da3fe729edb5b7bd7bc0cafc982c1424..c34a4d090a05a7702576ca29ebace03aa9caebd0 100644 (file)
@@ -51,7 +51,7 @@ $(TARGET) :
 
        # Create all directories
        for i in addon-lang alcatelusb auth backup backup/sets ca certs cnx_pci crls ddns dhcp dhcpc dmzholes \
-           eagle-usb eciadsl ethernet isdn key langs logging main modem net-traffic nfs optionsfw outgoing patches pakfire portfw \
+           eagle-usb eciadsl ethernet isdn key langs logging main mbmon modem net-traffic nfs optionsfw outgoing patches pakfire portfw \
            ppp private proxy/advanced qos/bin red remote snort time urlfilter/autoupdate urlfilter/bin vpn wireless xtaccess ; do \
                mkdir -p $(CONFIG_ROOT)/$$i; \
        done
@@ -77,6 +77,7 @@ $(TARGET) :
        cp $(DIR_SRC)/config/cfgroot/backup-include             $(CONFIG_ROOT)/backup/include.system
        cp $(DIR_SRC)/config/cfgroot/backup-exclude.hardware    $(CONFIG_ROOT)/backup/exclude.hardware
        cp $(DIR_SRC)/config/cfgroot/advoptions-list            $(CONFIG_ROOT)/dhcp/advoptions-list
+       cp $(DIR_SRC)/config/cfgroot/mbmon-settings             $(CONFIG_ROOT)/mbmon/settings
        cp $(DIR_SRC)/config/cfgroot/modem-defaults             $(CONFIG_ROOT)/modem/defaults
        cp $(DIR_SRC)/config/cfgroot/modem-settings             $(CONFIG_ROOT)/modem/settings
        cp $(DIR_SRC)/config/cfgroot/net-traffic-lib.pl         $(CONFIG_ROOT)/net-traffic/net-traffic-lib.pl
index 930202cd18bfb281349a7b7c218fce415544848c..f18e44a7dfb099dc50e1da89e53ca3f2ad39983f 100644 (file)
@@ -55,9 +55,6 @@ download :$(patsubst %,$(DIR_DL)/%,$(objects))
 
 md5 : $(subst %,%_MD5,$(objects))
 
-dist: 
-       make-packages.sh hddtemp $(THISAPP)
-
 ###############################################################################
 # Downloading, checking, md5sum
 ###############################################################################
@@ -79,7 +76,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
        cd $(DIR_APP) && cp -fv $(DIR_DL)/hddtemp.db /etc/hddtemp.db
-       cd $(DIR_APP) && ./configure --with-db-path=/etc/hddtemp.db
+       cd $(DIR_APP) && ./configure --prefix=/usr --with-db-path=/etc/hddtemp.db
        cd $(DIR_APP) && make && make install
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
diff --git a/lfs/mbmon b/lfs/mbmon
new file mode 100644 (file)
index 0000000..57bffcc
--- /dev/null
+++ b/lfs/mbmon
@@ -0,0 +1,80 @@
+###############################################################################
+# This file is part of the IPCop Firewall.                                    #
+#                                                                             #
+# IPCop 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.                                         #
+#                                                                             #
+# IPCop 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 IPCop; if not, write to the Free Software                        #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    #
+#                                                                             #
+# Makefiles are based on LFSMake, which is                                    #
+# Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com>                        #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER        = 205
+
+THISAPP    = xmbmon$(VER)
+DL_FILE    = $(THISAPP).tar.gz
+DL_FROM    = $(URL_IPFIRE)
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+TARGET     = $(DIR_INFO)/$(THISAPP)
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = ab6614c785f5b653fcc69fb9c02058f0
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+       @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+       @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+       @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+       @$(PREBUILD)
+       @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && ./configure --prefix=/usr
+       cd $(DIR_APP) && make PROGRAM=mbmon
+       cd $(DIR_APP) && install -o root -g wheel -m 4555 -c -p mbmon /usr/bin
+       cd $(DIR_APP) && install -o root -g wheel -m 444 -c -p mbmon.1 /usr/man/man1
+       @rm -rf $(DIR_APP)
+       @$(POSTBUILD)
diff --git a/lfs/smartmontools b/lfs/smartmontools
new file mode 100644 (file)
index 0000000..bf394c9
--- /dev/null
@@ -0,0 +1,79 @@
+###############################################################################
+# This file is part of the IPCop Firewall.                                    #
+#                                                                             #
+# IPCop 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.                                         #
+#                                                                             #
+# IPCop 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 IPCop; if not, write to the Free Software                        #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    #
+#                                                                             #
+# Makefiles are based on LFSMake, which is                                    #
+# Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com>                        #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER        = 5.36
+
+THISAPP    = smartmontools-$(VER)
+DL_FILE    = $(THISAPP).tar.gz
+DL_FROM    = $(URL_IPFIRE)
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+TARGET     = $(DIR_INFO)/$(THISAPP)
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = 2e424f2d35efa38a29ebca419c1dbe3c
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+       @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+       @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+       @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+       @$(PREBUILD)
+       @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+       cd $(DIR_APP) && ./configure --prefix=/usr
+       cd $(DIR_APP) && make
+       cd $(DIR_APP) && make install
+       @rm -rf $(DIR_APP)
+       @$(POSTBUILD)
diff --git a/make.sh b/make.sh
index 86c9dbaba2afa0d905e5943188cee040fcba1ceb..c8c4adeafdf103d863e33cd571af0a993f90ca85 100644 (file)
--- a/make.sh
+++ b/make.sh
@@ -741,6 +741,7 @@ buildipcop() {
   ipcopmake portmap
   ipcopmake nfs
   ipcopmake nmap
+  ipcopmake mbmon
   ipcopmake iftop
   ipcopmake ncftp
   ipcopmake cftp
@@ -1211,6 +1212,12 @@ pub-paks)
                echo -e "There was an error while uploading the packages to the ftp server."
        fi
        ;;
+build-only)
+       rm -f $BASEDIR/log/$2*
+       BUILDMACHINE=`uname -m`
+       prepareenv
+       ipcopmake $2
+       ;;
 *)
        echo "Usage: $0 {build|changelog|check|checkclean|clean|commit|diff|dist|gettoolchain|make|newpak|prefetch|pub-iso|pub-paks|shell|sync|toolchain|update}"
        cat doc/make.sh-usage
index 7e8742985592c6cf7cb31d4c67abe33063cc067e..53bf0df38d7178171191337621df437c9b607160 100644 (file)
@@ -27204,6 +27204,10 @@ usr/lib/liblzo2.so.2.0.0
 usr/bin/wget
 usr/etc/wgetrc
 ##
+## xmbmon205
+/usr/bin/mbmon
+##
+##
 ## mc
 ##
 usr/bin/mc
@@ -27736,3 +27740,38 @@ usr/lib/libgthread-2.0.so.0.902.4
 #usr/share/man/man1/glib-gettextize.1
 #usr/share/man/man1/glib-mkenums.1
 #usr/share/man/man1/gobject-query.1
+##
+## hddtemp
+##
+etc/hddtemp.db
+usr/sbin/hddtemp
+#usr/share/locale/fr/LC_MESSAGES/hddtemp.mo
+#usr/share/locale/ru/LC_MESSAGES/hddtemp.mo
+#usr/share/man/man8/hddtemp.8
+##
+## smartmontools-5.36
+##
+#usr/etc/rc.d
+#usr/etc/rc.d/init.d
+#usr/etc/rc.d/init.d/smartd
+#usr/etc/smartd.conf
+usr/sbin/smartctl
+#usr/sbin/smartd
+#usr/share/doc/smartmontools-5.36
+#usr/share/doc/smartmontools-5.36/AUTHORS
+#usr/share/doc/smartmontools-5.36/CHANGELOG
+#usr/share/doc/smartmontools-5.36/COPYING
+#usr/share/doc/smartmontools-5.36/INSTALL
+#usr/share/doc/smartmontools-5.36/NEWS
+#usr/share/doc/smartmontools-5.36/README
+#usr/share/doc/smartmontools-5.36/TODO
+#usr/share/doc/smartmontools-5.36/WARNINGS
+#usr/share/doc/smartmontools-5.36/examplescripts
+#usr/share/doc/smartmontools-5.36/examplescripts/Example1
+#usr/share/doc/smartmontools-5.36/examplescripts/Example2
+#usr/share/doc/smartmontools-5.36/examplescripts/Example3
+#usr/share/doc/smartmontools-5.36/examplescripts/README
+#usr/share/doc/smartmontools-5.36/smartd.conf
+#usr/share/man/man5/smartd.conf.5
+#usr/share/man/man8/smartctl.8
+#usr/share/man/man8/smartd.8
index ba0f7891d50135d23fe1db548a75fb84b038128a..bcac55346d366eec28aefbbea59cb17753adb826 100644 (file)
@@ -31,6 +31,10 @@ require "${General::swroot}/lang.pl";
 
 my (%settings, @ipacsum, $iface, $ERROR);
 &General::readhash("${General::swroot}/ethernet/settings", \%settings);
+my %mbmon_settings = ();
+&General::readhash("${General::swroot}/mbmon/settings", \%mbmon_settings);
+
+
 
 # Added for conversion of utf-8 characters
 use Encode 'from_to';
@@ -57,6 +61,41 @@ my $graphs = "/home/httpd/html/graphs";
 $ENV{PATH}="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin";
 my $hdd_device = "/dev/harddisk";
 my $temp = '';
+my %mbmon_values = ();
+my $key;
+my $value;
+my @args = ();
+my $count = 0;
+my $ERROR;
+my $dbg = 0;
+my $path_rrd = "/var/log/rrd";
+my $path_graphs = "/home/httpd/html/graphs";
+my $path_smartctl = "/usr/sbin/smartctl";
+
+my %colors = ();
+$colors{"1"} = "#0000FF";
+$colors{"2"} = "#00FF00";
+$colors{"3"} = "#FF0000";
+$colors{"4"} = "#FFD700";
+$colors{"5"} = "#CCCCCC";
+$colors{"6"} = "#40E0D0";
+$colors{"7"} = "#90EE90";
+$colors{"8"} = "#F4A460";
+
+open(MBMON_OUT, ">/var/log/mbmon-values");
+open(FD, "/usr/bin/mbmon -rc1|" ) || die "ERROR: Cannot run mbmon\n" ;
+
+while( $_ = <FD> ) 
+{
+  next unless( /^([A-Za-z][^:\s]+)\s*:\s*([+\-]{0,1}[\d\.]+)/ ) ;
+  $key = $1 ;
+  $value = $2 ;
+  $key =~ y/A-Z/a-z/ ;
+  $mbmon_values{$key} = $value;
+  print(MBMON_OUT "$key=$value\n");
+}
+close(FD);
+close(MBMON_OUT);
 
 sub gettraffic {
        my $interface = $_[0];
@@ -676,10 +715,10 @@ sub updatelqgraph {
 
 sub updatehdddata 
 {
-  if ( ! -e "$rrdlog/hddtemp.rrd") 
+  if ( ! -e "$path_rrd/hddtemp.rrd") 
   {
     # database did not exist -> create
-    RRDs::create ("$rrdlog/hddtemp.rrd", "--step=300",
+    RRDs::create ("$path_rrd/hddtemp.rrd", "--step=300",
       "DS:temperature:GAUGE:600:0:100",
       "RRA:AVERAGE:0.5:1:576",
       "RRA:AVERAGE:0.5:6:672",
@@ -689,35 +728,60 @@ sub updatehdddata
     print "Error in RRD::create for hdd: $ERROR\n" if $ERROR;
   }
 
-  my $hdd_output = `/usr/sbin/hddtemp -qn $hdd_device`;
-
-  # I know 4 response possible responses:
-  #
-  # /dev/harddisk: harddisk type: S.M.A.R.T. not available
-  # /dev/harddisk: harddisk type: no sensor
-  # /dev/harddisk: harddisk type: 37°C or °F
-  # 37
+  $temp = 0;
+  my $hdd_output = '';
+  my $smart_output = '';
 
-  if ( index($hdd_output, "S.M.A.R.T.") != -1 )
+  if ( -e "$path_smartctl" )
   {
-    $temp = 0;
+    system("$path_smartctl -iHA $hdd_device > /var/log/hddgraph_smartctl_out");
   }
-  elsif ( index($hdd_output, "no sensor") != -1 )
+
+  if ( -e "$path_hddtemp" )
   {
-    $temp = 1;
+    $hdd_output = `$path_hddtemp -qn $hdd_device`;
+
+    # I know 4 response possible responses:
+    #
+    # /dev/harddisk: harddisk type: S.M.A.R.T. not available
+    # /dev/harddisk: harddisk type: no sensor
+    # /dev/harddisk: harddisk type: 37°C or °F
+    # 37
+
+    if ( index($hdd_output, "S.M.A.R.T.") != -1 )
+    {
+      $temp = 0;
+    }
+    elsif ( index($hdd_output, "no sensor") != -1 )
+    {
+      $temp = 1;
+    }
+    elsif ( index($hdd_output, "$hdd_device") != -1 )
+    {
+      $hdd_output =~ /.*:.*:\s*(\d+).*\s/;
+      $temp = $1;
+    }
+    else
+    {
+      $hdd_output =~ /(\d+)\s/;
+      $temp = $1;
+    }
   }
-  elsif ( index($hdd_output, "$hdd_device") != -1 )
+  elsif ( -e "/var/log/hddgraph_smartctl_out" )
   {
-    $hdd_output =~ /.*:.*:\s*(\d+).*\s/;
-    $temp = $1;
+    $hdd_output = `cat /var/log/hddgraph_smartctl_out | grep Temperature_`;
+    my @t = split(/\s+/,$hdd_output);
+    $temp = $t[9];
   }
   else
   {
-    $hdd_output =~ /(\d+)\s/;
-    $temp = $1;
+    $temp = 0;
   }
 
-  RRDs::update ("$rrdlog/hddtemp.rrd", "-t", "temperature", "N:$temp");
+#  print "hdd  $hdd_output \n";
+#  print "temp $temp \n";
+
+  RRDs::update ("$path_rrd/hddtemp.rrd", "-t", "temperature", "N:$temp");
 
   $ERROR = RRDs::error;
   print "Error in RRD::update for hdd: $ERROR\n" if $ERROR;
@@ -743,6 +807,173 @@ sub updatehddgraph {
   print "Error in RRD::graph for cpu: $ERROR\n" if $ERROR;
 }
 
+sub updatembmondata 
+{
+  if ( ! -e "$path_rrd/mbmon.rrd" )
+  {
+    # database did not exist -> create
+
+    @args = ("$path_rrd/mbmon.rrd");
+
+    push(@args, "--step=300");
+    foreach $key ( sort(keys %mbmon_values) ) 
+    {
+      push(@args, "DS:$key:GAUGE:600:U:U");
+    }
+    push(@args, "RRA:AVERAGE:0.5:1:576");
+    push(@args, "RRA:AVERAGE:0.5:6:672");
+    push(@args, "RRA:AVERAGE:0.5:24:732");
+    push(@args, "RRA:AVERAGE:0.5:144:1460");
+
+    print("create ". join( ", ", @args)) if ( $dbg );
+   
+    RRDs::create (@args);
+    $ERROR = RRDs::error;
+    print("Error in RRD::create for mbmon: $ERROR\n") if $ERROR;
+  }
+
+  my @ds;
+  my @val;
+  my $template;
+
+  foreach $key ( sort(keys %mbmon_values) )
+  {
+    push(@ds, $key);
+    push(@val, $mbmon_values{$key});
+  }
+
+  $template = join(':', @ds);
+  $value    = "N:".join(':', @val);
+
+  print("update template = '$template'\n") if ( $dbg );
+  print("update value    = '$value'\n") if ( $dbg );
+
+  RRDs::update("$path_rrd/mbmon.rrd", "-t", $template, $value);
+  $ERROR = RRDs::error;
+  print("Error in RRD::update for mbmon: $ERROR\n") if $ERROR;
+}
+
+sub updatetempgraph
+{
+  my $type   = "temp";
+  my $period = $_[0];
+
+  @args = ("$path_graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
+    "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
+    "--color", "SHADEA#EAE9EE",
+    "--color", "SHADEB#EAE9EE",
+    "--color", "BACK#EAE9EE",
+    "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
+
+  $count = 1;
+  foreach $key ( sort(keys %mbmon_values) ) 
+  {
+    if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
+    {
+      if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
+      {
+        $mbmon_settings{'LABEL-'.$key} = $key;
+      }
+
+      push(@args, "DEF:$key=$path_rrd/mbmon.rrd:$key:AVERAGE");
+      push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} $tr{'mbmon temp in'} °C");
+      push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.1lf °C");
+      push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.1lf °C");
+      push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.1lf °C\\j");
+
+      $count++;
+    }
+  }
+
+  if ( $count > 1 )
+  {
+    RRDs::graph ( @args );
+    $ERROR = RRDs::error;
+    print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
+  }
+}
+
+sub updatefangraph
+{
+  my $type   = "fan";
+  my $period = $_[0];
+
+  @args = ("$path_graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
+    "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
+    "--color", "SHADEA#EAE9EE",
+    "--color", "SHADEB#EAE9EE",
+    "--color", "BACK#EAE9EE",
+    "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
+
+  $count = 1;
+  foreach $key ( sort(keys %mbmon_values) ) 
+  {
+    if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
+    {
+      if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
+      {
+        $mbmon_settings{'LABEL-'.$key} = $key;
+      }
+
+      push(@args, "DEF:$key=$path_rrd/mbmon.rrd:$key:AVERAGE");
+      push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} $tr{'mbmon fan in'} rpm");
+      push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.0lf rpm");
+      push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.0lf rpm");
+      push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.0lf rpm\\j");
+
+      $count++;
+    }
+  }
+
+  if ( $count > 1 )
+  {
+    RRDs::graph ( @args );
+    $ERROR = RRDs::error;
+    print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
+  }
+}
+
+sub updatevoltgraph
+{
+  my $type   = "volt";
+  my $period = $_[0];
+
+  @args = ("$path_graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
+    "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
+    "--color", "SHADEA#EAE9EE",
+    "--color", "SHADEB#EAE9EE",
+    "--color", "BACK#EAE9EE",
+    "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
+
+  $count = 1;
+  foreach $key ( sort(keys %mbmon_values) ) 
+  {
+    my $v = substr($key,0,1);
+    if ( ($v eq 'v') && ($mbmon_settings{'LINE-'.$key} eq 'on') )
+    {
+      if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
+      {
+        $mbmon_settings{'LABEL-'.$key} = $key;
+      }
+
+      push(@args, "DEF:$key=$path_rrd/mbmon.rrd:$key:AVERAGE");
+      push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} V");
+      push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.2lf V");
+      push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.2lf V");
+      push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.2lf V\\j");
+
+      $count++;
+    }
+  }
+
+  if ( $count > 1 )
+  {
+    RRDs::graph ( @args );
+    $ERROR = RRDs::error;
+    print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
+  }
+}
+
 ## Update ipac logs
 system ('/usr/sbin/fetchipac');
 sleep 8;
@@ -929,6 +1160,30 @@ updatehddgraph ("week");
 updatehddgraph ("month");
 updatehddgraph ("year");
 
+updatembmondata();
+
+if ( $mbmon_settings{'GRAPH_TEMP'} == 1 )
+{
+  updatetempgraph ("day");
+  updatetempgraph ("week");
+  updatetempgraph ("month");
+  updatetempgraph ("year");
+}
+if ( $mbmon_settings{'GRAPH_TEMP'} == 1 )
+{
+  updatefangraph ("day");
+  updatefangraph ("week");
+  updatefangraph ("month");
+  updatefangraph ("year");
+}
+if ( $mbmon_settings{'GRAPH_VOLT'} == 1 )
+{
+  updatevoltgraph ("day");
+  updatevoltgraph ("week");
+  updatevoltgraph ("month");
+  updatevoltgraph ("year");
+}
+
 ###
 ### Network Graphs
 ###
@@ -971,7 +1226,6 @@ if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ && -e "$rrdlog/BLUE.rrd") {
        updateifgraph ("BLUE", "year");
 }
 
-#chmod 777 /home/httpd/html/{graphs,sgraph} -R
 system("chmod -R 0777 /home/httpd/html/graphs");
 system("chmod -R 0777 /home/httpd/html/sgraph");