Class: AIX::Errlog::Entry
- Inherits:
-
Object
- Object
- AIX::Errlog::Entry
- Defined in:
- lib/aix/errlog/entry.rb
Overview
An errlog entry class. Used to parse the raw errlog_entry_t struct into a more useful Ruby object.
You shouldn’t need to invoke this class directly; it is generated by the Errlog#forward_each and Errlog#reverse_each.
Unfortunately, the retreived detail and symptom fields aren’t horribly useful, and IBM has presented no API for parsing these correctly, so the only canonical path to getting the correct detail and symptom data is through a call to the errpt command.
Instance Attribute Summary collapse
-
#class ⇒ Object
readonly
Returns the value of attribute class.
-
#connwhere ⇒ Object
readonly
Returns the value of attribute connwhere.
-
#crcid ⇒ Object
readonly
Returns the value of attribute crcid.
-
#dup_count ⇒ Object
readonly
Returns the value of attribute dup_count.
-
#dup_time1 ⇒ Object
readonly
Returns the value of attribute dup_time1.
-
#dup_time2 ⇒ Object
readonly
Returns the value of attribute dup_time2.
-
#errdiag ⇒ Object
readonly
Returns the value of attribute errdiag.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#in ⇒ Object
readonly
Returns the value of attribute in.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#machineid ⇒ Object
readonly
Returns the value of attribute machineid.
-
#magic ⇒ Object
readonly
Returns the value of attribute magic.
-
#nodeid ⇒ Object
readonly
Returns the value of attribute nodeid.
-
#raw_detail ⇒ Object
readonly
Returns the value of attribute raw_detail.
-
#raw_symptom ⇒ Object
readonly
Returns the value of attribute raw_symptom.
-
#rclass ⇒ Object
readonly
Returns the value of attribute rclass.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#rtype ⇒ Object
readonly
Returns the value of attribute rtype.
-
#sequence ⇒ Object
readonly
Returns the value of attribute sequence.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#vpd_ibm ⇒ Object
readonly
Returns the value of attribute vpd_ibm.
-
#vpd_user ⇒ Object
readonly
Returns the value of attribute vpd_user.
-
#wparid ⇒ Object
readonly
Returns the value of attribute wparid.
Instance Method Summary collapse
- #detail ⇒ Object
- #errpt ⇒ Object
-
#initialize(raw) ⇒ Entry
constructor
A new instance of Entry.
- #parse_errpt ⇒ Object
- #symptom ⇒ Object
Constructor Details
#initialize(raw) ⇒ Entry
Returns a new instance of Entry.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/aix/errlog/entry.rb', line 23 def initialize(raw) @magic = raw[:el_magic] @sequence = raw[:el_sequence] @label = raw[:el_label].to_s.freeze @timestamp = Time.at(raw[:el_timestamp]).freeze @crcid = raw[:el_crcid] @errdiag = raw[:el_errdiag] @machineid = raw[:el_machineid].to_s.freeze @nodeid = raw[:el_nodeid].to_s.freeze @class = raw[:el_class].to_s.freeze @type = raw[:el_type].to_s.freeze @resource = raw[:el_resource].to_s.freeze @rclass = raw[:el_rclass].to_s.freeze @rtype = raw[:el_rtype].to_s.freeze @vpd_ibm = raw[:el_vpd_ibm].to_s.freeze @vpd_user = raw[:el_vpd_user].to_s.freeze @in = raw[:el_in].to_s @connwhere = raw[:el_connwhere].to_s.freeze @flags = raw[:el_flags] length = raw[:el_detail_length] @raw_detail = raw[:el_detail_data].to_ptr.get_bytes(0, length).freeze length = raw[:el_symptom_length] @raw_symptom = raw[:el_symptom_data].to_ptr.get_bytes(0, length).freeze @dup_count = raw[:el_errdup][:ed_dupcount] @dup_time1 = Time.at(raw[:el_errdup][:ed_time1]).freeze @dup_time2 = Time.at(raw[:el_errdup][:ed_time2]).freeze @wparid = raw[:el_wparid].to_s.freeze end |
Instance Attribute Details
#class ⇒ Object (readonly)
Returns the value of attribute class.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def class @class end |
#connwhere ⇒ Object (readonly)
Returns the value of attribute connwhere.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def connwhere @connwhere end |
#crcid ⇒ Object (readonly)
Returns the value of attribute crcid.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def crcid @crcid end |
#dup_count ⇒ Object (readonly)
Returns the value of attribute dup_count.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def dup_count @dup_count end |
#dup_time1 ⇒ Object (readonly)
Returns the value of attribute dup_time1.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def dup_time1 @dup_time1 end |
#dup_time2 ⇒ Object (readonly)
Returns the value of attribute dup_time2.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def dup_time2 @dup_time2 end |
#errdiag ⇒ Object (readonly)
Returns the value of attribute errdiag.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def errdiag @errdiag end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def flags @flags end |
#in ⇒ Object (readonly)
Returns the value of attribute in.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def in @in end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def label @label end |
#machineid ⇒ Object (readonly)
Returns the value of attribute machineid.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def machineid @machineid end |
#magic ⇒ Object (readonly)
Returns the value of attribute magic.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def magic @magic end |
#nodeid ⇒ Object (readonly)
Returns the value of attribute nodeid.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def nodeid @nodeid end |
#raw_detail ⇒ Object (readonly)
Returns the value of attribute raw_detail.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def raw_detail @raw_detail end |
#raw_symptom ⇒ Object (readonly)
Returns the value of attribute raw_symptom.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def raw_symptom @raw_symptom end |
#rclass ⇒ Object (readonly)
Returns the value of attribute rclass.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def rclass @rclass end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def resource @resource end |
#rtype ⇒ Object (readonly)
Returns the value of attribute rtype.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def rtype @rtype end |
#sequence ⇒ Object (readonly)
Returns the value of attribute sequence.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def sequence @sequence end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def @timestamp end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def type @type end |
#vpd_ibm ⇒ Object (readonly)
Returns the value of attribute vpd_ibm.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def vpd_ibm @vpd_ibm end |
#vpd_user ⇒ Object (readonly)
Returns the value of attribute vpd_user.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def vpd_user @vpd_user end |
#wparid ⇒ Object (readonly)
Returns the value of attribute wparid.
21 22 23 |
# File 'lib/aix/errlog/entry.rb', line 21 def wparid @wparid end |
Instance Method Details
#detail ⇒ Object
66 67 68 69 |
# File 'lib/aix/errlog/entry.rb', line 66 def detail parse_errpt unless @parsed @detail end |
#errpt ⇒ Object
52 53 54 |
# File 'lib/aix/errlog/entry.rb', line 52 def errpt @errpt ||= %x(errpt -al#{@sequence}).freeze end |
#parse_errpt ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/aix/errlog/entry.rb', line 56 def parse_errpt unless @parsed @detail, @symptom = errpt.match(PARSE_REGEX).captures @detail ||= ''.freeze @symptom ||= ''.freeze @detail.freeze @symptom.freeze @parsed = true end end |
#symptom ⇒ Object
70 71 72 73 |
# File 'lib/aix/errlog/entry.rb', line 70 def symptom parse_errpt unless @parsed @symptom end |