Virtualization Related Help!!

Hi,

My script needs to find out if it is running on a virtual machine.
If it is then it needs to find out.
1 . The number of virtual processors.
2 . Actual physical box onto which the virtual machine is hosted.
3 .Processors on the physical machine.

Actually there are some commands like dmidecode psrinfo which can give me processor count and can find out whether script is running on virtual box but I am not able to relate the virtual machine with its physical box.

It would be great help if someone knows and guides me further.

thanks
Prasi

I'm not an expert on virtualization, but I think there is no reliable way to obtain information on your physical host. A non-reliable way would be though:

Many VM network setups route traffic via the host system. So, if you perform a traceroute to some external address (Wikipedia), the first hop *may* be your host.

hth