Tuesday, February 5, 2013

Isolating Java Process to vCD Job

Let’s assume that one of your vCD cells is using a bit of CPU and you are curious what actual task inside of vCD is requiring all of those resources. Here’s how you can find out.

Get the PID from “top –H –u vcloud”; this is the specific task in vCD as opposed to the vCD general process you will find later. In my case the PID = 16225

Convert this PID to Hex = 3F61 or 0x3F61

Find the vCD Java Process; “ps –auxf |grep vcloud” should return at least 2 results. You want the process that has /opt/vmware/vcloud-director/jre/bin/java.

Get a java thread dump with “kill –3 < vCD Java Process PID>”.

Go search the cell.log (/opt/vmware/vcloud-director/logs) for the Hex value of the process that you are trying to identify. In our case the process we want to investigate is 0x3F61. A quick search for that value brings up the java trace of what vCD is attempting to do.

Friday, January 25, 2013

Java Class Path Error–invalid flag

I’m brand new to Java and by no means a professional coder but due to the nature of my job I have to be able to write a little bit of code in different languages. Yesterday I found out that I needed to be able to write a bit of Java for a project I’m working on so you may see Java related stuff on my blog the next couple days. Here’s the first thing I noticed:
I tried to include a folder of .jar files when I complied my code using the following syntax
javac –cp lib/* test.java
This promptly fails with the error “invalid flag: lib/commons-codec-1.4.jar”
The fix is that apparently you have to put the path inside double quotes like:
javac –cp “lib/*” test.java

On a side note just download a Java IDE like Spring Tool Suite and make your life much easier :)

Tuesday, January 22, 2013

Pushing New Plugin to Hyperic Agents

If you ever update a plugin on your Hyperic Server you may need to push it out to your Hyperic Agents. To do this find you Hyperic Agent under the Servers group. It should look like <Server Name> HQ Agent 5.0.0. Select this and go to the Views tab. From here select Agent Commands and Push Plugin. After pushing your plugin you will need to restart the agent using the same Agent Commands section.

Thursday, January 17, 2013

Apt-Get Proxy Settings

I needed to tell apt-get to use a specific proxy and here is what I found after some googling…

1. Go to /etc/apt/apt.conf.d/

2. Create a new file called “80proxy”

3. Put your proxy information in said file in the following format:

Acquire::http::proxy “http://proxy.domain.com:port/”;

Acquire::https::proxy “http://proxy.domain.com:port/”;

Acquire::ftp::proxy “http://proxy.domain.com:port/”;

Multiple Monitors on Linux Mint XFCE

If you want to run multiple monitors with Linux Mint I found a great way to do it thanks to http://forums.linuxmint.com/viewtopic.php?f=57&t=122367.

sudo apt-get install arandr

Then go to Menu > Settings > ARandR and align the monitors correctly. It’s as easy as it should be.

Tuesday, January 15, 2013

Writing PowerCLI for Performance

I was building a piece of PowerCLU code to check on my vCD Deployed vAPPs for certain errors and because it’s me I was curious what performance difference there was between using array based operations verses piped operations in powershell. Here’s what I found out.

Here is the array based operation – time to completion 2 minutes 30 seconds.

$myVAPP = @(Get-CIVApp | Select-Object Org, Name, Status)
        foreach ($myVAPP.Name in $myVAPP)
            {
                IF ($myVAPP.Status -eq "FailedCreation")
                    {
                        Write-Host 'vAPP' $myVAPP.Name' - Status is' $myVAPP.Status
                    }
                ELSE
                    {
                            IF ($myVAPP.Status -eq "Unresolved")
                            {
                                Write-Host 'vAPP' $myVAPP.Name' - Status is' $myVAPP.Status
                            }
                            else
                            {
                                IF ($myVAPP.Status -eq "Unknown")
                                {
                                    Write-Host 'vAPP' $myVAPP.Name' - Status is' $myVAPP.Status
                                }
                                else
                                {
                                }
                            }                           
                    }
            }
           

Here is the pipe based operation which is recommended for reasons that I now can testify for first hand.

Get-CIVApp -Status "Unresolved", "FailedCreation", "Unknown", "Unrecognized" | Select-Object Org, Name, Status

This operation returned the same results as the array based operation in 14 seconds, that’s 9% of the original time of using an array…

Friday, January 11, 2013

vFabric Hyperic Server Heartbeat

I wrote a quick safety feature for my Hyperic server that monitors the Hyperic Server process every minute and if the Server stops or dies the script will attempt to restart it. Nothing fancy but it’s a nice little feature… plus you can change a couple lines and make one to monitor your Hyperic Agents as well…

#!/usr/bin/perl
# ---------- Hyperic 5.0.0 Server Heartbeat Check ------------
# This script is used to verify that the Hyperic 5.0.0 Server is running and
#    restarts it upon failure. To schedule it to run automatically every
#    minute on linux run the following:
#         crontab -e */1 * * * * <Path to this script>

# NOT SUPPORTED OR PROVIDED BY VMWARE AND HAS NO GUARENTEES

$cmd = "/opt/hyperic/server-5.0.0-EE/bin/hq-server.sh status";
$out = `$cmd`;
# print "Output $cmd\n";
# print "Output Check 1 - $out\n";
if (index($out, "HQ Server is not running") != -1)
        {
                # print "\nHQ Server is dead\n";
# Restart the HQ Service
                $cmd = "/opt/hyperic/server-5.0.0-EE/bin/hq-server.sh start" ;
                $out = `$cmd`;
                # print "Restarting the Service\n $out \n ";
        }
        else
        {
                # print "\nServer is running\n";
        }