]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/scripts/makegraphs
Und wieder ein commit da ich heute so fleissig bin :D
[ipfire-2.x.git] / src / scripts / makegraphs
index c6b94ec93db6243a0473b609d257980331b2e039..4e22159457f2f10ef222e06a65a3bb74f7249dc1 100644 (file)
@@ -376,13 +376,25 @@ sub updatelq {
         my $roundtrip=0;
         my $test=0;
 #       LQ_GATEWAY is the ip of your isp's public ip facing you
-        my $LQ_GATEWAY=`netstat -rn | grep ^0.0.0.0 | awk '{print \$2}'`;
-        my $NUMPINGS=10;
-        my $pingoutput = `ping -c $NUMPINGS -q $LQ_GATEWAY`;
-        chomp;
+        my $LQ_GATEWAY=`cat /var/ipfire/red/remote-ipaddress`;
+        chomp($LQ_GATEWAY);
+        my $NUMPINGS=5;
+        my $pingoutput = `/usr/bin/ping -w 10 -c $NUMPINGS -q $LQ_GATEWAY | tail -2`;
         my @temp = split (/\/|\%|\s/, $pingoutput);
-        $packetloss   = $temp[17];
-        $roundtrip    = $temp[28];
+        $packetloss = $temp[5];
+        $roundtrip = $temp[17];
+        
+        print "Paketlos->".$packetloss."<-Roundtrip->".$roundtrip."<-\n";
+       
+        if ( $packetloss eq "100" ){
+        my $pingoutput = `/usr/bin/ping -w 10 -c $NUMPINGS -q ping.ipfire.org  | tail -2`;
+        my @temp = split (/\/|\%|\s/, $pingoutput);
+        $packetloss = $temp[5];
+        $roundtrip = $temp[17];
+        
+        print "Paketlos->".$packetloss."<-Roundtrip->".$roundtrip."<-\n";
+        }
+        
         RRDs::update ("$rrdlog/lq.rrd", "N:$packetloss:$roundtrip");
         $ERROR = RRDs::error;
         print "Error in RRD::update for line quality: $ERROR\n" if $ERROR;
@@ -407,7 +419,7 @@ sub updatehdddata
   $temp = 0;
   my $hdd_output = '';
   my $smart_output = '';
-
+  
   if ( -e "$path_smartctl" )
   {
     system("$path_smartctl -iHA /dev/$disk > /var/log/smartctl_out_hddtemp-$disk");
@@ -416,7 +428,7 @@ sub updatehdddata
   if ( -e "$path_hddtemp" )
   {
     $hdd_output = `$path_hddtemp -qn /dev/$disk`;
-
+    
     # I know 4 response possible responses:
     #
     # /dev/harddisk: harddisk type: S.M.A.R.T. not available
@@ -453,12 +465,11 @@ sub updatehdddata
   {
     $temp = 0;
   }
+  
 
-#  print "hdd  $hdd_output \n";
-#  print "temp $temp \n";
+  print "Temperature for ".$disk."->".$temp."<-\n";
 
   RRDs::update ("$rrdlog/hddtemp-$disk.rrd", "-t", "temperature", "N:$temp");
-
   $ERROR = RRDs::error;
   print "Error in RRD::update for hdd-$disk: $ERROR\n" if $ERROR;
 }
@@ -549,6 +560,10 @@ updatecpudata();
 updateloaddata();
 updatememdata();
 
+###
+### HDD graphs
+###
+
 my @disks = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
 print "\nFound following amount of disks:".@disks."\n";
 foreach (@disks){
@@ -556,6 +571,7 @@ my $disk = $_;
 chomp $disk;
 print "Working on disk ".$disk.".\n";
 updatediskdata($disk);
+updatehdddata($disk);
 }
 
 ###
@@ -569,16 +585,9 @@ updatefwhitsdata();
 updatelq();
 
 ###
-### HDDTEMP-Graphs for /dev/harddisk
+### Mbmon Data
 ###
-
-my @disks = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
-print "\nFound following amount of disks for hddtemp:".@disks."\n";
-foreach (@disks){
-my $disk = $_;
-chomp $disk;
-updatehdddata ($disk);
-}
+updatembmondata();
 
 ###
 ### Network Graphs