internal DiscreteEvent(EventLogMsgType MsgType, byte sensorType, byte eventType, byte[] eventPayload)
     : base(MsgType, sensorType, eventType, eventPayload)
 {
     if (MsgType == EventLogMsgType.SensorSpecific
         && sensorType == 42) // add exception for user Id
     {
         byte[] evtData2 = IpmiSharedFunc.ByteSplit(eventPayload[1], new int[2] { 6, 0 });
         evtByte2Severity = evtData2[0];
         evtByte2Reading = evtData2[1];
     }
     else if (MsgType == EventLogMsgType.SensorSpecific
         && sensorType == 43) // add exception for Version Change Type
     {
         evtByte2Reading = eventPayload[1];
     }
     else if (MsgType == EventLogMsgType.SensorSpecific
     && sensorType == 40 && base.Offset == 5)  // add exception for FRU device Id
     {
         // swap event payload with payload 2.
         byte temp = eventPayload[1];
         eventPayload[1] = eventPayload[2];
         eventPayload[2] = temp;
     }
     else
     {
         byte[] evtData2 = IpmiSharedFunc.ByteSplit(eventPayload[1], new int[2] { 4, 0 });
         evtByte2Severity = evtData2[0];
         evtByte2Reading = evtData2[1];
     }
 }
Пример #2
0
 internal DiscreteEvent(EventLogMsgType MsgType, byte sensorType, byte eventType, byte[] eventPayload)
     : base(MsgType, sensorType, eventType, eventPayload)
 {
     if (MsgType == EventLogMsgType.SensorSpecific &&
         sensorType == 42)    // add exception for user Id
     {
         byte[] evtData2 = IpmiSharedFunc.ByteSplit(eventPayload[1], new int[2] {
             6, 0
         });
         evtByte2Severity = evtData2[0];
         evtByte2Reading  = evtData2[1];
     }
     else if (MsgType == EventLogMsgType.SensorSpecific &&
              sensorType == 43) // add exception for Version Change Type
     {
         evtByte2Reading = eventPayload[1];
     }
     else if (MsgType == EventLogMsgType.SensorSpecific &&
              sensorType == 40 && base.Offset == 5) // add exception for FRU device Id
     {
         // swap event payload with payload 2.
         byte temp = eventPayload[1];
         eventPayload[1] = eventPayload[2];
         eventPayload[2] = temp;
     }
     else
     {
         byte[] evtData2 = IpmiSharedFunc.ByteSplit(eventPayload[1], new int[2] {
             4, 0
         });
         evtByte2Severity = evtData2[0];
         evtByte2Reading  = evtData2[1];
     }
 }
Пример #3
0
 public EventLogData(int number, int offset, EventLogMsgType eventLogType, string message, string description)
 {
     this.number = number;
     this.offset = offset;
     this.strType = eventLogType;
     this.message = message;
     this.description = description;
 }
 public EventLogData(int number, int offset, EventLogMsgType eventLogType, string message, string description)
 {
     this.number       = number;
     this.offset       = offset;
     this.messageClass = eventLogType;
     this.message      = message;
     this.description  = description;
 }
Пример #5
0
 internal OemEvent(EventLogMsgType MsgType, byte sensorType, byte eventType, byte[] eventPayload)
     : base(MsgType, sensorType, eventType, eventPayload)
 {
     byte[] evtData2 = IpmiSharedFunc.ByteSplit(eventPayload[1], new int[2] {
         4, 3
     });
     evtByte2Severity = evtData2[0];
     evtByte2Reading  = evtData2[1];
 }
Пример #6
0
        protected EventData(EventLogMsgType MsgType, byte sensorType, byte eventTypeCode, byte[] payload)
        {
            this.messageType  = MsgType;
            this.eventType    = Convert.ToInt32(eventTypeCode);
            this.eventPayload = payload;
            this.sensorType   = Convert.ToInt32(sensorType);

            byte[] evtData1 = IpmiSharedFunc.ByteSplit(eventPayload[0], new int[3] {
                6, 4, 0
            });

            this.evtData1Part1 = Convert.ToInt32(evtData1[0]);
            this.evtData1Part2 = Convert.ToInt32(evtData1[1]);
            this.offset        = Convert.ToInt32(evtData1[2]);
        }
Пример #7
0
 internal UnknownEvent(EventLogMsgType MsgType, byte sensorType, byte eventType, byte[] eventPayload)
     : base(MsgType, sensorType, eventType, eventPayload)
 {
 }
Пример #8
0
 internal OemEvent(EventLogMsgType MsgType, byte sensorType, byte eventType, byte[] eventPayload)
     : base(MsgType, sensorType, eventType, eventPayload)
 {
     byte[] evtData2 = IpmiSharedFunc.ByteSplit(eventPayload[1], new int[2] { 4, 3 });
     evtByte2Severity = evtData2[0];
     evtByte2Reading = evtData2[1];
 }
Пример #9
0
 internal ThresholdEvent(EventLogMsgType MsgType, byte sensorType, byte eventType, byte[] eventPayload)
     : base(MsgType, sensorType, eventType, eventPayload)
 {
     triggerReading = eventPayload[1];
     triggerThreshold = eventPayload[2];
 }
Пример #10
0
        protected EventData(EventLogMsgType MsgType, byte sensorType, byte eventTypeCode, byte[] payload)
        {
            this.messageType = MsgType;
            this.eventType = Convert.ToInt32(eventTypeCode);
            this.eventPayload = payload;
            this.sensorType = Convert.ToInt32(sensorType);

            byte[] evtData1 = IpmiSharedFunc.ByteSplit(eventPayload[0], new int[3] { 6, 4, 0 });

            this.evtData1Part1 = Convert.ToInt32(evtData1[0]);
            this.evtData1Part2 = Convert.ToInt32(evtData1[1]);
            this.offset = Convert.ToInt32(evtData1[2]);
        }
Пример #11
0
        private static List <EventLogData> XmlToObject(string xmlTag, XmlDocument xmlEventLogDoc)
        {
            List <EventLogData> response = new List <EventLogData>();

            try
            {
                XmlNodeList rootNodeList = xmlEventLogDoc.GetElementsByTagName(xmlTag);

                if (rootNodeList.Count > 0)
                {
                    // root level node: EventLogTypeCode
                    foreach (XmlNode root in rootNodeList)
                    {
                        // GenericEvent/SensorSpecificEvent
                        foreach (XmlNode node in root.ChildNodes)
                        {
                            EventLogMsgType clasification = GetEventLogClass(node.Name.ToString());

                            XmlNodeList firstTierNodes = node.ChildNodes;

                            // enumerate first level child nodes
                            foreach (XmlNode firstNode in firstTierNodes)
                            {
                                int    number      = Convert.ToInt32(firstNode.Attributes["Number"].Value.ToString());
                                string description = firstNode.Attributes["ReadingClass"].Value.ToString();

                                XmlNodeList secondTierNodes = firstNode.ChildNodes;

                                // enumerate second level xml nodes
                                foreach (XmlNode secondNode in secondTierNodes)
                                {
                                    int    offset  = Convert.ToInt32(secondNode.Attributes["Number"].Value.ToString());
                                    string message = secondNode.Attributes["Description"].Value.ToString();

                                    EventLogData respObj = new EventLogData(number, offset, clasification, message, description);

                                    XmlNodeList thirdTierNodes = secondNode.ChildNodes;

                                    if (thirdTierNodes.Count > 0)
                                    {
                                        // enumerate third level xml nodes
                                        foreach (XmlNode extension in thirdTierNodes)
                                        {
                                            int    id     = Convert.ToInt32(extension.Attributes["Number"].Value.ToString());
                                            string detail = extension.Attributes["Description"].Value.ToString();

                                            respObj.AddExtension(id, detail);
                                        } // enumerate third level xml nodes
                                    }

                                    response.Add(respObj);
                                } // enumerate second level xml nodes
                            }     // enumerate first level child nodes
                        }         // GenericEvent/SensorSpecificEvent
                    }
                }
                else
                {
                    Tracer.WriteWarning("ERROR: Could not load Event Log Strings, could not find xml root node in file");
                }
            }
            catch (Exception ex)
            {
                Tracer.WriteError(string.Format("ERROR: Could not load Event Log Strings. Error: {0}", ex.ToString()));
            }

            return(response);
        }
Пример #12
0
        public bool logMessage(EventLogMsgType type, string strMessage)
        {
            bool bRes = false;

            try
            {
                //Make string to log
                string strMsg = "";

                switch (type)
                {
                case EventLogMsgType.ELM_TYP_Information:
                    strMsg += "> ";
                    break;

                case EventLogMsgType.ELM_TYP_Warning:
                    strMsg += "Warning> ";
                    break;

                case EventLogMsgType.ELM_TYP_Error:
                    strMsg += "*ERROR*> ";
                    break;

                case EventLogMsgType.ELM_TYP_Critical:
                    strMsg += "**CRITICAL**> ";
                    break;
                }

                //Add local time
                strMsg += DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");

                //Message
                strMsg += ": " + strMessage;

                //New line
                strMsg += "\r\n";


                lock (_lock)
                {
                    try
                    {
                        File.AppendAllText(_strLogFilePath, strMsg, Encoding.UTF8);
                    }
                    catch (Exception ex)
                    {
#if DEBUG
                        throw new Exception("Logging failed: " + ex.ToString());
#else
                        bRes = ex != null && false;
#endif
                    }
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                throw new Exception("Logging failed in general: " + ex.ToString());
#else
                bRes = ex != null && false;
#endif
            }

            return(bRes);
        }
Пример #13
0
 internal UnknownEvent(EventLogMsgType MsgType, byte sensorType, byte eventType, byte[] eventPayload)
     : base(MsgType, sensorType, eventType, eventPayload)
 {
 }
Пример #14
0
 internal ThresholdEvent(EventLogMsgType MsgType, byte sensorType, byte eventType, byte[] eventPayload)
     : base(MsgType, sensorType, eventType, eventPayload)
 {
     triggerReading   = eventPayload[1];
     triggerThreshold = eventPayload[2];
 }