Changeset 184

Show
Ignore:
Timestamp:
07/30/08 15:50:56 (4 months ago)
Author:
pwh
Message:
  • app/controllers/device_admin_controller.rb: Add a method, is_online?,
    which will try to GET sysUpTime.0, returning true or false. This
    indicates whether the device is online and manageable.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nethorus/app/controllers/device_admin_controller.rb

    r168 r184  
    5858    if @device.valid? && params[:device] 
    5959     
    60       # Save the record and redirect to the index 
     60      # Save the record and redirect to the calling page 
    6161     
    6262      logger.info "New device valid - saving" 
     
    181181  end 
    182182 
     183 
     184  # Check if a device is online and manageable 
     185   
     186  def is_online? 
     187 
     188    device = Device.find(params[:device_id]) 
     189     
     190    begin 
     191      uptime = device.get_oid('sysUpTime.0') 
     192    rescue 
     193      online_status = :false 
     194    end 
     195     
     196    if uptime 
     197      online_status = :true 
     198    end 
     199   
     200  end 
     201 
    183202end