Hi,

For some event types, ipmievd does not log the 'event direction' to syslog.

When using ipmievd/syslog to monitor the HW, it's important to distinguish
assertion/deassertion events.

Please find attached a patch to add the event direction to syslog. I.e.
instead of

Nov 16 09:31:20 hostname ipmievd: Power Unit sensor - Power off/down
Nov 16 09:31:30 hostname ipmievd: Power Unit sensor - Power off/down

You'll get

Nov 16 09:35:45 hostname ipmievd: Power Unit sensor - Power off/down Asserted
Nov 16 09:35:48 hostname ipmievd: Power Unit sensor - Power off/down
Deasserted


Or is there any reason the event direction is only available for sensor
specific events?

Regards,
Michael


--- ipmievd_orig.c      2009-11-16 14:21:37.522774636 +0100
+++ ipmievd.c   2009-11-16 08:29:31.322650471 +0100
@@ -242,13 +242,15 @@
        if (sdr == NULL) {
                /* could not find matching SDR record */
                if (desc) {
-                       lprintf(LOG_NOTICE, "%s%s sensor - %s",
-                               eintf->prefix, type, desc);
+                       lprintf(LOG_NOTICE, "%s%s sensor - %s %s",
+                               eintf->prefix, type, desc,
+                               evt->sel_type.standard_type.event_dir ? 
"Deasserted" : "Asserted");
                        free(desc);
                } else {
-                       lprintf(LOG_NOTICE, "%s%s sensor %02x",
+                       lprintf(LOG_NOTICE, "%s%s sensor %02x %s",
                                eintf->prefix, type,
-                               evt->sel_type.standard_type.sensor_num);
+                               evt->sel_type.standard_type.sensor_num,
+                               evt->sel_type.standard_type.event_dir ? 
"Deasserted" : "Asserted");
                }
                return;
        }
@@ -291,8 +293,9 @@
                        /*
                         * Discrete Event
                         */
-                       lprintf(LOG_NOTICE, "%s%s sensor %s %s",
-                               eintf->prefix, type, 
sdr->record.full->id_string, desc ? : "");
+                       lprintf(LOG_NOTICE, "%s%s sensor %s %s %s",
+                               eintf->prefix, type, 
sdr->record.full->id_string, desc ? : "",
+                               evt->sel_type.standard_type.event_dir ? 
"Deasserted" : "Asserted");
                        if (((evt->sel_type.standard_type.event_data[0] >> 6) & 
3) == 1) {
                                /* previous state and/or severity in event data 
byte 2 */
                        }
@@ -301,8 +304,9 @@
                        /*
                         * OEM Event
                         */
-                       lprintf(LOG_NOTICE, "%s%s sensor %s %s",
-                               eintf->prefix, type, 
sdr->record.full->id_string, desc ? : "");
+                       lprintf(LOG_NOTICE, "%s%s sensor %s %s %s",
+                               eintf->prefix, type, 
sdr->record.full->id_string, desc ? : "",
+                               evt->sel_type.standard_type.event_dir ? 
"Deasserted" : "Asserted");
                }
                break;

@@ -314,16 +318,18 @@
                                desc ? : "",
                                evt->sel_type.standard_type.event_dir ? 
"Deasserted" : "Asserted");
                } else {
-                       lprintf(LOG_NOTICE, "%s%s sensor %s - %s",
+                       lprintf(LOG_NOTICE, "%s%s sensor %s - %s %s",
                                eintf->prefix, type,
-                               sdr->record.compact->id_string, desc ? : "");
+                               sdr->record.compact->id_string, desc ? : "",
+                               evt->sel_type.standard_type.event_dir ? 
"Deasserted" : "Asserted");
                }
                break;

        default:
-               lprintf(LOG_NOTICE, "%s%s sensor - %s",
+               lprintf(LOG_NOTICE, "%s%s sensor - %s %s",
                        eintf->prefix, type,
-                       evt->sel_type.standard_type.sensor_num, desc ? : "");
+                       evt->sel_type.standard_type.sensor_num, desc ? : "",
+                       evt->sel_type.standard_type.event_dir ? "Deasserted" : 
"Asserted");
                break;
        }

Attachment: ipmievd-syslog-add-direction.patch
Description: Binary data

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to