A320guy Posted December 3, 2009 Share Posted December 3, 2009 Hello there. I thought it would be really great to have a vmware module. I downloaded the vmware sdk for perl and got to work. I successfully suspended a virtual machine using the following perl script from a remote computer. ./vmware-vsphere-cli-distrib/apps/vm/vmcontrol.pl --username root --password mypass --operation poweroff --vmname TestServer --url https://192.168.1.44:443/sdk/webService It works terrifically! Now my problem is trying to integrate it into whmcs. I downloaded the module development kit from whmcs and proceed to create my own server module for vmware. I immeadiately skipped to the suspend account function and put my code in but it just doesn't work inside this moduel, always returns the "Error message goes here" result. Now, obviously, this code will need to be chopped up a bit for variables as you don't want to hard code the ip, username, password, and server name but I thought for a quick trial I would include it all. Please, anyone who can help please do. Here is the function as I have it written. function vmware_SuspendAccount($params) { # Code to perform action goes here... echo exec('./vmware-vsphere-cli-distrib/apps/vm/vmcontrol.pl --username root --password serverdude1 --operation poweroff --vmname Garland_PC --url https://192.168.1.44:443/sdk/webService'); if ($successful) { $result = "success"; } else { $result = "Error message goes here..."; } return $result; } Since all the other modules are encrypted, I have nothing to go by. 0 Quote Link to comment Share on other sites More sharing options...
A320guy Posted December 3, 2009 Author Share Posted December 3, 2009 I would also like to add that when I put the script into a php file and run php from the command line, it does work. 0 Quote Link to comment Share on other sites More sharing options...
A320guy Posted December 4, 2009 Author Share Posted December 4, 2009 I am pleased to report that after much tinkering, I have a functioning vmware module that can suspend and unsuspend an account in vmware. 0 Quote Link to comment Share on other sites More sharing options...
ocosa Posted December 11, 2009 Share Posted December 11, 2009 This is great. I have been speaking with a few people about fully integrating VMware into WHMCS. For provisioning and managing virtual machines for customers. 0 Quote Link to comment Share on other sites More sharing options...
joshabts Posted December 22, 2009 Share Posted December 22, 2009 Any word or progress on this? I am currently in the process of moving our environment to vSphere and using vCenter server for management. I was looking at just writing my own module and using the Web Services API SDK that VMware has published for java and/or perl. If someone has already done this and I am just overlooking it, that would be great to know before I dive in... 0 Quote Link to comment Share on other sites More sharing options...
anandi Posted January 2, 2010 Share Posted January 2, 2010 Hi, Would you care to share how you did the module ? I am writing something myself, could use some help. Thanks 0 Quote Link to comment Share on other sites More sharing options...
blweb Posted March 2, 2010 Share Posted March 2, 2010 Any updates on this? Cheers 0 Quote Link to comment Share on other sites More sharing options...
bitboxes Posted March 2, 2010 Share Posted March 2, 2010 i'm probly way tooo late to answer the first qwestion but i mite as well in case some one else is looking for that answer. at the moment you are runing thecommand (if it works) but not returning an answer to the script i've been working on afew scripts of my own and found that if you dont return an answer the script assumes it failed. try this ...... you need to add some thing to make "$successful" ture like this function vmware_SuspendAccount($params) { # Code to perform action goes here... echo exec('./vmware-vsphere-cli-distrib/apps/vm/vmcontrol.pl --username root --password serverdude1 --operation poweroff --vmname Garland_PC --url https://192.168.1.44:443/sdk/webService'); $successful = "ture"; // you need to add your own checking system to check if the comand worked or not if ($successful) { $result = "success"; } else { $result = "Error message goes here..."; } return $result; } any one feel free to corect me if i'm wrong Tom 0 Quote Link to comment Share on other sites More sharing options...
joshabts Posted March 23, 2010 Share Posted March 23, 2010 I have a pretty good start at a module, waiting on word from the WHMCS developers for a couple things, but I have the basis of the module, features are as follows: - Show basic usage information - Show current vm power status - Provide power control functions (client and admin) - Provisioning vm's - Suspend server during service suspension I will keep you posted as I finish the development. 0 Quote Link to comment Share on other sites More sharing options...
joshabts Posted March 26, 2010 Share Posted March 26, 2010 I have finished the first release version of the module, more info here: http://forum.whmcs.com/showthread.php?t=28313 0 Quote Link to comment Share on other sites More sharing options...
othellotech Posted March 26, 2010 Share Posted March 26, 2010 at the moment you are runing thecommand (if it works) but not returning an answer to the script i've been working on afew scripts of my own and found that if you dont return an answer the script assumes it failed. Only a return result of "success" means it worked - all other returns are treated as an error state/message 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.