API Guide

Discover Chassis and contained Blade Servers
Using the predened chassis and server credentials, initiate a discovery request against an IP address that is known to belong to a
Chassis.
require 'ASMConfig'
url = ASM::API::URI('/DiscoveryRequest')
# Get credential ids
creds = ASM::Payload::load_xml('credentials.xml')
server_cred = creds.doc.xpath('//serverCredential').select{|c| c.at_xpath('label').text ==
'Dell PowerEdge Default'}.first.xpath('id').text
chassis_cred = creds.doc.xpath('//chassisCredential').select{|c| c.at_xpath('label').text
== 'Dell chassis default'}.first.xpath('id').text
disc = ASM::Payload::load_xml('discovery_skeleton.xml')
disc.set('deviceStartIp', '172.17.4.17')
disc.set('deviceEndIp', '172.17.4.17')
disc.set('unmanaged', 'false')
disc.appendChildren('DiscoverIPRangeDeviceRequest',
'deviceChassisCredRef' => chassis_cred,
'deviceServerCredRef' => server_cred,
'bDiscoverDevicesInChassis' => 'true')
begin
response = ASM::API::sign {
RestClient.post url, disc.to_xml, :content_type => :xml
}
payload = ASM::Payload.from_xml(response)
# Get the job status
jobStatus = payload.get('DiscoveryRequest/status')
print "<status>%s</status>\n" % jobStatus
rescue RestClient::Exception => e
print "Got exception with status: %d\n" % e.response.code
print "%s\n" % e.response
end
ManagedDevice
ManagedDevice is a generic interface to any Resources on the network which is being managed by ASM. A successful discovery
request results in the creation of instances of ManagedDevice.
Get all Managed Devices
Assuming the Discovery process succeeded, ASM will now know about some or all of the devices available on the network.
require 'ASMConfig'
url = ASM::API::URI('/ManagedDevice')
response = ASM::API::sign {
RestClient.get url
}
doc = Nokogiri::XML(response)
# Print selected info for each device
print "%30s%15s%20s%20s%15s\n" % %w(ServiceTag State IP Model Type)
print
18