]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
update hmon scripts
authorHadaq Hades <hadaq@lxhadesdaq>
Sat, 23 Jun 2018 17:42:11 +0000 (19:42 +0200)
committerHadaq Hades <hadaq@lxhadesdaq>
Sat, 23 Jun 2018 17:42:11 +0000 (19:42 +0200)
14 files changed:
hmon/HPlot.pm
hmon/QA.pm
hmon/hmon_busynew.pl
hmon/hmon_eb_rate.pl
hmon/hmon_ecalrate.pl [new file with mode: 0755]
hmon/hmon_gberate.pl
hmon/hmon_readoutstuck.pl
hmon/hmon_richrate.pl
hmon/index.cgi
hmon/permanent/hmon_cpu.pl
hmon/permanent/hmon_hub.pl
hmon/permanent/hmon_richTempHisto.pl [new file with mode: 0755]
hmon/permanent/hmon_richhv.pl
hmon/styles.css

index 0d8124f77abba8301ca9720a10ed48f6eae122b6..394a345ea94b9f626b6ea6e73373837679e0a292 100755 (executable)
@@ -193,6 +193,7 @@ sub PlotInit {
   elsif ($p->{$name}->{type} == TYPE_HEATMAP) {
     plot_write($fh,"set view map");
     plot_write($fh,"set palette rgbformulae 22,13,-31");
+    plot_write($fh,$p->{$name}{additional});
     if ($p->{$name}->{showvalues} == 0) {
       #plot_write($fh,"splot '-' matrix with image");
       $p->{$name}->{plot_string} .= "plot '-' matrix with image \n"
index 33026103bafd95f47fee0b24366c47db859774d9..82590b6f258344f050699a08d322526f992f902e 100644 (file)
@@ -76,7 +76,7 @@ our @MdcOepLimits     = (372, 372-1, 372-3);
 our @MdcVoltageLimits = (50, 60, 100);
 our @MdcLockLimits    = (0, 3, 5);
 our @MdcTempLimits    = (75, 80, 85);
-our @RichInnerTempLimits = (29,30,31);
+our @RichInnerTempLimits = (31,32,33);
 our @TrgErrLimits     = (100, 1000, 10000);
 our @CPULimits        = (95, 100, 100);
 our @TimeoutLimits    = (0, 0, 1);
@@ -271,6 +271,7 @@ sub SciNotation {
     return  sprintf("%ik", $v / 1000.) if (abs($v) < 1E6) ;
     return  sprintf("%.1fM", $v / 1000000.) if (abs($v) < 20E6) ;
     return  sprintf("%iM", $v / 1000000.) if (abs($v) < 1E9) ;
+    return  sprintf("%.2fG", $v / 1E9) if (abs($v) < 20E9) ;
     return  sprintf("%i",$v);
     }
   else {
index f31038750a326cf850cd2bfdb4bf3086d08d3471..841d387b86bb2d36df4df1a31f4b8e8b3f6ebc2b 100755 (executable)
@@ -173,7 +173,7 @@ while (1) {
       }
     unless($iter % 8) {
       HPlot::PlotDraw('BusyTimes');
-      my $maxpercent = max($diff->{0x8000}->[0],$diff->{0x8000}->[1],$diff->{0x8000}->[2],$diff->{0x8000}->[3],$diff->{0x8000}->[5],$diff->{0x8000}->[6],$diff->{0x8000}->[7],$diff->{0x8000}->[9],);
+      my $maxpercent = max(@{$diff->{0x8000}});
       my $msgstr = sprintf("%3.1f%%",$maxpercent);
       my $qastate = QA::OK;
       $qastate = QA::ERROR if ($maxpercent > 99);
index 7c32bbc1f20f6d8d8bea115d655764261742b44b..c129b419261c661115943061019bed773092899d 100755 (executable)
@@ -9,8 +9,8 @@ use QA;
 use Perl2Epics;
 use HADES::TrbNet;
 
-my $SLEEP_TIME = 0.5;   # in seconds
-my $NUM_AVERAGES = 10;
+my $SLEEP_TIME = 1;   # in seconds
+my $NUM_AVERAGES = 5;
 my $offset = 2;
 my $last_rate_endp = 0;
 my $opt_addr = 3;    #CTS 
diff --git a/hmon/hmon_ecalrate.pl b/hmon/hmon_ecalrate.pl
new file mode 100755 (executable)
index 0000000..d292311
--- /dev/null
@@ -0,0 +1,140 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Data::Dumper;
+use Data::TreeDumper;
+use Hmon;
+use QA;
+use HADES::TrbNet;
+use HPlot;
+use Time::HiRes qw(usleep time);
+use List::Util qw[min max];
+
+for my $i (0..5) {
+  HPlot::PlotInit( {
+  name    => "EcalRateFast$i",
+  file    => "files/EcalRateFast$i",
+  title   => "",
+  entries => 21,
+  curves  => 8,
+  type    => HPlot::TYPE_HEATMAP,
+  output  => HPlot::OUT_PNG,
+  zlabel  => "Hitrate",
+  sizex   => 400,
+  sizey   => 150,
+  nokey   => 1,
+  buffer  => 1,
+  xmin    => -0.5,
+  xmax    => 20.5,
+  ymin    => 7.5,
+  ymax    => -0.5,
+  cbmax   => "100<*<100000",
+  cbmin   => 0,
+  noinit  => 1,
+  additional => "set logscale cb;",
+  showvalues => 0,  });
+  }
+for my $i (0..5) {
+  HPlot::PlotInit( {
+  name    => "EcalRateSlow$i",
+  file    => "files/EcalRateSlow$i",
+  title   => "",
+  entries => 21,
+  curves  => 8,
+  type    => HPlot::TYPE_HEATMAP,
+  output  => HPlot::OUT_PNG,
+  zlabel  => "Hitrate",
+  sizex   => 400,
+  sizey   => 150,
+  nokey   => 1,
+  buffer  => 1,
+  xmin    => -0.5,
+  xmax    => 20.5,
+  ymin    => 7.5,
+  ymax    => -0.5,
+  cbmax   => "100<*<100000",
+  cbmin   => 0,
+  noinit  => 1,
+  additional => "set logscale cb;",
+  showvalues => 0,  });
+  }
+for my $i (0..5) {
+  HPlot::PlotInit( {
+  name    => "EcalRateDiff$i",
+  file    => "files/EcalRateDiff$i",
+  title   => "",
+  entries => 21,
+  curves  => 8,
+  type    => HPlot::TYPE_HEATMAP,
+  output  => HPlot::OUT_PNG,
+  zlabel  => "Hit ratio",
+  sizex   => 400,
+  sizey   => 150,
+  nokey   => 1,
+  buffer  => 1,
+  xmin    => -0.5,
+  xmax    => 20.5,
+  ymin    => 7.5,
+  ymax    => -0.5,
+  cbmax   => "1.1<*<10",
+  cbmin   => "0.1<*<0.9",
+  noinit  => 0,
+  showvalues => 0,  });
+  }  
+  
+my $str  = Hmon::MakeTitle(16, 20, "ECal Hit Rate",0);
+for my $i (0..5) {
+  $str .= qq@<img src="%ADDPNG files/EcalRateFast$i.png%" type="image/png">\n
+             <img src="%ADDPNG files/EcalRateSlow$i.png%" type="image/png">\n
+             <img src="%ADDPNG files/EcalRateDiff$i.png%" type="image/png"><br>\n@;
+  };
+$str .="left:fast channel, middle:slow channel. right: ratio fast/slow.<br>Sectors from top to bottom. x-axis Padiwa 0..21, y-axis channel #";  
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("ECalRate",$str);
+
+
+my $old;
+my $oldtime = time();
+my $time = time();
+my $diff;
+my $iter = 0;
+
+trb_init_ports() or die trb_strerror();
+
+
+while(1) {
+  my $o = trb_register_read_mem(0xfe71,0xc000,0,49) or die trb_strerror() or sleep 5 and next;
+
+  if (defined $old) {
+    my $tdiff = time() - $oldtime;
+    foreach my $b (keys %$o) {
+      my $sec  = ($b>>4) & 0x7;
+      for my $v (0..23) {
+        my $xpos =  ($b&0xF)*3 + int($v/8);
+        
+        my $vdiff = ($o->{$b}->[$v*2+1]&0xffffff) - ($old->{$b}->[$v*2+1]&0xffffff);
+        if ($vdiff < 0) { $vdiff += 2**24;}
+        $diff->{$b}->[$v*2+1] = $vdiff/($tdiff|1);
+
+        $vdiff = ($o->{$b}->[$v*2+2]&0xffffff) - ($old->{$b}->[$v*2+2]&0xffffff);
+        if ($vdiff < 0) { $vdiff += 2**24;}
+        $diff->{$b}->[$v*2+2] = $vdiff/($tdiff|1);
+
+        my $ratio = ($diff->{$b}->[$v*2+1]||0) / ($diff->{$b}->[$v*2+2]||1);
+        
+        HPlot::PlotFill('EcalRateFast'.$sec,$diff->{$b}->[$v*2+1],$xpos,$v % 8);
+        HPlot::PlotFill('EcalRateSlow'.$sec,$diff->{$b}->[$v*2+2],$xpos,$v % 8);
+        HPlot::PlotFill('EcalRateDiff'.$sec,$ratio,$xpos,$v % 8);
+        }
+      }
+    for my $i (0..5) {    
+      HPlot::PlotDraw('EcalRateFast'.$i);    
+      HPlot::PlotDraw('EcalRateSlow'.$i);    
+      HPlot::PlotDraw('EcalRateDiff'.$i);    
+      }
+    }
+  $old = $o;
+  $oldtime = time();
+  sleep 2;
+  }
index 5128499d7a98e2b67dcaa77cccc9fac8dd776257..0e4300ee19cdbbebc05c2602883afbe05fd8e0b2 100755 (executable)
@@ -12,7 +12,7 @@ my $str;
   Hmon::WriteFile("GbeRate",$str);
 
 
-system('./hmon_hadplot.sh -yscale 1024 -yoverflow 4096 -ytitle "Data Rate [MiB]" -ymax 52  -output "PNG.files/gberate.460.265" gberate &');
+system('./hmon_hadplot.sh -yscale 1024 -yoverflow 4096 -ytitle "Data Rate [MiB]" -ymax 102  -output "PNG.files/gberate.460.265" gberate &');
 
 
 #
index 3236779668c8c8a3188f5ffafce1c0b7af53cada..305c1cdcb5ae6d75b8982ee7992b249afffdab34 100755 (executable)
@@ -33,11 +33,14 @@ sub isFeeHub {
   return 0;
 }
 
-
+my $oldgberate;
 while (1) {
   my $boardlist = "";
   my $rh_status    = trb_register_read(0x0003, 0xa0f8) or sleep 5 and next;
   my $rh_evts      = trb_register_read(0x0002, 0x0001) or sleep 5 and next;
+  my $gbe_rate     = trb_register_read(0xff7f, 0x83f3) or sleep 5 and next;
+#   $regoffset   = [10];
+#   $regwidth    = [22]; 
   
   $rate = (($rh_evts->{2} || 0) & 0xffff) - $evtnum;
   while ($rate < 0) {$rate += 2**16;}
@@ -47,6 +50,17 @@ while (1) {
   my $status = "";
   my $longmsg = "Read-out has no error";
 
+  my $gbesum = 0;
+  if($oldgberate) {
+    foreach my $h (keys %{$gbe_rate}) {
+      my $t = ($gbe_rate->{$h} - $oldgberate->{$h});
+      $t += 2**32 if $t < 0;
+      $gbesum += $t;
+      }
+    $status = QA::SciNotation($gbesum)."B/s";
+    }
+  $oldgberate = $gbe_rate;
+  
   if($rate == 0 && ($rh_status->{3} & (1 << 31)) && ($rh_status->{3} & 0x3ff00000)) {
     my $rh_hubs = trb_register_read(0xfffe,0x81) or sleep 5 and next;
     foreach my $h (sort keys %$rh_hubs) {
@@ -70,5 +84,5 @@ while (1) {
   
   QA::WriteQALog($fqa, "daq", "readout", 30, $qastate,"Read-out", $status,$longmsg);    
 #   print $qastate." ".$status." ".$longmsg."\n";
-  sleep(5);
+  sleep(1);
   }
index 1bd86cac64e543714ba874d5c8f4d2ef7368af85..0b3c04628453dd9eacee2f5055f3c2f7820bc0dd 100755 (executable)
@@ -106,7 +106,7 @@ showvalues => 0,  };
 HPlot::PlotInit($plot0);
 
 
-my $str  = Hmon::MakeTitle(20, 17, "RICH Hit Rate");
+my $str  = Hmon::MakeTitle(20, 17, "RICH Hit Rate",0);
 $str .= qq@<img src="%ADDPNG files/RichRateQ0.png%" type="image/png"><br>\n@;
 $str .= qq@<img src="%ADDPNG files/RichRateQ1.png%" type="image/png"><br>\n@;
 $str .= qq@<img src="%ADDPNG files/RichRateQ2.png%" type="image/png"><br>\n@;
index 3479a25b9ecf632ff382f05e672e43b5909d79fa..27df16fc11e7323e4261161edf01568ec454561c 100755 (executable)
@@ -31,12 +31,13 @@ function openwin(url) {
 <li style="width:600px;"><a href="monitor.cgi?3-window-logfile">Logfile (most important messages)</a></li>
 <li style="width:600px;"><a href="monitor.cgi?10-window-chat">Chat Log</a></li>
 <li style="width:600px;"><a href="http://cerberus.x-matter.uni-frankfurt.de:8888/daqtools/index.pl" target="_blank">Web Tools</a></li>
+<li style="width:600px;"><a href="http://cerberus.x-matter.uni-frankfurt.de:8888/eb/" target="_blank">Eventbuilder Monitor</a></li>
 </ul></div>
 
 <div class="linkbox" style="width:730px;"><h4>Other Ressources</h4><ul>
 <li style="width:600px;"><a href="files/qa.htm">QA Plots (updated every 5 minutes)</a></li>
 <li style="width:500px;"><a href="files/vertex.htm">Vertex Plots (updated after each file)</a></li>
-<li style="width:500px;"><a href="https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.form_selection">Beamtime Logbook</a></li>
+<li style="width:500px;"><a href="http://cerberus.x-matter.uni-frankfurt.de:8888/logbook">Beamtime Logbook</a></li>
 <li style="width:500px;"><a href="http://cerberus.x-matter.uni-frankfurt.de:9999/icinga">Icinga Server Monitoring</a>
 <li style="width:500px;"><a href="http://cerberus.x-matter.uni-frankfurt.de:8888/munin">Munin Server Monitoring</a></li>
 <li style="width:500px;"><a href="archive">Archive of Hmon Windows (updated every 10 minutes)</a></li>
index b64e08535d726a0ffd791ae52d3c77d96dd2db99..706b0b709060ae3cfa09c6677a28f6b31398fd14 100755 (executable)
@@ -31,7 +31,7 @@ my $fqa = QA::OpenQAFile();
 #     softirq: servicing softirqs
 
 #my @srv = qw(lxhadeb01 lxhadeb02 lxhadeb03 lxhadeb04 lxhadeb05 lxhadeb06 lxhadesdaq hadesdaq01 hadesdaq02 hades30 hades31 hades33); #dcs02-07
-my @srv = qw(lxhadeb02 lxhadeb03 lxhadeb04 lxhadeb05 lxhadeb06 lxhadeb07 lxhadeb08 lxhadeb09 lxhadeb10 lxhadesdaq hadesdaqp02 hadesdaq03 hadesdaq04 hades30 hadesp31 depcp418 hades33 
+my @srv = qw(lxhadeb02 lxhadeb03 lxhadeb04 lxhadeb05 lxhadeb06 lxhadeb08 lxhadeb09 lxhadeb10 lxhadeb07 lxhadesdaq hadesdaqp02 hadesdaq03 hadesdaq04 hades30 hadesp31 depcp418 hades33 
 lxhaddcs03p lxhaddcs04p lxhaddcs05p lxhaddcs06p);
 
 
@@ -89,7 +89,7 @@ while(1) {
           $str .= "<td ";
           $str .= sprintf("title=\"busy %.1f, sys %.1f, wait %.1f, irq %.1f\" ",$busy,$sys,$io,$irq);
           $str .= sprintf("style=\"background-color:%4s;\">%2i",Hmon::findcolor($busy||.001,0,100,0),$busy);
-          if($s>0 && $s<4 && $max < $busy && $c>=2 && $c<=11) {
+          if($s>=0 && $s<8 && $max < $busy) {
             $max = $busy;
             $maxstr = sprintf("%d%%",$max);
             $busystr = sprintf("Max. Load: %.1f%% on %s CPU %d (sys %.1f, wait %.1f, irq %.1f)",$max,$srv[$s],$c,$sys,$io,$irq);
index 8cd14781d85481c0256d16acaa5689d49e405056..289b2580ffaf46dc7ece894682f4479c1894f647 100755 (executable)
@@ -208,7 +208,7 @@ sub display()
     my $str = "";
     my ($hub_href) = @_;
 
-    $str = Hmon::MakeTitle(20,12,"Hub Monitor",1);
+    $str = Hmon::MakeTitle(20,14,"Hub Monitor",1);
     $str .= '<table class="hubmon"><tr><td colspan=5><pre>';
     chomp($msg);
     $str .= "Status: ";
diff --git a/hmon/permanent/hmon_richTempHisto.pl b/hmon/permanent/hmon_richTempHisto.pl
new file mode 100755 (executable)
index 0000000..881be25
--- /dev/null
@@ -0,0 +1,116 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+use Time::HiRes qw( gettimeofday usleep time );
+use POSIX qw(strftime);
+use FileHandle;
+use Data::Dumper;
+use POSIX qw/floor ceil/;
+use List::Util qw/min max/;
+use Hmon;
+use HADES::TrbNet;
+use HPlot;
+use JSON::XS;
+
+#my $flog = QA::OpenQAFile();
+my @colors = ("#333333","#00ff00","#ff0000","#0000ff","#dddd00","#dd00dd");
+
+
+my $plot = {
+    name    => "RichTempHistDiRICH",
+    file    => "files/RichTempHistDiRICH",
+    entries => 6000,
+    type    => HPlot::TYPE_HISTORY,
+    output  => HPlot::OUT_PNG,
+    titles  => ["0xe100","0xe101","0xe102","0xe103","0xe104","0xe105","0xe106","0xe107","0xe108","0xe109","0xe110","0xe111","0xe112","0xe113","0xe114","0xe115","0xe116","0xe117"],
+    #titles  => ['min','max','mean'],
+    xlabel  => "Minutes",
+    ylabel  => "Temperature [°C]",
+    sizex   => 950,
+    sizey   => 360,
+    #ymin    => "*<15",
+    #ymax    => "40<*",
+    curves  => 18,
+    xscale  => 30,
+    storable=> 1,
+    colors  => ["#333333","#00ff00","#ff0000","#0022ff","#9a176d","#b844b8","#555555","#22ff22","#ffaaaa","#2222ff","#2d9c94","#777777","#55ff77","#ff7755","#7575ff","#aadd47","#aa0033","#316022","#09b9df"],
+    additional => "set offsets 0,0,1.5,1.5"
+#    colors  => ["#333333","#00ff00","#ff0000"]
+    };
+HPlot::PlotInit($plot);
+
+
+my $timer = 0;
+my $str = "";
+
+
+#OVERCURRENT variables
+my $overcurrent_flag = 0;
+my $OVERCURRENT_YELLOW = 200;
+my $OVERCURRENT_RED = 300;
+
+my $OVERCURRENT_period = 3;
+my $overcurrent_alarm_flag = 0;
+my $current_average = 0;
+my $current_sum = 0;
+
+my $errortimer = 0;
+
+# Only if the current is larger than OVERCURRENT_PERIOD, the alarm will set off.
+
+
+my $test2 = 1;
+while(1) {
+  $timer++;
+
+  my $min = 1E5;
+  my $max = 0;
+  
+  my $jsonfile;
+  my $filename = 'files/richTemperatureBackplane.json';
+  open(my $fh, '<:encoding(UTF-8)', $filename) or die "Could not open file '$filename' $!";
+
+  while (my $row = <$fh>) {
+    chomp $row;
+    $jsonfile .= $row;
+  }
+
+  my $data = decode_json($jsonfile);
+  close $fh;
+  
+  
+  foreach my $b (keys %{$data}) {
+    my $t = $data->{$b};
+    my $subs = substr($b,0,2);
+    if (substr($b,0,2) eq '0x') {
+      my $reg = (eval $b) - 0xe100;
+      
+      if ($reg > 9) {$reg = $reg - 6 ;}
+      if ($reg < 18) {HPlot::PlotAdd("RichTempHistDiRICH",$t,$reg);}
+      
+    }
+  }
+  
+  #my $data = Perl2Epics::GetAll();
+  $str =  "<!DOCTYPE html>\n\n<html>\n<head>\n";
+  $str .= Hmon::MakeTitle(12, 8, "RICH Temp DiRICH", 1, "");
+  $str .= qq@<img src="%ADDPNG files/RichTempHistDiRICH.png%" type="image/png">\n@;
+
+  $str .= Hmon::MakeFooter();
+  $str .= "</body>";
+  $str .= "</html>";
+  Hmon::WriteFile("RichTempHistoDiRICH", $str);
+  
+
+  
+  #for (my $i = 0; $i <= 5;$i++){
+     # HPlot::PlotAdd("RichTempHistDiRICH",$max,0); #$data->{"I$cnt"}->{val}||-1
+     # HPlot::PlotAdd("RichTempHistDiRICH",$min,1);
+  #}
+  #print Dumper $data;
+  if($timer%5 == 0) { #10 seconds
+    HPlot::PlotDraw("RichTempHistDiRICH");
+  }
+
+  usleep(2000000); #2 seconds
+  }
index 517019d99d430ecfacccf6d9bcdf6257b83cbf4b..4de09bb05a235bfadc9bffb9a41a9ea5e8b5ea52 100755 (executable)
@@ -132,7 +132,7 @@ while(1) {
   #$str =  "<!DOCTYPE html>\n\n<html>\n<head>\n";
   #$str .= "<style>\n.dot {\n height: 25px;\n width:25px;\n border-radius: 50%;\n display: inline-block;\n}\n \n ";
   #$str .= "</style>\n</head>\n<body>\n";
-  $str .= Hmon::MakeTitle(13, 17, "RICH HV", 1, "");
+  $str = Hmon::MakeTitle(13, 17, "RICH HV", 1, "");
   $str .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"files/styles.css\">";
 
   $str .= "<div style=\"text-align:left; margin-top: 10px;\">";
@@ -234,8 +234,8 @@ $qastate = QA::NOTE if ($QA::RichHvOff == 1);
     for (my $i = 0; $i <= 5;$i++){
         for (my $j = 0; $j<=15; $j++) {
         my $cnt = ($i*16)+$j;
-        HPlot::PlotAdd("RichCurr",$data->{"I$cnt"}->{val}||-1,);
-        HPlot::PlotAdd("RichVolt",$data->{"U$cnt"}->{val}||-1,);
+        HPlot::PlotAdd("RichCurr",-($data->{"I$cnt"}->{val}||-1),);
+        HPlot::PlotAdd("RichVolt",-($data->{"U$cnt"}->{val}||-1),);
         HPlot::PlotAdd("RichResist",$data->{"R$cnt"}->{val}||-1,);
         }
     }
index c7937ac1cb0dab59d40b5932ab8e90482d9b9fd5..35662fd47f5199a9bef2e1d4df071ad5ac5f459a 100644 (file)
@@ -94,6 +94,12 @@ div.width11 {width:870px;}
 div.width12 {width:950px;}  
 div.width13 {width:1030px;}  
 div.width14 {width:1110px;}  
+div.width15 {width:1190px;}  
+div.width16 {width:1270px;}  
+div.width17 {width:1350px;}  
+div.width18 {width:1430px;}  
+div.width19 {width:1510px;}  
+div.width20 {width:1590px;}  
 
 div.height1 {height:40px;}      
 div.height2 {height:90px;}