|
David Johansen |
447ac5 |
commit 546cf713f667437fb6e283cc3dc090679eb47d08
|
|
David Johansen |
45192c |
Author: Subhendu Saha <subhends@akamai.com>
|
|
David Johansen |
45192c |
Date: Tue Jan 12 03:29:55 2021 -0500
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
Fix ras-mc-ctl script.
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
When rasdaemon is compiled without enabling aer, mce, devlink,
|
|
David Johansen |
45192c |
etc., those tables are not created in the database file. Then
|
|
David Johansen |
45192c |
ras-mc-ctl script breaks trying to query data from non-existent
|
|
David Johansen |
45192c |
tables.
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
Signed-off-by: Subhendu Saha subhends@akamai.com
|
|
David Johansen |
45192c |
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in
|
|
David Johansen |
45192c |
index dd7d56f..1fbeb63 100755
|
|
David Johansen |
45192c |
--- a/util/ras-mc-ctl.in
|
|
David Johansen |
45192c |
+++ b/util/ras-mc-ctl.in
|
|
David Johansen |
45192c |
@@ -41,6 +41,20 @@ my $sysconfdir = "@sysconfdir@";
|
|
David Johansen |
45192c |
my $dmidecode = find_prog ("dmidecode");
|
|
David Johansen |
45192c |
my $modprobe = find_prog ("modprobe") or exit (1);
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
+my $has_aer = 0;
|
|
David Johansen |
45192c |
+my $has_arm = 0;
|
|
David Johansen |
45192c |
+my $has_devlink = 0;
|
|
David Johansen |
45192c |
+my $has_disk_errors = 0;
|
|
David Johansen |
45192c |
+my $has_extlog = 0;
|
|
David Johansen |
45192c |
+my $has_mce = 0;
|
|
David Johansen |
45192c |
+
|
|
David Johansen |
45192c |
+@WITH_AER_TRUE@$has_aer = 1;
|
|
David Johansen |
45192c |
+@WITH_ARM_TRUE@$has_arm = 1;
|
|
David Johansen |
45192c |
+@WITH_DEVLINK_TRUE@$has_devlink = 1;
|
|
David Johansen |
45192c |
+@WITH_DISKERROR_TRUE@$has_disk_errors = 1;
|
|
David Johansen |
45192c |
+@WITH_EXTLOG_TRUE@$has_extlog = 1;
|
|
David Johansen |
45192c |
+@WITH_MCE_TRUE@$has_mce = 1;
|
|
David Johansen |
45192c |
+
|
|
David Johansen |
45192c |
my %conf = ();
|
|
David Johansen |
45192c |
my %bus = ();
|
|
David Johansen |
45192c |
my %dimm_size = ();
|
|
David Johansen |
45192c |
@@ -1144,102 +1158,114 @@ sub summary
|
|
David Johansen |
45192c |
$query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# PCIe AER aer_event errors
|
|
David Johansen |
45192c |
- $query = "select err_type, err_msg, count(*) from aer_event group by err_type, err_msg";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($err_type, $msg, $count));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "\t$count $err_type errors: $msg\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "PCIe AER events summary:\n$out\n";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No PCIe AER errors.\n\n";
|
|
David Johansen |
45192c |
+ if ($has_aer == 1) {
|
|
David Johansen |
45192c |
+ $query = "select err_type, err_msg, count(*) from aer_event group by err_type, err_msg";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($err_type, $msg, $count));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "\t$count $err_type errors: $msg\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "PCIe AER events summary:\n$out\n";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No PCIe AER errors.\n\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# ARM processor arm_event errors
|
|
David Johansen |
45192c |
- $query = "select affinity, mpidr, count(*) from arm_event group by affinity, mpidr";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($affinity, $mpidr, $count));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "\t$count errors\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "ARM processor events summary:\n$out\n";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No ARM processor errors.\n\n";
|
|
David Johansen |
45192c |
+ if ($has_arm == 1) {
|
|
David Johansen |
45192c |
+ $query = "select affinity, mpidr, count(*) from arm_event group by affinity, mpidr";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($affinity, $mpidr, $count));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "\t$count errors\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "ARM processor events summary:\n$out\n";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No ARM processor errors.\n\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# extlog errors
|
|
David Johansen |
45192c |
- $query = "select etype, severity, count(*) from extlog_event group by etype, severity";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($etype, $severity, $count));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $etype_string = get_extlog_type($etype);
|
|
David Johansen |
45192c |
- $severity_string = get_extlog_severity($severity);
|
|
David Johansen |
45192c |
- $out .= "\t$count $etype_string $severity_string errors\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "Extlog records summary:\n$out";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No Extlog errors.\n\n";
|
|
David Johansen |
45192c |
+ if ($has_extlog == 1) {
|
|
David Johansen |
45192c |
+ $query = "select etype, severity, count(*) from extlog_event group by etype, severity";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($etype, $severity, $count));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $etype_string = get_extlog_type($etype);
|
|
David Johansen |
45192c |
+ $severity_string = get_extlog_severity($severity);
|
|
David Johansen |
45192c |
+ $out .= "\t$count $etype_string $severity_string errors\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "Extlog records summary:\n$out";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No Extlog errors.\n\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# devlink errors
|
|
David Johansen |
45192c |
- $query = "select dev_name, count(*) from devlink_event group by dev_name";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($dev_name, $count));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "\t$dev_name has $count errors\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "Devlink records summary:\n$out";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No devlink errors.\n";
|
|
David Johansen |
45192c |
+ if ($has_devlink == 1) {
|
|
David Johansen |
45192c |
+ $query = "select dev_name, count(*) from devlink_event group by dev_name";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($dev_name, $count));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "\t$dev_name has $count errors\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "Devlink records summary:\n$out";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No devlink errors.\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# Disk errors
|
|
David Johansen |
45192c |
- $query = "select dev, count(*) from disk_errors group by dev";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($dev, $count));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "\t$dev has $count errors\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "Disk errors summary:\n$out";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No disk errors.\n";
|
|
David Johansen |
45192c |
+ if ($has_disk_errors == 1) {
|
|
David Johansen |
45192c |
+ $query = "select dev, count(*) from disk_errors group by dev";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($dev, $count));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "\t$dev has $count errors\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "Disk errors summary:\n$out";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No disk errors.\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# MCE mce_record errors
|
|
David Johansen |
45192c |
- $query = "select error_msg, count(*) from mce_record group by error_msg";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($msg, $count));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "\t$count $msg errors\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "MCE records summary:\n$out";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No MCE errors.\n";
|
|
David Johansen |
45192c |
+ if ($has_mce == 1) {
|
|
David Johansen |
45192c |
+ $query = "select error_msg, count(*) from mce_record group by error_msg";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($msg, $count));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "\t$count $msg errors\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "MCE records summary:\n$out";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No MCE errors.\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
undef($dbh);
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
@@ -1277,150 +1303,162 @@ sub errors
|
|
David Johansen |
45192c |
$query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# PCIe AER aer_event errors
|
|
David Johansen |
45192c |
- $query = "select id, timestamp, dev_name, err_type, err_msg from aer_event order by id";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($id, $time, $devname, $type, $msg));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "$id $time $devname $type error: $msg\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "PCIe AER events:\n$out\n";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No PCIe AER errors.\n\n";
|
|
David Johansen |
45192c |
+ if ($has_aer == 1) {
|
|
David Johansen |
45192c |
+ $query = "select id, timestamp, dev_name, err_type, err_msg from aer_event order by id";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($id, $time, $devname, $type, $msg));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "$id $time $devname $type error: $msg\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "PCIe AER events:\n$out\n";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No PCIe AER errors.\n\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# ARM processor arm_event errors
|
|
David Johansen |
45192c |
- $query = "select id, timestamp, error_count, affinity, mpidr, running_state, psci_state from arm_event order by id";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($id, $timestamp, $error_count, $affinity, $mpidr, $r_state, $psci_state));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "$id $timestamp error: ";
|
|
David Johansen |
45192c |
- $out .= "error_count=$error_count, " if ($error_count);
|
|
David Johansen |
45192c |
- $out .= "affinity_level=$affinity, ";
|
|
David Johansen |
45192c |
- $out .= sprintf "mpidr=0x%x, ", $mpidr;
|
|
David Johansen |
45192c |
- $out .= sprintf "running_state=0x%x, ", $r_state;
|
|
David Johansen |
45192c |
- $out .= sprintf "psci_state=0x%x", $psci_state;
|
|
David Johansen |
45192c |
- $out .= "\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "ARM processor events:\n$out\n";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No ARM processor errors.\n\n";
|
|
David Johansen |
45192c |
+ if ($has_arm == 1) {
|
|
David Johansen |
45192c |
+ $query = "select id, timestamp, error_count, affinity, mpidr, running_state, psci_state from arm_event order by id";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($id, $timestamp, $error_count, $affinity, $mpidr, $r_state, $psci_state));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "$id $timestamp error: ";
|
|
David Johansen |
45192c |
+ $out .= "error_count=$error_count, " if ($error_count);
|
|
David Johansen |
45192c |
+ $out .= "affinity_level=$affinity, ";
|
|
David Johansen |
45192c |
+ $out .= sprintf "mpidr=0x%x, ", $mpidr;
|
|
David Johansen |
45192c |
+ $out .= sprintf "running_state=0x%x, ", $r_state;
|
|
David Johansen |
45192c |
+ $out .= sprintf "psci_state=0x%x", $psci_state;
|
|
David Johansen |
45192c |
+ $out .= "\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "ARM processor events:\n$out\n";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No ARM processor errors.\n\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# Extlog errors
|
|
David Johansen |
45192c |
- $query = "select id, timestamp, etype, severity, address, fru_id, fru_text, cper_data from extlog_event order by id";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($id, $timestamp, $etype, $severity, $addr, $fru_id, $fru_text, $cper_data));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $etype_string = get_extlog_type($etype);
|
|
David Johansen |
45192c |
- $severity_string = get_extlog_severity($severity);
|
|
David Johansen |
45192c |
- $out .= "$id $timestamp error: ";
|
|
David Johansen |
45192c |
- $out .= "type=$etype_string, ";
|
|
David Johansen |
45192c |
- $out .= "severity=$severity_string, ";
|
|
David Johansen |
45192c |
- $out .= sprintf "address=0x%08x, ", $addr;
|
|
David Johansen |
45192c |
- $out .= sprintf "fru_id=%s, ", get_uuid_le($fru_id);
|
|
David Johansen |
45192c |
- $out .= "fru_text='$fru_text', ";
|
|
David Johansen |
45192c |
- $out .= get_cper_data_text($cper_data) if ($cper_data);
|
|
David Johansen |
45192c |
- $out .= "\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "Extlog events:\n$out\n";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No Extlog errors.\n\n";
|
|
David Johansen |
45192c |
+ if ($has_extlog == 1) {
|
|
David Johansen |
45192c |
+ $query = "select id, timestamp, etype, severity, address, fru_id, fru_text, cper_data from extlog_event order by id";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($id, $timestamp, $etype, $severity, $addr, $fru_id, $fru_text, $cper_data));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $etype_string = get_extlog_type($etype);
|
|
David Johansen |
45192c |
+ $severity_string = get_extlog_severity($severity);
|
|
David Johansen |
45192c |
+ $out .= "$id $timestamp error: ";
|
|
David Johansen |
45192c |
+ $out .= "type=$etype_string, ";
|
|
David Johansen |
45192c |
+ $out .= "severity=$severity_string, ";
|
|
David Johansen |
45192c |
+ $out .= sprintf "address=0x%08x, ", $addr;
|
|
David Johansen |
45192c |
+ $out .= sprintf "fru_id=%s, ", get_uuid_le($fru_id);
|
|
David Johansen |
45192c |
+ $out .= "fru_text='$fru_text', ";
|
|
David Johansen |
45192c |
+ $out .= get_cper_data_text($cper_data) if ($cper_data);
|
|
David Johansen |
45192c |
+ $out .= "\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "Extlog events:\n$out\n";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No Extlog errors.\n\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# devlink errors
|
|
David Johansen |
45192c |
- $query = "select id, timestamp, bus_name, dev_name, driver_name, reporter_name, msg from devlink_event order by id";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($id, $timestamp, $bus_name, $dev_name, $driver_name, $reporter_name, $msg));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "$id $timestamp error: ";
|
|
David Johansen |
45192c |
- $out .= "bus_name=$bus_name, ";
|
|
David Johansen |
45192c |
- $out .= "dev_name=$dev_name, ";
|
|
David Johansen |
45192c |
- $out .= "driver_name=$driver_name, ";
|
|
David Johansen |
45192c |
- $out .= "reporter_name=$reporter_name, ";
|
|
David Johansen |
45192c |
- $out .= "message='$msg', ";
|
|
David Johansen |
45192c |
- $out .= "\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "Devlink events:\n$out\n";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No devlink errors.\n\n";
|
|
David Johansen |
45192c |
+ if ($has_devlink == 1) {
|
|
David Johansen |
45192c |
+ $query = "select id, timestamp, bus_name, dev_name, driver_name, reporter_name, msg from devlink_event order by id";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($id, $timestamp, $bus_name, $dev_name, $driver_name, $reporter_name, $msg));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "$id $timestamp error: ";
|
|
David Johansen |
45192c |
+ $out .= "bus_name=$bus_name, ";
|
|
David Johansen |
45192c |
+ $out .= "dev_name=$dev_name, ";
|
|
David Johansen |
45192c |
+ $out .= "driver_name=$driver_name, ";
|
|
David Johansen |
45192c |
+ $out .= "reporter_name=$reporter_name, ";
|
|
David Johansen |
45192c |
+ $out .= "message='$msg', ";
|
|
David Johansen |
45192c |
+ $out .= "\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "Devlink events:\n$out\n";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No devlink errors.\n\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# Disk errors
|
|
David Johansen |
45192c |
- $query = "select id, timestamp, dev, sector, nr_sector, error, rwbs, cmd from disk_errors order by id";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($id, $timestamp, $dev, $sector, $nr_sector, $error, $rwbs, $cmd));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "$id $timestamp error: ";
|
|
David Johansen |
45192c |
- $out .= "dev=$dev, ";
|
|
David Johansen |
45192c |
- $out .= "sector=$sector, ";
|
|
David Johansen |
45192c |
- $out .= "nr_sector=$nr_sector, ";
|
|
David Johansen |
45192c |
- $out .= "error='$error', ";
|
|
David Johansen |
45192c |
- $out .= "rwbs='$rwbs', ";
|
|
David Johansen |
45192c |
- $out .= "cmd='$cmd', ";
|
|
David Johansen |
45192c |
- $out .= "\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "Disk errors\n$out\n";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No disk errors.\n\n";
|
|
David Johansen |
45192c |
+ if ($has_disk_errors == 1) {
|
|
David Johansen |
45192c |
+ $query = "select id, timestamp, dev, sector, nr_sector, error, rwbs, cmd from disk_errors order by id";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($id, $timestamp, $dev, $sector, $nr_sector, $error, $rwbs, $cmd));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "$id $timestamp error: ";
|
|
David Johansen |
45192c |
+ $out .= "dev=$dev, ";
|
|
David Johansen |
45192c |
+ $out .= "sector=$sector, ";
|
|
David Johansen |
45192c |
+ $out .= "nr_sector=$nr_sector, ";
|
|
David Johansen |
45192c |
+ $out .= "error='$error', ";
|
|
David Johansen |
45192c |
+ $out .= "rwbs='$rwbs', ";
|
|
David Johansen |
45192c |
+ $out .= "cmd='$cmd', ";
|
|
David Johansen |
45192c |
+ $out .= "\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "Disk errors\n$out\n";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No disk errors.\n\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
# MCE mce_record errors
|
|
David Johansen |
45192c |
- $query = "select id, timestamp, mcgcap, mcgstatus, status, addr, misc, ip, tsc, walltime, cpu, cpuid, apicid, socketid, cs, bank, cpuvendor, bank_name, error_msg, mcgstatus_msg, mcistatus_msg, user_action, mc_location from mce_record order by id";
|
|
David Johansen |
45192c |
- $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
- $query_handle->execute();
|
|
David Johansen |
45192c |
- $query_handle->bind_columns(\($id, $time, $mcgcap,$mcgstatus, $status, $addr, $misc, $ip, $tsc, $walltime, $cpu, $cpuid, $apicid, $socketid, $cs, $bank, $cpuvendor, $bank_name, $msg, $mcgstatus_msg, $mcistatus_msg, $user_action, $mc_location));
|
|
David Johansen |
45192c |
- $out = "";
|
|
David Johansen |
45192c |
- while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
- $out .= "$id $time error: $msg";
|
|
David Johansen |
45192c |
- $out .= ", CPU $cpuvendor" if ($cpuvendor);
|
|
David Johansen |
45192c |
- $out .= ", bank $bank_name" if ($bank_name);
|
|
David Johansen |
45192c |
- $out .= ", mcg $mcgstatus_msg" if ($mcgstatus_msg);
|
|
David Johansen |
45192c |
- $out .= ", mci $mcistatus_msg" if ($mcistatus_msg);
|
|
David Johansen |
45192c |
- $out .= ", $mc_location" if ($mc_location);
|
|
David Johansen |
45192c |
- $out .= ", $user_action" if ($user_action);
|
|
David Johansen |
45192c |
- $out .= sprintf ", mcgcap=0x%08x", $mcgcap if ($mcgcap);
|
|
David Johansen |
45192c |
- $out .= sprintf ", mcgstatus=0x%08x", $mcgstatus if ($mcgstatus);
|
|
David Johansen |
45192c |
- $out .= sprintf ", status=0x%08x", $status if ($status);
|
|
David Johansen |
45192c |
- $out .= sprintf ", addr=0x%08x", $addr if ($addr);
|
|
David Johansen |
45192c |
- $out .= sprintf ", misc=0x%08x", $misc if ($misc);
|
|
David Johansen |
45192c |
- $out .= sprintf ", ip=0x%08x", $ip if ($ip);
|
|
David Johansen |
45192c |
- $out .= sprintf ", tsc=0x%08x", $tsc if ($tsc);
|
|
David Johansen |
45192c |
- $out .= sprintf ", walltime=0x%08x", $walltime if ($walltime);
|
|
David Johansen |
45192c |
- $out .= sprintf ", cpu=0x%08x", $cpu if ($cpu);
|
|
David Johansen |
45192c |
- $out .= sprintf ", cpuid=0x%08x", $cpuid if ($cpuid);
|
|
David Johansen |
45192c |
- $out .= sprintf ", apicid=0x%08x", $apicid if ($apicid);
|
|
David Johansen |
45192c |
- $out .= sprintf ", socketid=0x%08x", $socketid if ($socketid);
|
|
David Johansen |
45192c |
- $out .= sprintf ", cs=0x%08x", $cs if ($cs);
|
|
David Johansen |
45192c |
- $out .= sprintf ", bank=0x%08x", $bank if ($bank);
|
|
David Johansen |
45192c |
-
|
|
David Johansen |
45192c |
- $out .= "\n";
|
|
David Johansen |
45192c |
- }
|
|
David Johansen |
45192c |
- if ($out ne "") {
|
|
David Johansen |
45192c |
- print "MCE events:\n$out\n";
|
|
David Johansen |
45192c |
- } else {
|
|
David Johansen |
45192c |
- print "No MCE errors.\n\n";
|
|
David Johansen |
45192c |
+ if ($has_mce == 1) {
|
|
David Johansen |
45192c |
+ $query = "select id, timestamp, mcgcap, mcgstatus, status, addr, misc, ip, tsc, walltime, cpu, cpuid, apicid, socketid, cs, bank, cpuvendor, bank_name, error_msg, mcgstatus_msg, mcistatus_msg, user_action, mc_location from mce_record order by id";
|
|
David Johansen |
45192c |
+ $query_handle = $dbh->prepare($query);
|
|
David Johansen |
45192c |
+ $query_handle->execute();
|
|
David Johansen |
45192c |
+ $query_handle->bind_columns(\($id, $time, $mcgcap,$mcgstatus, $status, $addr, $misc, $ip, $tsc, $walltime, $cpu, $cpuid, $apicid, $socketid, $cs, $bank, $cpuvendor, $bank_name, $msg, $mcgstatus_msg, $mcistatus_msg, $user_action, $mc_location));
|
|
David Johansen |
45192c |
+ $out = "";
|
|
David Johansen |
45192c |
+ while($query_handle->fetch()) {
|
|
David Johansen |
45192c |
+ $out .= "$id $time error: $msg";
|
|
David Johansen |
45192c |
+ $out .= ", CPU $cpuvendor" if ($cpuvendor);
|
|
David Johansen |
45192c |
+ $out .= ", bank $bank_name" if ($bank_name);
|
|
David Johansen |
45192c |
+ $out .= ", mcg $mcgstatus_msg" if ($mcgstatus_msg);
|
|
David Johansen |
45192c |
+ $out .= ", mci $mcistatus_msg" if ($mcistatus_msg);
|
|
David Johansen |
45192c |
+ $out .= ", $mc_location" if ($mc_location);
|
|
David Johansen |
45192c |
+ $out .= ", $user_action" if ($user_action);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", mcgcap=0x%08x", $mcgcap if ($mcgcap);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", mcgstatus=0x%08x", $mcgstatus if ($mcgstatus);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", status=0x%08x", $status if ($status);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", addr=0x%08x", $addr if ($addr);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", misc=0x%08x", $misc if ($misc);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", ip=0x%08x", $ip if ($ip);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", tsc=0x%08x", $tsc if ($tsc);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", walltime=0x%08x", $walltime if ($walltime);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", cpu=0x%08x", $cpu if ($cpu);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", cpuid=0x%08x", $cpuid if ($cpuid);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", apicid=0x%08x", $apicid if ($apicid);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", socketid=0x%08x", $socketid if ($socketid);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", cs=0x%08x", $cs if ($cs);
|
|
David Johansen |
45192c |
+ $out .= sprintf ", bank=0x%08x", $bank if ($bank);
|
|
David Johansen |
45192c |
+
|
|
David Johansen |
45192c |
+ $out .= "\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ if ($out ne "") {
|
|
David Johansen |
45192c |
+ print "MCE events:\n$out\n";
|
|
David Johansen |
45192c |
+ } else {
|
|
David Johansen |
45192c |
+ print "No MCE errors.\n\n";
|
|
David Johansen |
45192c |
+ }
|
|
David Johansen |
45192c |
+ $query_handle->finish;
|
|
David Johansen |
45192c |
}
|
|
David Johansen |
45192c |
- $query_handle->finish;
|
|
David Johansen |
45192c |
|
|
David Johansen |
45192c |
undef($dbh);
|
|
David Johansen |
45192c |
}
|