krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0008-ras-mc-ctl-add-summary-for-MCE-and-PCIe-AER-errors.patch

97e186
From 2925cc92d73065dab3bbf7de83404d6e0e141dc6 Mon Sep 17 00:00:00 2001
97e186
From: Mauro Carvalho Chehab <mchehab@redhat.com>
97e186
Date: Fri, 31 May 2013 14:57:54 -0300
97e186
Subject: [PATCH 08/32] ras-mc-ctl: add summary for MCE and PCIe AER errors
97e186
97e186
Report the summary also for MCE and PCIe errors.
97e186
97e186
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
97e186
---
97e186
 util/ras-mc-ctl.in |   50 ++++++++++++++++++++++++++++++++++++++++++++------
97e186
 1 files changed, 44 insertions(+), 6 deletions(-)
97e186
97e186
diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in
97e186
index 5b1ca4d..118af7b 100755
97e186
--- a/util/ras-mc-ctl.in
97e186
+++ b/util/ras-mc-ctl.in
97e186
@@ -824,21 +824,59 @@ sub find_prog
97e186
 sub summary
97e186
 {
97e186
     require DBI;
97e186
+    my ($query, $query_handle, $out);
97e186
+    my ($err_type, $label, $mc, $top, $mid, $low, $count, $msg);
97e186
 
97e186
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
97e186
 
97e186
-    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";
97e186
-    my $query_handle = $dbh->prepare($query);
97e186
+    # Memory controller mc_event errors
97e186
+    $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";
97e186
+    $query_handle = $dbh->prepare($query);
97e186
     $query_handle->execute();
97e186
+    $query_handle->bind_columns(\($err_type, $label, $mc, $top, $mid, $low, $count));
97e186
+    $out = "";
97e186
+    while($query_handle->fetch()) {
97e186
+        $out .= "\t$err_type on DIMM Label(s): '$label' location: $mc:$top:$mid:$low errors: $count\n";
97e186
+    }
97e186
+    if ($out ne "") {
97e186
+        print "Memory controller events summary:\n$out\n";
97e186
+    } else {
97e186
+        print "No Memory errors.\n\n";
97e186
+    }
97e186
+    $query_handle->finish;
97e186
 
97e186
-    $query_handle->bind_columns(\my($label, $mc, $top, $mid, $low, $count));
97e186
-
97e186
-    print "Memory controller events summary:\n";
97e186
+    # PCIe AER aer_event errors
97e186
+    $query = "select err_type, err_msg, count(*) from aer_event group by err_type, err_msg";
97e186
+    $query_handle = $dbh->prepare($query);
97e186
+    $query_handle->execute();
97e186
+    $query_handle->bind_columns(\($err_type, $msg, $count));
97e186
+    $out = "";
97e186
     while($query_handle->fetch()) {
97e186
-        print "DIMM Label(s): '$label' location: $mc:$top:$mid:$low errors: $count\n";
97e186
+        $out .= "\t$count $err_type errors: $msg\n";
97e186
     }
97e186
+    if ($out ne "") {
97e186
+        print "PCIe AER events summary:\n$out\n";
97e186
+    } else {
97e186
+        print "No PCIe AER errors.\n\n";
97e186
+    }
97e186
+    $query_handle->finish;
97e186
 
97e186
+    # MCE mce_record errors
97e186
+    $query = "select error_msg, count(*) from mce_record group by error_msg";
97e186
+    $query_handle = $dbh->prepare($query);
97e186
+    $query_handle->execute();
97e186
+    $query_handle->bind_columns(\($msg, $count));
97e186
+    $out = "";
97e186
+    while($query_handle->fetch()) {
97e186
+        $out .= "\t$count $msg errors\n";
97e186
+    }
97e186
+    if ($out ne "") {
97e186
+        print "MCE records summary:\n$out";
97e186
+    } else {
97e186
+        print "No MCE errors.\n";
97e186
+    }
97e186
     $query_handle->finish;
97e186
+
97e186
     undef($dbh);
97e186
 }
97e186
 
97e186
-- 
97e186
1.7.1
97e186