[Users] Rest-api to fetch the hosts details ( active vm's , CPU , Physical memory etc.)
Michael Pasternak
mpastern at redhat.com
Wed Jan 30 06:22:43 EST 2013
Romil,
On 01/30/2013 12:18 PM, Romil Gupta wrote:
> Hi,
>
> Is this is a right way to get it ??
>
> statistics=params.Host(host.name <http://host.name>).get_statistic()
1. first you need to fetch the host to see it's statistics (by doing params.Host(...) you creating
host parameters holder which is needed for adding new host to the system)
2. get_x() getters used to access object attributes, while collections are exposed as properties, do
1. myhost = api.hosts.get(name="xxx")
2. myhost.statistics.list()
3. loop over returned collection of statistics to find what you're looking for
- note, statistic objects are complex types, you can look for data at:
statistics[i].unit // the unit of the holder data
statistics[i].values.value[0].datum // actual data
> print statistics
>
> summary=params.Host(host.name <http://host.name>).get_summary()
summary() is an api method, do:
1. api = API(url='', username='', password='')
2. api.get_summary()
> print summary
>
>
> Output is : none
>
> Thanks
> Romil
>
>
> On Wed, Jan 30, 2013 at 2:04 PM, Michael Pasternak <mpastern at redhat.com <mailto:mpastern at redhat.com>> wrote:
>
>
> Hi Romil,
>
> On 01/30/2013 10:17 AM, Romil Gupta wrote:
> > Hi all ,
> >
> > how I can get the hosts details like Active VM's ,
>
> host doesn't have running vms attribute, instead you
> can see in the guest on which host it's running,
>
> general system summary you can see at api.get_summary()
>
> Number of CPU's , CPU name , CPU type ,
>
> these are host attributes
>
> Physical Memory (used , free ) , swap size and other parameters
>
> these are host.statistics attributes
>
> > using ovirt-engine-sdk-3.2.0.5-1.
> >
> >
> >
> > Regards,
> > Romil
> >
> > --
> > I don't wish to be everything to everyone, but I would like to be something to someone.
>
>
> --
>
> Michael Pasternak
> RedHat, ENG-Virtualization R&D
>
>
>
>
> --
> I don't wish to be everything to everyone, but I would like to be something to someone.
--
Michael Pasternak
RedHat, ENG-Virtualization R&D
More information about the Users
mailing list