VMware {code} Community
tshamul
Contributor
Contributor
Jump to solution

getting service status

Hi,

I have a program that running as service (in windows, or as daemon on linux), there is a way (maybe via the vmware tools), to get the status of my own service inside the virtual machine?

I want to be able to wait for, until the vm it's powered on, or just check my service status, is it possible?

Thank!

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

You would probably run into the same issue with customField, if the information for whatever reason was not captured properly. You probably also know that its not a best practice to have your VMs have access to your management systems such as updating your virtual infrastructure, but if you're aware of that, then your workaround will probably do what you need.

Another idea is to have a custom script that can run on all your guests whether it be for Windows/Linux and have a common repository that all guestVMs can communicate to, say an NFS server. You can have it create a file that provides the status of the services you're interested in, then you can have an administrative VM that will parse these files and then update the customField for each corresponding VM. It's some work but you be able to accomplish the task without having each VM need access to the infrastructure.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
7 Replies
tshamul
Contributor
Contributor
Jump to solution

I forgot to say, my service run into a virtual machine and i am using ESX 4

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

VMware Tools does not provide this capability directly, but with VMware Tools installed, you can utilize VMware VIX which allows you to perform various operations directly against a guest such running a script or copying/uploading files directly onto the guest fileystem. You can easily write a script to check the status of a specific service whether this be on Linux/Windows and then take appropriate action if it has not started. This is done pretty easily with the pre-compiled vmrun binary that is included with VIX, take a look at the VMware documentation for examples and also here: http://engr.ucsb.edu/~duonglt/vmware/#vmware_vix

I do have to warn you, if you're using VIX 1.7 (released just a day ago) it probably will not install properly if you're using Linux without a gnome/kde type desktop environment. It looks like there is a bug with their installer but if you're using a graphical Linux system or using Windows you're fine. VIX 1.6.2 (previous release) works great on both Windows/Linux or on vMA.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

tshamul
Contributor
Contributor
Jump to solution

Thanks!

Hi know vmware vix, but the options of getting a list of proccess or running a guest script\program requires a valid user and password to the guest os.

I have my service on my all virtual machines and i can't know all machines user and password.

There is other way? maybe via the web services SDK?

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

afaik, there is no other way. You'll need to have the credentials for each of the guest that you want to run this in, there are other method via the SDK since this is a guest operation and has nothing to do with managing the VM itself.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

tshamul
Contributor
Contributor
Jump to solution

Thanks again!

I know the SDK not relevant for guest operations, but it's allow me to get some information about the guest operating system as IP address, computer Name etc.

Right now we discover ower service status via the machine extra config, the service set an extra config when it's up 'guest.X', and we read it with the SDK, the problem with this solution, start when the computer power off brutally or when we clone the machine, and the guestinfo information stay as it was.

Maybe there is a way to perform that operation in safer way? maybe we can use customFields or something else?

Thank!

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

You would probably run into the same issue with customField, if the information for whatever reason was not captured properly. You probably also know that its not a best practice to have your VMs have access to your management systems such as updating your virtual infrastructure, but if you're aware of that, then your workaround will probably do what you need.

Another idea is to have a custom script that can run on all your guests whether it be for Windows/Linux and have a common repository that all guestVMs can communicate to, say an NFS server. You can have it create a file that provides the status of the services you're interested in, then you can have an administrative VM that will parse these files and then update the customField for each corresponding VM. It's some work but you be able to accomplish the task without having each VM need access to the infrastructure.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
tshamul
Contributor
Contributor
Jump to solution

Thank you for all you help!

0 Kudos