]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
ras-mc-ctl: add summary for MCE and PCIe AER errors
authorMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 31 May 2013 17:57:54 +0000 (14:57 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 31 May 2013 19:16:16 +0000 (16:16 -0300)
Report the summary also for MCE and PCIe errors.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
util/ras-mc-ctl.in

index 5b1ca4d2efcb8fc0cc7b0717647fbb9b43848f64..118af7bdc90de93700f7f1f8970e8d9816ca2553 100755 (executable)
@@ -824,21 +824,59 @@ sub find_prog
 sub summary
 {
     require DBI;
+    my ($query, $query_handle, $out);
+    my ($err_type, $label, $mc, $top, $mid, $low, $count, $msg);
 
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
 
-    my $query = "select label, mc, top_layer,middle_layer,lower_layer, count(*) from mc_event group by label,mc,top_layer,middle_layer,lower_layer";
-    my $query_handle = $dbh->prepare($query);
+    # Memory controller mc_event errors
+    $query = "select err_type, label, mc, top_layer,middle_layer,lower_layer, count(*) from mc_event group by err_type, label, mc, top_layer, middle_layer, lower_layer";
+    $query_handle = $dbh->prepare($query);
     $query_handle->execute();
+    $query_handle->bind_columns(\($err_type, $label, $mc, $top, $mid, $low, $count));
+    $out = "";
+    while($query_handle->fetch()) {
+        $out .= "\t$err_type on DIMM Label(s): '$label' location: $mc:$top:$mid:$low errors: $count\n";
+    }
+    if ($out ne "") {
+        print "Memory controller events summary:\n$out\n";
+    } else {
+        print "No Memory errors.\n\n";
+    }
+    $query_handle->finish;
 
-    $query_handle->bind_columns(\my($label, $mc, $top, $mid, $low, $count));
-
-    print "Memory controller events summary:\n";
+    # PCIe AER aer_event errors
+    $query = "select err_type, err_msg, count(*) from aer_event group by err_type, err_msg";
+    $query_handle = $dbh->prepare($query);
+    $query_handle->execute();
+    $query_handle->bind_columns(\($err_type, $msg, $count));
+    $out = "";
     while($query_handle->fetch()) {
-        print "DIMM Label(s): '$label' location: $mc:$top:$mid:$low errors: $count\n";
+        $out .= "\t$count $err_type errors: $msg\n";
     }
+    if ($out ne "") {
+        print "PCIe AER events summary:\n$out\n";
+    } else {
+        print "No PCIe AER errors.\n\n";
+    }
+    $query_handle->finish;
 
+    # MCE mce_record errors
+    $query = "select error_msg, count(*) from mce_record group by error_msg";
+    $query_handle = $dbh->prepare($query);
+    $query_handle->execute();
+    $query_handle->bind_columns(\($msg, $count));
+    $out = "";
+    while($query_handle->fetch()) {
+        $out .= "\t$count $msg errors\n";
+    }
+    if ($out ne "") {
+        print "MCE records summary:\n$out";
+    } else {
+        print "No MCE errors.\n";
+    }
     $query_handle->finish;
+
     undef($dbh);
 }