Oct 15

I’m a regular user of the logger command on linux boxes and I’ve found the equivalent in windows. The command is called eventcreate.exe and seems to be present from windows XP forward. To create an informational event in the application log with a message subject of “Test message”, an arbitrary message id of 13 and a message text of “This is a test” you would just run the following


eventcreate /t information /l application /so "Test message" /id 13 /d "This is a test"

More info on eventcreate.exe can be found at microsoft

Oct 13

To find files older than X days on a windows box, you either need the forfiles.exe command installed from the windows resource kit, or a 2003 and newer machine. The command looks like so

forfiles -pC:\TEMP -s -m*.* -d-5 -c"cmd /C echo @PATH\@FILE"

Just replace “-d-5″ with “-d-X” where X is the number of days since a file has been created.

Aug 25

All of the IIS process’s show up as the same process name, which makes it really challenging to figure out which of your websites has lost it’s mind.  In order to trace an IIS website or application pool back to a PID, you just need to open a command prompt and run the iisapp utility.

iisapp

Outputs
W3WP.exe PID: 7424 AppPoolId: Site1
W3WP.exe PID: 8096 AppPoolId: JoesSite
W3WP.exe PID: 13080 AppPoolId: Wookielove.com

And now you can just use taskmanager to track resource usage to a site.

Aug 1

ESXi doesn’t include a lot of the management functions that the licensed product carries (see my previous post on doing backups in ESXi) but most of those functions are already installed, just disabled.   Here is how to enable SNMP queries and traps on an ESXi server.

  1. Enable ssh on your server
  2. I’m assuming you have already licensed your server, we’re going to need to back that out so ssh to the server as root
  3. run the following commands
  4. mv /etc/vmware/vmware.lic /etc/vmware/vmware.lic.orig
    mv /etc/vmware/license.cfg /etc/vmware/license.cfg.orig
    services.sh restart

  5. That will temporarily put you back into an eval license, you will be disconnected from your vsphere client while the services restart
  6. Now you need access to the ESX remote command line. You can do that by either downloading and installing the appliance or you can install it locally on your machine.
  7. Configure SNMP for your environment. -c is the snmp community you want to set for queries and -t is the trap destination
  8. vicfg-snmp.pl –server 192.168.1.1 -c public -t 192.168.1.2@162/public

  9. enable snmp
  10. vicfg-snmp.pl –server 192.168.1.1 -E

  11. Test your new snmp config
  12. vicfg-snmp –server 192.168.1.1 -T

  13. and lastly, download the snmp MIBs for your management platform
  14. Now move your license keys back
  15. mv /etc/vmware/vmware.lic.orig /etc/vmware/vmware.lic
    mv /etc/vmware/license.cfg.orig /etc/vmware/license.cfg
    services.sh restart

And that's it, you have snmp queries and traps on your ESXi server now.

Jul 31

ESXi is one of my favorite products on the market and is really excellent for home use. It’s missing out on a few enterprise features like SNMP (I’ll show you how to get around that in a later post) but is otherwise very complete. I had previously been using a separate storage server using iscsi for my vmfs, but the dependency of the two boxes kept me from shutting down either server as needed. So, I converted everything back to local SATA storage (another post) and went on a hunt for how to backup my VMDKs. My iSCSI SAN had dual power supplies, 2 hot standby drives and I could do snapshot based backups whenever I wanted. My ESXi server has two SATA drives, one power supply and no easy way to backup. Enter GhettoVCB. GhettoVCB is a brilliant little shell script that runs on the ESXi server and performs backups of your vms using snapshots that can be stored on local, attached or network storage.  Getting GhettoVCB up and running isn’t difficult at all, you just need to make sure you have a few things in place first.

  • A place to store the backups (NFS, iSCSI, Local storage and potentially DAS)
  • Decide how many backups you want to have available
  • Decide How you want to store the files (thin, thick, etc) This consideration will impact how many backups you have available because of the different space requirements.
  • And lastly when you want your backups to run.

I’ve decided to take thin copies of my vmdks at midnight every night and store them on an NFS share with 5 backups available before the older ones get replaced.  I’m not going to try to replicate the excellent instructions that already exist for GhettoVCB,  but here is how I did it.

  1. Create an NFS mount on my NFS server with the following options
  2. /mnt/raid5/VMWare       10.0.0.0/24(rw,async,all_squash,anonuid=99,anongid=99)

  3. Mount the NFS share in vSphere and call it Backups
  4. enable ssh on your ESXi server
  5. scp ghettovcb.tar.gz to your ESXi server
  6. untar ghettovcb.tar.gz to /usr/ghettovcb
  7. edit ghettoVCB.sh and change VM_BACKUP_VOLUME to be VM_BACKUP_VOLUME=/vmfs/volumes/Backups
  8. edit DISK_BACKUP_FORMAT to be DISK_BACKUP_FORMAT=thin
  9. edit VM_BACKUP_ROTATION_COUNT to VM_BACKUP_ROTATION_COUNT=5
  10. edit EMAIL_LOG to EMAIL_LOG=0  unless you want to setup logs to be emailed to you.
  11. edit cron by running this command
  12. echo "0 6 * * * /usr/ghettoVCB/ghettoVCB.sh -a > /var/log/ghettoVCB-backup-$(date +\%s).log" >> /var/spool/cron/crontabs/root
    kill $(cat /var/run/crond.pid)
    busybox crond

  13. My cron is set for 6am because my clock is set to UTC, to 6am is midnight for me
  14. Wait until midnight for the cron to run or run it by hand yourself.

Logs will be stored in /var/log/  .  I’m backing up 8 VMs in roughly an hour using about 60GB of space (thin provisioned) and have tested restores successfully. Good luck and let me know if you have any issues!

« Previous Entries Next Entries »