pages

Wednesday, November 30, 2011

vSphere 5 - VCSA and syslog with graylog2

As you may know the vCenter Server Appliance can act as a syslog server for the ESX host-systems. The appliance logs all messages into a log partition (/storage/log) what´s not a real feature if you or your customer uses a syslog server. My customer actually uses Graylog2 (http://graylog2.org/) which is a real cool tool.









In the base configuration you aren´t able to insert a remote syslog server, so you have to access the vCenter Server appliance with ssh. Here you go to the /etc/syslog-ng directory.

In this directory there is a config file called: syslog-ng.conf which you have to open with an editor (vim/less for example).

Now search the line:
#
# Enable this and adopt IP to send log messages to a log server.
#
#destination logserver { udp("10.10.10.10" port(514)); };
#log { source(src); destination(logserver); };

end enter your syslog host, port. Please don´t forget to remove the # before the line :) After these settings you can enhance the Global Options to send the fully qualified domain name:

options { long_hostnames(off); sync(0); perm(0640); stats(3600); use_fqdn(yes); };

After the changes restart the syslog deamon with /etc/init.d/syslog restart and check with tcpdump port 514 if the packages are send. 









Happy logging!

Thursday, November 24, 2011

vCO - wavemaker, your cloud webservice (part II)

Based on the first article I will show you how to interact with the workflows and give them parameters and receive results. As you might assume this is more complex than only a short "getAllWorkflows", but with wavemaker and some instructions it is much easier than develop web-clients in higher programming languages.

First thing we will need is the workflowId which was displayed in the first tab. To copy the ID from the workflow "getFreeDvPorts" you have to change the options of the dojoGrid.














So the "selectionMode" has to be "extended" which allows you to copy the ID of the workflow. Next thing you have to do is to change the IN parameter of the "getFreeDvPorts" workflow into "dvSwitchName" as String and "NumPorts" as Number. I also added an "CriticalGroups" as Array/String OUT parameter. So the inputs are the name of the dvSwitch and the minimum of free ports the port-groups must have. The output shows all critical port-groups without enough ports.














In wavemaker, under the tab "getInventory" you can now add 4 textfields:
  • username
  • password
  • dvSwitchName
  • FreePorts
and a button called "Submit". I also add a TokenID field to control if the workflow is started. Next button is called "Result" and the "dataGrid" is used to show the OUT results of the workflow. I entered the username and password fixed which makes it a bit easier. The page should look like this:




















First step is to select the submit button and select a new "Service" for the OnClick event. This service I named "executeWf" and select the reference "vCOlab" and the "executeWorkflow" operation. Now the Submit button is linked with the "executeWorkflow" operation. 




As you can see the "executeWorkflow" operation needs different input parameters. The first two: username and password are easy, cause you only have to bind them to the text fields created in the beginning. The third one is the workflow ID of the "getFreeDvPorts" workflow you can copy from the first "getAllWorkflows" tab (extended editor).

The fourth parameter is very special and William Lam (http://www.virtuallyghetto.com/) and I had some sleepless nights to get the right method. The input parameters "workflowInputs" are set as an expression not as Array/List or something. So you have to insert the following in the expression field:
















As you can see the value is linked to the text .dataValue from "dvSwitchName" and "FreeDvPorts". So the name and the ports are defined with the text fields. For the control field you have to link the dataValue of the TokenID field to the return value "id" of the executeWf operation.














This will show the TokenID also when pressing "Submit" and this indicates that the workflow is executed in vCenter Orchestrator.

The next step is to create a new Service for the "Result" button. This is the "getWorkflowTokenResult" operation which also needs some input parameters: username, password and workflowTokenId. The first and second is bind to the appropriate text field. The third one is linked to the TokenId dataValue:












At last you have to bind the dataGrid to the return value of the "getResult" operation. As you can the the empty dataGrid is changed to a name, type and value separation.

If everything is right the execution should look like:
















So, I hope this more complex scenario helps you to speed up your personal cloud portal with wavemaker and vCO.

Have fun!


Wednesday, November 23, 2011

mighty virtualization - layout change

I decided to change the layout to a more dynamic one (thanks blogspot). I think this one looks better and it´s better to read :)

UPDATE: Had to change it back cause the links where broken and displayed wrong :(

Friday, November 18, 2011

vCO - how to determine free dvSwitch ports

Last week one of my customers ask for a method to report the free ports of all dvSwitch port-groups. First step I try was to look in the API explorer for a "freePorts" parameter, but there wasn´t one. So I developed a litte workflow including some loops (Thanks to Christophe for the bookmarked vCOteam article: Creating workflow loops).

The loops are necessary because of the unknown count of port-groups on the dvSwitch. So the whole workflow looks like this:




















The IN parameters are: DVports(String or number) and DVswitch (VC:DistributedVirtualSwitch). The DVports define the minimum available ports for the port groups and the DVswitch is the Switch to test on.

The first element "getAllPortGroups" gets all port-groups and test if it is a uplink port-group which I don´t want to test. The result is an array filled with all port-groups.

var DVSgroups = new Array();
for(i in DVS.portgroup){
if(DVS.portgroup[i].config.name.match("Uplink")){
System.log("Port-group is uplink port-group.");
}
else{
DVSgroups.push(DVS.portgroup[i]);
}
}


The next element "LoopSetup" sets the number of port-groups for the looping (DVSnb = DVSgroups.length;) and the following decision tests if the DVSnb is greater than 0 which allows you to iterate over every port-group. If the decision is true the counter will be lowered in the next step (counter = counter-1;) and the actual port-group is set in the next task (DVportGroup = DVSgroups[DVSnb];).

Now we have one port-group to test on (screenshot, cause the code raises an error in blogspot):


















As you can see I decided to count the connectees (VM Nics) of the port-groups to ensure that double used ports are counted.

I hope this helps you to find some free ports :)

Wednesday, November 16, 2011

vCO - wavemaker, your cloud webservice (part I)

Many of you noticed that VMware acquired wavemaker (acquisition) in march this year. When searching for a WebView (included in vCenter Orchestrator) alternative I decided to take a look on wavemaker. I was really surprised how easy it was to start with a simple web portal as showcase for my customers. The biggest advantage in my opinion is the simple access to the SOAP based vCenter Orchestrator interface which allows you to build web portals an applications without any knowledge of a higher programming language.

With this series I want to show you three examples:

1. Get all Workflows
2. Get free DVS port-group ports
3. Clone a simple VM

After the installation of wavemaker on my MacBook Pro the Wavemaker GUI is shown in my browser (http://localhost:8094/wavemaker/). At first I have to open a new project and define the basic layout (you can customize the layout later):





















I normally use the "no_theme" option because of it´s slick design. Next step is to create a WebService reference under "Service" in the main menu. Please note that you have to install the wsdl4j.jar library first.













I named my reference "vCOreference" and insert several elements in the main layout box: 2 text boxes (name/caption username and password), one button (name/caption Submit) and a datagrid below those elements. I also named the tabs as the further functionality: getAllWorkflows, getInventory and cloneVM. Please note that you have to select "password" for the password textbox to ensure the hidden input.

















Now I select the "Submit" button an pick the "events" text on the right side of the navigation. Then I choose "New Service" for the "OnClick" event. This means that when the button is clicked the service variable is called.


After the selection is made wavemaker switches to the Services view and I choose the service I want to use with the new variable.

Remember the first use case I choose the "getAllWorkflows" method. After this selection I link the input variables (username/password) to the text boxes designed at the beginning of this article.



Now the variables are linked with the inputs of the SOAP call. As you might imagined I want the data grid to show the result of the "getAllWorkflows" method. This is also really simple: Just click on the data grid and click the bracket beside "data set" in the right navigation pane. In the displayed binding list just choose the first (list) parameter.

With this selection the data grid changes it´s layout into the return parameters (id, name, description) automatically. Now you can save the project and press "Run" on top of the page. After giving the credentials and pressing the "Submit" button all workflows are displayed in the data grid.

As you can see I used only 10-15 clicks to establish a SOAP connection and a small web portal. So my opinion is: "Wavemaker rocks!" This is really an alternative to the included WebViews and allows you to build web services and web portals from the scratch without any knowledge in programming languages!