how to Get App Information from nats?

11 views
Skip to first unread message

Load Sys

unread,
Jun 24, 2014, 4:01:34 AM6/24/14
to vcap...@cloudfoundry.org
 Hi,Guys! I  want to get app's information,such as cpu_used,memory_used,disk_used, i find two message contain app information one is dea.heartbeat the other is dea.find.droplet message,  the former only containe app's state,the later container app's resource information,following the message:
  class FindDropletResponse
   
def self.generate(bootstrap, instance, request)
      response
= {
       
"dea"             => bootstrap.uuid,
       
"droplet"         => instance.application_id,
       
"version"         => instance.application_version,
       
"instance"        => instance.instance_id,
       
"index"           => instance.instance_index,
       
"state"           => Dea::Instance::State.to_external(instance.state),
       
"state_timestamp" => instance.state_timestamp,
       
"staged"          => "/#{instance.instance_id}",
     
}

     
if request.has_key?("path")
        response
["file_uri_v2"] = bootstrap.directory_server_v2.instance_file_url_for(instance.instance_id, request["path"])
     
end

     
if request["include_stats"] && instance.running?
        response
["stats"] = {
         
"name"       => instance.application_name,
         
"uris"       => instance.application_uris,
         
"host"       => bootstrap.local_ip,
         
"port"       => instance.instance_host_port,
         
"uptime"     => (Time.now - instance.state_starting_timestamp).to_i,
         
"mem_quota"  => instance.memory_limit_in_bytes,
         
"disk_quota" => instance.disk_limit_in_bytes,
         
"fds_quota"  => instance.file_descriptor_limit,
         
"usage"      => {
           
"time" => Time.now.to_s,
           
"cpu"  => instance.computed_pcpu,
           
"mem"  => instance.used_memory_in_bytes,
           
"disk" => instance.used_disk_in_bytes,
         
},
         
# Purposefully omitted, as I'm not sure what purpose it serves.
         
# cores
       
}
     
end

      response
   
end
 
end

dea.find.droplet only return information of app instance,so why we call this message dea.find.droplet,it seem like this message is to find a droplet.

what's important. is there any way for me to get app's information conveniently? Any suggestions will be greatly appreciated.
Reply all
Reply to author
Forward
0 new messages