class AIX::Errlog::Entry

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.

Attributes

class[R]
connwhere[R]
crcid[R]
dup_count[R]
dup_time1[R]
dup_time2[R]
errdiag[R]
flags[R]
in[R]
label[R]
machineid[R]
magic[R]
nodeid[R]
raw_detail[R]
raw_symptom[R]
rclass[R]
resource[R]
rtype[R]
sequence[R]
timestamp[R]
type[R]
vpd_ibm[R]
vpd_user[R]
wparid[R]

Public Class Methods

new(raw) click to toggle source
# 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

Public Instance Methods

detail() click to toggle source
# File lib/aix/errlog/entry.rb, line 66
def detail
  parse_errpt unless @parsed
  @detail 
end
errpt() click to toggle source
# File lib/aix/errlog/entry.rb, line 52
def errpt
  @errpt ||= %x(errpt -al#{@sequence}).freeze
end
parse_errpt() click to toggle source
# 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() click to toggle source
# File lib/aix/errlog/entry.rb, line 70
def symptom
  parse_errpt unless @parsed
  @symptom 
end