lib/junos-ez/utils/re.rb
### ---------------------------------------------------------------
### status - show chassis routing-engine information
### ---------------------------------------------------------------

show chassis routing-engine information
show chassis routing - engine information
def status( opts = {} )
    got = @ndev.rpc.get_route_engine_information
    status_h = {}
    got.xpath('//route-engine').each do |re|
      re_h = {}      
      slot_id = "re" + re.xpath('slot').text
      status_h[slot_id] = re_h
      re_h[:model] = re.xpath('model').text.strip
      re_h[:serialnumber] = re.xpath('serial-number').text.strip
      xml_when_item(re.xpath('mastership-state')){|i| re_h[:mastership] = i.text.strip}
      re_h[:temperature] = {
        :system => re.xpath('temperature').text.strip,
        :cpu => re.xpath('cpu-temperature').text.strip
      }
      re_h[:memory] = {
        :total_size => re.xpath('memory-dram-size').text.to_i,
        :buffer_util => re.xpath('memory-buffer-itilization').text.to_i
      }
      re_h[:cpu_util] = {
        :user => re.xpath('cpu-user').text.to_i,
        :background => re.xpath('cpu-background').text.to_i,
        :system => re.xpath('cpu-system').text.to_i,
        :interrupt => re.xpath('cpu-interrupt').text.to_i,
        :idle => re.xpath('cpu-idle').text.to_i,
      }
      re_h[:uptime] = {
        :at => re.xpath('start-time').text.strip,
        :ago => re.xpath('up-time').text.strip,
        :reboot_reason => re.xpath('last-reboot-reason').text.strip
      }
      re_h[:load_avg] = [
        re.xpath('load-average-one').text.to_f,
        re.xpath('load-average-five').text.to_f,
        re.xpath('load-average-fifteen').text.to_f
      ]
    end
    status_h
  end
def status ( opts = { } ) got = @ndev . rpc . get_route_engine_information status_h = { } got . xpath ( '//route-engine' ) . each do | re | re_h = { } slot_id = "re" + re . xpath ( 'slot' ) . text status_h [ slot_id ] = re_h re_h [ :model ] = re . xpath ( 'model' ) . text . strip re_h [ :serialnumber ] = re . xpath ( 'serial-number' ) . text . strip xml_when_item ( re . xpath ( 'mastership-state' ) ) { | i | re_h [ :mastership ] = i . text . strip } re_h [ :temperature ] = { :system => re . xpath ( 'temperature' ) . text . strip , :cpu => re . xpath ( 'cpu-temperature' ) . text . strip } re_h [ :memory ] = { :total_size => re . xpath ( 'memory-dram-size' ) . text . to_i , :buffer_util => re . xpath ( 'memory-buffer-itilization' ) . text . to_i } re_h [ :cpu_util ] = { :user => re . xpath ( 'cpu-user' ) . text . to_i , :background => re . xpath ( 'cpu-background' ) . text . to_i , :system => re . xpath ( 'cpu-system' ) . text . to_i , :interrupt => re . xpath ( 'cpu-interrupt' ) . text . to_i , :idle => re . xpath ( 'cpu-idle' ) . text . to_i , } re_h [ :uptime ] = { :at => re . xpath ( 'start-time' ) . text . strip , :ago => re . xpath ( 'up-time' ) . text . strip , :reboot_reason => re . xpath ( 'last-reboot-reason' ) . text . strip } re_h [ :load_avg ] = [ re . xpath ( 'load-average-one' ) . text . to_f , re . xpath ( 'load-average-five' ) . text . to_f , re . xpath ( 'load-average-fifteen' ) . text . to_f ] end status_h end
status - show chassis routing-engine information
status - show chassis routing - engine information
opts
<not_specific>