Currently when we issue ipmitool command to get SEL entry, 
it prints the  following outdated event log entry if SEL entry is not present.

ipmitool -I lanplus -H <ip address> -P PASSW0RD -C 1 sel get 1
Get SEL Entry 1 command failed: Requested sensor, data, or record not found

SEL Record ID          : 0000
 Record Type           : 00
 Timestamp             : 01/01/1970 00:00:00
 Generator ID          : 92c0
 EvM Revision          : 04
 Sensor Type           : Power Supply
 Sensor Number         : 28
 Event Type            : Reserved
 Event Direction       : Assertion Event
 Event Data            : 0d0809

This patch is to avoid printing outdated event log entry if SEL entry is not 
present.

Test results:

1)SEL event ID not present

./ipmitool -I lanplus -H <ip address> -P PASSW0RD -C 1 sel get 5
Get SEL Entry 5 command failed: Requested sensor, data, or record not found

2) SEL Event ID present

./ipmitool -I lanplus -H <ip address> -P PASSW0RD -C 1 sel get 1
SEL Record ID          : 0001
 Record Type           : 02
 Timestamp             : 02/25/2014 03:09:53
 Generator ID          : 2000
 EvM Revision          : 04
 Sensor Type           : System Event
 Sensor Number         : 36
 Event Type            : Generic Discrete
 Event Direction       : Assertion Event
 Event Data            : 466fff
 Description           : Transition to Non-recoverable

Signed-off-by: Mamatha Inamdar <mamat...@linux.vnet.ibm.com>
---
 lib/ipmi_sel.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/ipmi_sel.c b/lib/ipmi_sel.c
index 63ecbcf..0393a99 100644
--- a/lib/ipmi_sel.c
+++ b/lib/ipmi_sel.c
@@ -2898,7 +2898,11 @@ ipmi_sel_show_entry(struct ipmi_intf * intf, int argc, 
char ** argv)
                lprintf(LOG_DEBUG, "Looking up SEL entry 0x%x", id);
 
                /* lookup SEL entry based on ID */
-               ipmi_sel_get_std_entry(intf, id, &evt);
+               if(!ipmi_sel_get_std_entry(intf, id, &evt)) {
+                       lprintf(LOG_DEBUG, "SEL Entry %d not found", id);
+                       return -1;
+               }
+
                if (evt.sel_type.standard_type.sensor_num == 0 && 
evt.sel_type.standard_type.sensor_type == 0 && evt.record_type == 0) {
                        lprintf(LOG_WARN, "SEL Entry 0x%x not found", id);
                        rc = -1;


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to