'Code' Category

  • Monitoring Large File Copies with Bash and Awk

    May 24, 2011

    I recently came across a server that did not have iostat available and I needed estimate when a certain file copy would complete. In order to make a rough estimate I wrote the following one-liner to summarize the available space in the current working directory, wait a minute and then sum again, subtracting the smaller [...]

  • VMWare PowerCLI Virtual Machine Information

    December 28, 2010

    After having connected to your VC server: Get-VM | select-Object Name, @{ Name=”NumCPU”; Expression={ ($_ | measure-object -property NumCPU -sum).Sum }}, @{ Name=”StorageGB”; Expression={ ($_ | get-harddisk | measure-object -property CapacityKB -sum).Sum / 1024 / 1024 }}, @{ Name=”MemoryGB”; Expression={ ($_ | measure-object -property MemoryMB -sum).Sum / 1024 }} | Format-Table -AutoSize This produces the [...]

  • Python Process Watcher

    December 22, 2010

    Occasionally an application may crash unexpectedly. Instead of reinventing the wheel I found a simple unix/linux daemon in Python for the daemon functionality and just added the run section logic. Using the bits below I can monitor or potentially restart the failed application. The run section forks a daemon which checks for the existence of [...]