Monthly Archives: February 2012

Cron Job Reminders

Lately I have found that I need a better system of reminding myself about time sensitive tasks. So after some searching and testing, I have found this solution. The solution is a Cron Job with the notify-send tool. This is particularly useful using Gnome 3.

First run the command crontab -e to in a terminal to edit your cron jobs.

You should now be using VI to edit your Cron Jobs.

Press you are now in insert mode

Then add a line similar to the one below.

0-30/10 13 * * 1-5 DISPLAY=:0.0 notify-send Test “Hello”

The above line adds a notification entitled Test with the message Hello.  It also starts notifying you ever 10 minutes from 1:00PM to 1:30PM daily.  Just delete the line if you do not want it to continue.

Then save and exit, your VI session. Press Esc then type :wq and press Enter.

Advertisements

SSH Tunnel

The other day I came across the need to setup an SSH Tunnel for remote management.  The idea of using an SSH tunnel is that the data going through the tunnel is encrypted.  So an extra layer of security.

This post assumes you know how to do basic networking, setup an ssh server, and reasonable computer skills.

First step is to setup an SSH server within the network you want to tunnel into.

Second allow for the SSH server to be connected to from the outside.

Now the fun begins:

Get outside of your network.

Install an ssh client

Now lets pretend you want to tunnel in and connect to your internal web server.

In a terminal window type the below command.

ssh -L 80:internalwebserver:80 -l username sshserver

Once you enter your password, go to your web browser and go to http://localhost

You should have been directed to your internal web server.

Congratulations you have setup your first successful SSH Tunnel.


Get Total Space Used by VMs

The other day I was in need of finding out how much space my VMs actually take up.  Below are the commands I used in the vSphere PowerCLI to get that information.

      
$TotalDisk = 0;
#Get Sum of all Disks in TBs
Get-VM | Get-HardDisk | %{$TotalDisk+=[int]$_.CapacityKB}
$TotalDisk = $TotalDisk/1024/1024/1024;
echo "$TotalDisk TBs"


vSphere Resource Allocation and Memory Ballooning

Recently I increased the amount of RAM on a VM, but I forgot to increase the Limit – MB under the Resource Allocation tab on the pool. So my VM had 6144MBs of RAM but was only allowed 4096MBs. Because of this the VM tools on the VM thought that the ESX Host was running low on physical memory and started the ballooning process. This caused the memory usage on the VM to go through the roof, causing the VM to have major issues.

To fix this issue, I set the Limit – MB to the amount of memory I had assigned to the VM and the VM’s memory usage drastically went down.

So to summarize my findings… If the Limit – MB is set lower than the amount of memory the VM has, it can cause ballooning. Also if the VM is getting close to using the set limit then it could cause ballooning.

For more information on vSphere Memory usage, and Memory Ballooning check out the links below.
http://www.vmware.com/files/pdf/perf-vsphere-memory_management.pdf
http://www.vmware.com/pdf/vsphere4/r40/vsp_40_resource_mgmt.pdf