Tuesday, July 29, 2014

sigh. i want to rotate this silly svn logs. i put it with the apache2 conf file, because, well, it is controlled by apache. i could totally add more in the first stanza but... the perms are off. root adm is not www-data www-data
 /var/log/apache2/*.log {  
     weekly  
     missingok  
     rotate 52  
     compress  
     delaycompress  
     notifempty  
     create 640 root adm  
     sharedscripts  
     postrotate  
         /etc/init.d/apache2 reload > /dev/null  
     endscript  
     prerotate  
         if [ -d /etc/logrotate.d/httpd-prerotate ]; then \  
             run-parts /etc/logrotate.d/httpd-prerotate; \  
         fi; \  
     endscript  
 }  
 /var/svn/logs/*.log /var/svn/logs/svn_logfile {  
     weekly  
     missingok  
     rotate 52  
     notifempty  
     create 640 www-data www-data  
     sharedscripts  
     postrotate  
         /etc/init.d/apache2 reload > /dev/null  
     endscript  
     compress  
     notifempty  
 }  

Monday, July 28, 2014

double mint gum or svn please give me something useful

and it says, i do, i do (if logs are formatted correctly).
 per: http://svnbook.red-bean.com/en/1.6/svn-book.pdf  
 <Location /svn>  
 DAV svn  
 </Location>  
 CustomLog logs/svn_logfile "%t %u %{SVN-ACTION}e" env=SVN-ACTION  
 
results in this:  
 [26/Jan/2007:22:24:20 -0600] fritz get-dir /tags r1729 props  
 that's not useful.  
 but, more useful than:  
 [26/Jan/2007:22:25:29 -0600] "PROPFIND /svn/calc/!svn/vcc/default HTTP/1.1" 207 398  
 [26/Jan/2007:22:25:29 -0600] "PROPFIND /svn/calc/!svn/bln/59 HTTP/1.1" 207 449  
 [26/Jan/2007:22:25:29 -0600] "PROPFIND /svn/calc HTTP/1.1" 207 647  
 [26/Jan/2007:22:25:29 -0600] "REPORT /svn/calc/!svn/vcc/default HTTP/1.1" 200 607  
 [26/Jan/2007:22:25:31 -0600] "OPTIONS /svn/calc HTTP/1.1" 200 188  
 [26/Jan/2007:22:25:31 -0600] "MKACTIVITY  
 /svn/calc/!svn/act/e6035ef7-5df0-4ac0-b811-4be7c823f998 HTTP/1.1" 201 227  
 gross.  
 But if we do this:  
 CustomLog logs/svn_logfile "%{%Y-%m-%d %T}t %u@%h %>s repo:%{SVN-REPOS-NAME}e %{SVN-ACTION}e (%B Bytes in %T Sec)" env=SVN-ACTION  
 we get this:  
 
[2007-Jan-26 22:22:24:20] fritz@192.168.6.6 200 repo:project get-dir /tags r1729 props (10 Bytes in 10 Sec)   
 (thanks to this: http://peternixon.net/news/2010/04/09/useful-subversion-server-logs-apache-customlog/ for the clue)  
the above only works if have your svn server set up as a Virtual host.  Otherwise, place that line right along with your other log directive.  
reload apache2 and there you go.

log rotation would be a good idea, too.

Thursday, July 24, 2014

ubuntu 10.10 apt.sources

no snappy title.  i'm tired of shifting apt.sources.  is it really needed, all these name and path changes?  oh well, it keeps us sysadmins busy, right?


/etc/apt/sources.list

deb http://old-releases.ubuntu.com/ubuntu/ maverick main restricted
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu/ maverick universe
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates universe
deb http://old-releases.ubuntu.com/ubuntu/ maverick multiverse
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates multiverse
deb http://old-releases.ubuntu.com/ubuntu/ maverick-security main restricted
deb http://old-releases.ubuntu.com/ubuntu/ maverick-security universe
deb http://old-releases.ubuntu.com/ubuntu/ maverick-security multiverse
After updating your file:

sudo apt-get clean
sudo apt-get update

Friday, July 18, 2014

esx is nastay or find tasks and disks and oh my 5.5 you hate my vmtx don't you

Collecting info about tasks in ESX and ESXi

COLLECTING INFORMATION ABOUT TASKS IN VMWARE ESX AND ESXI

Symptoms

While troubleshooting issues with VMware ESX and VMware vCenter, there may be differences between what vCenter and ESX consider tasks. An issue may occur when a task within vCenter server times out, and when attempting to run other tasks, it reports the error:
Another task is already in progress.

Purpose

This article provides steps to collect information about tasks for ESX and ESXi hosts.

Resolution

Note: For more information on resolving the symptoms described above, see Restarting the Management agents on an ESX or ESXi Server (1003490).
If your problem is re-occuring, and you need to find out which task the ESX host is taking a long time to process, you can use the following steps to isolate the task.

ESX

To collect information about tasks for ESX hosts:
  1. Log into the ESX host at the console or via SSH.  For more information, seeUnable to connect to an ESX host using Secure Shell (SSH) (1003807).
  2. In order to get a list of tasks on this host, run the command:

    vmware-vim-cmd vimsvc/task_listThe output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',   'vim.Task:haTask-pool21-vim.ResourcePool.updateConfig-33252',   'vim.Task:haTask-pool22-vim.ResourcePool.updateConfig-33253',   'vim.Task:haTask-pool3-vim.ResourcePool.updateConfig-33254',   'vim.Task:haTask-pool5-vim.ResourcePool.updateConfig-33255',   'vim.Task:haTask-pool6-vim.ResourcePool.updateConfig-33256',   'vim.Task:haTask-pool7-vim.ResourcePool.updateConfig-33257',   'vim.Task:haTask-pool8-vim.ResourcePool.updateConfig-33258',   'vim.Task:haTask-pool10-vim.ResourcePool.updateConfig-33260'
    ]
  3. To get a list of tasks associated to specific virtual machines, you must first get theVmid of the virtual machine. Run the command:

    vmware-vim-cmd vmsvc/getallvmsThe output is similar to:
    Vmid        Name                  File                       Guest OS       Version   Annotation112    VM-1           [Datastore] VM-3/VM-3.vmx      winLonghornGuest        vmx-04128    VM-2           [Datastore] VM-3/VM-3.vmx      winXPProGuest           vmx-04144    VM-3           [Datastore] VM-3/VM-3.vmx      winNetStandardGuest     vmx-04
  4. Make note of the values under the Vmid column as they will be referenced in later steps.
  5. When you have the Vmid, you can then get a list of tasks associated with a specific virtual machine. Run the command:

    vmware-vim-cmd vmsvc/get.tasklist
    where  is the number identified in step 4.

    The output is similar to:
    (ManagedObjectReference) [   'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887']
  6. Make note of the task identifier. In the above example, the task identifier is 3887.
  7. To get information about a particular task's status, run the command:

    vmware-vim-cmd vimsvc/task_info 

    where  is the number recorded in step 6.


    The output is similar to:
    (vmodl.fault.ManagedObjectNotFound) {   dynamicType = ,   faultCause = (vmodl.MethodFault) null,   obj = 'vim.Task:3887',   msg = "The object has already been deleted or has not been completely created",}

ESXi

To collect information about tasks for ESX hosts:
  1. Log into the ESXi host at the console. For more information, see Tech Support Mode for Emergency Support (1003677).
  2. In order to get a list of tasks on this host, run the command:

    vim-cmd vimsvc/task_listThe output is similar to

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',   'vim.Task:haTask-pool21-vim.ResourcePool.updateConfig-33252',   'vim.Task:haTask-pool22-vim.ResourcePool.updateConfig-33253',   'vim.Task:haTask-pool3-vim.ResourcePool.updateConfig-33254',   'vim.Task:haTask-pool5-vim.ResourcePool.updateConfig-33255',   'vim.Task:haTask-pool6-vim.ResourcePool.updateConfig-33256',   'vim.Task:haTask-pool7-vim.ResourcePool.updateConfig-33257',   'vim.Task:haTask-pool8-vim.ResourcePool.updateConfig-33258',   'vim.Task:haTask-pool10-vim.ResourcePool.updateConfig-33260'
    ]
  3. To get a list of tasks associated to specific virtual machines, you must first get theVmid of the virtual machine. Run the command:

    vim-cmd vmsvc/getallvmsThe output is similar to:
    Vmid        Name                  File                       Guest OS       Version   Annotation112    VM-1           [Datastore] VM-3/VM-3.vmx      winLonghornGuest        vmx-04128    VM-2           [Datastore] VM-3/VM-3.vmx      winXPProGuest           vmx-04144    VM-3           [Datastore] VM-3/VM-3.vmx      winNetStandardGuest     vmx-04
  4. Make note of the values under the Vmid column as they will be referenced in later steps.
  5. When you have the Vmid, you can then get a list of tasks associated with a specific virtual machine by running the command:

    vim-cmd vmsvc/get.tasklist
    where  is the number identified in step 4.

    The output is similar to:
    (ManagedObjectReference) [   'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887']
  6. Make note of the task identifier. In the above example, the task identifier is 3887.
  7. To get information about a particular task's status, run the command:

    vim-cmd vimsvc/task_info 

    where  is the number recorded in step 6.


    The output is similar to:
    (vmodl.fault.ManagedObjectNotFound) {   dynamicType = ,   faultCause = (vmodl.MethodFault) null,   obj = 'vim.Task:3887',   msg = "The object has already been deleted or has not been completely created",}
...

Collecting information about tasks in VMware ESXi/ESX (1013003)


Symptoms


  • While troubleshooting issues with ESXi/ESX hosts and VMware vCenter Server, there may be differences between what vCenter Server and an ESXi/ESX host considers tasks. An issue may occur when a task within vCenter Server times out, and when attempting to run other tasks, it reports the error:
Another task is already in progress.

Purpose

This article provides steps to collect information about tasks for ESXi/ESX hosts.

Resolution

Note: For more information on resolving the symptoms described above, see Restarting the Management agents on an ESXi or ESX host (1003490). If your problem is re-occurring, and you must determine which task the ESXi/ESX host is taking a long time to process.

To isolate the task follow the steps for the appropriate host:

ESX hosts

To collect information about tasks for ESX hosts:

  1. Log into the ESX host at the console or via SSH. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807).
  2. To get a list of tasks on the host, run the command:

    vmware-vim-cmd vimsvc/task_list

    The output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',
       'vim.Task:haTask-pool21-vim.ResourcePool.updateConfig-33252',
       'vim.Task:haTask-pool22-vim.ResourcePool.updateConfig-33253',
       'vim.Task:haTask-pool3-vim.ResourcePool.updateConfig-33254',
       'vim.Task:haTask-pool5-vim.ResourcePool.updateConfig-33255',
       'vim.Task:haTask-pool6-vim.ResourcePool.updateConfig-33256',
       'vim.Task:haTask-pool7-vim.ResourcePool.updateConfig-33257',
       'vim.Task:haTask-pool8-vim.ResourcePool.updateConfig-33258',
       'vim.Task:haTask-pool10-vim.ResourcePool.updateConfig-33260'
    ]
  3. To get a list of tasks associated to specific virtual machines, you must first get the Vmid of the virtual machine. Run the command:

    vmware-vim-cmd vmsvc/getallvms

    The output is similar to:

    Vmid  Name   File                        Guest OS              Version   Annotation
    112   VM-1   [Datastore] VM-3/VM-3.vmx   winLonghornGuest      vmx-04
    128   VM-2   [Datastore] VM-3/VM-3.vmx   winXPProGuest         vmx-04
    144   VM-3   [Datastore] VM-3/VM-3.vmx   winNetStandardGuest   vmx-04
  4. Make note of the values under the Vmid column as they will be referenced in later steps.
  5. When you have the Vmid, you can then get a list of tasks associated with a specific virtual machine. Run the command:

    vmware-vim-cmd vmsvc/get.tasklist VMID

    Where VMID is the number identified in step 4.

    The output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887'
    ]
  6. Make note of the task identifier. In the example above, the task identifier is:

    haTask-112-vim.VirtualMachine.createSnapshot-3887
  7. To get information about a particular task's status, run the command:

    vmware-vim-cmd vimsvc/task_info task_identifier

    Where task_identifier is the string recorded in step 6.

    The output is similar to:

    (vim.TaskInfo) {
      dynamicType = ,
      key = "haTask-112-vim.VirtualMachine.createSnapshot-3887",
      task = 'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',
      description = (vmodl.LocalizableMessage) null,
      name = "vim.VirtualMachine.createSnapshot",
      descriptionId = "VirtualMachine.createSnapshot",
      entity = 'vim.VirtualMachine:112',
      entityName = "deploy-test",
      state = "running",
      cancelled = false,
      cancelable = false,
      error = (vmodl.MethodFault) null,
      result = ,
      progress = 15,
      reason = (vim.TaskReasonUser) {
         dynamicType = ,
         userName = "root",
      },
      queueTime = "2012-11-28T01:29:35.233835Z",
      startTime = "2012-11-28T01:29:35.234891Z",
      completeTime = ,
      eventChainId = 2936866,
      changeTag = ,
      parentTaskKey = ,
      rootTaskKey = ,
    }

ESXi hosts

To collect information about tasks for ESXi hosts:

  1. Log into the ESXi host at the console. For more information, see Tech Support Mode for Emergency Support (1003677).
  2. To get a list of tasks on the host, run the command:

    vim-cmd vimsvc/task_list

    The output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',
       'vim.Task:haTask-pool21-vim.ResourcePool.updateConfig-33252',
       'vim.Task:haTask-pool22-vim.ResourcePool.updateConfig-33253',
       'vim.Task:haTask-pool3-vim.ResourcePool.updateConfig-33254',
       'vim.Task:haTask-pool5-vim.ResourcePool.updateConfig-33255',
       'vim.Task:haTask-pool6-vim.ResourcePool.updateConfig-33256',
       'vim.Task:haTask-pool7-vim.ResourcePool.updateConfig-33257',
       'vim.Task:haTask-pool8-vim.ResourcePool.updateConfig-33258',
       'vim.Task:haTask-pool10-vim.ResourcePool.updateConfig-33260'
    ]
  3. To get a list of tasks associated to specific virtual machines, you must first get the Vmid of the virtual machine. Run the command:

    vim-cmd vmsvc/getallvms

    The output is similar to:

    Vmid  Name   File                        Guest OS              Version   Annotation
    112   VM-1   [Datastore] VM-3/VM-3.vmx   winLonghornGuest      vmx-04
    128   VM-2   [Datastore] VM-3/VM-3.vmx   winXPProGuest         vmx-04
    144   VM-3   [Datastore] VM-3/VM-3.vmx   winNetStandardGuest   vmx-04
  4. Make note of the values under the Vmid column as they will be referenced in later steps.
  5. When you have the Vmid, you can then get a list of tasks associated with a specific virtual machine by running the command:

    vim-cmd vmsvc/get.tasklist VMID

    Where VMID is the number identified in step 4.

    The output is similar to:

    (ManagedObjectReference) [
       'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887'
    ]
  6. Make note of the task identifier. In the example above, the task identifier is:

    haTask-112-vim.VirtualMachine.createSnapshot-3887
  7. To get information about a particular task's status, run the command:

    vim-cmd vimsvc/task_info task_identifier

    Where task_identifier is the string recorded in step 6.

    The output is similar to:

     (vim.TaskInfo) {
      dynamicType = ,
      key = "haTask-112-vim.VirtualMachine.createSnapshot-3887",
      task = 'vim.Task:haTask-112-vim.VirtualMachine.createSnapshot-3887',
      description = (vmodl.LocalizableMessage) null,
      name = "vim.VirtualMachine.createSnapshot",
      descriptionId = "VirtualMachine.createSnapshot",
      entity = 'vim.VirtualMachine:112',
      entityName = "deploy-test",
      state = "running",
      cancelled = false,
      cancelable = false,
      error = (vmodl.MethodFault) null,
      result = ,
      progress = 15,
      reason = (vim.TaskReasonUser) {
         dynamicType = ,
         userName = "root",
      },
      queueTime = "2012-11-28T01:29:35.233835Z",
      startTime = "2012-11-28T01:29:35.234891Z",
      completeTime = ,
      eventChainId = 2936866,
      changeTag = ,
      parentTaskKey = ,
      rootTaskKey = ,
    }
...

Converting a template to a virtual machine fails with the error: A component of the virtual machine is not accessible on the host (1021563)


Cause


This issue occurs when a component (for example, a virtual CD-ROM) is attached to the virtual machine but, is no longer accessible or valid.

Resolution


To work around this issue, remove the device from the virtual machine's .vmtx file.
To remove the device from the virtual machine's .vmtx file:
  1. Log in to the ESXi/ESX host service console as root from an Secure Shell (SSH) or directly from the console of the server.f
  2. Unregister the virtual machine from vCenter Server. Right-click the virtual machine and click Remove from Inventory.
  3. Go to the . vmtx file of the virtual machine by going to the Virtual Machines File System (VMFS) volume.cd /vmfs/volumes/LUN_A/virtualmachine
  4. Make a backup of the . vmtx file with the command:cp vm_name.vmtx vm_name.bak
  5. Open the . vmtx file in a text editor and look for entries similar to:ide1:0.clientDevice = "FALSE"
    ide1:0.deviceType = "cdrom-image"
    ide1:0.fileName = "/vmfs/volumes/storage1/ISO/winxp.iso"
    Note: For vSphere 5.5 substitute ide1:0.clientDevice = "FALSE" for ide1:0.present = "FALSE"
  6. Change the entries to:ide1:0.clientDevice = "TRUE"
    ide1:0.deviceType = "atapi-cdrom"
    ide1:0.fileName = "" 

    Note: For vSphere 5.5 substitute ide1:0.clientDevice = "TRUE" for ide1:0.present = "TRUE"
  7. Re-register the virtual machine. 
    To re-register a virtual machine 
    perform one of these options:
  • Re-register a virtual machine on ESX with the command:vmware-cmd –s register vm_name.vmtx
  • Re-register a virtual machine on ESXi with the command:vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmtx

Wednesday, July 16, 2014

tiredserver died now let's clean up or adventures in powercli and finding vmware templates

so tiredserver died and templates are all over the place. where are they, really?
 PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI>   
 foreach($vmhost in get-vmhost){get-template -Location $vmhost | select name,@{n='VMHOST';e={$vmhost.name}},@{n='VMTX';e={$_.extensiondata.config.files.VmPathName}}}  
 Name               VMHOST          VMTX  
 ----                ------           ----  
 win2008                192.168.0.190     [tiredserver] win2k8R2-64-ffan/win2k8R2-64-ffan.vmtx  
 SLES11-64-JAVA1.7-15GB      192.168.0.190     [esx--host05] clone-vm/clone-vm.vmtx  
 SLES11-64          192.168.0.190     [awakeserver] SLES11-64/SLES11-64.vmtx  
 SLES11Clone          192.168.0.190     [esx--host05] SLES11Clone/SLES11Clone.vmtx  
 SLES11-64-JAVA1.7     192.168.0.190     [awakeserver] SLES11-64-JAVA1.7/SLES11-64-JAVA1.7.vmtx  
 win2012-gui           192.168.0.190     [esx--host05] win2012-gui/win2012-gui.vmtx  
 win2012-core          192.168.0.190      [esx--host05] win2012-core/win2012-core.vmtx  
 tmpl               192.168.0.190     [esx--host05] tmpl/tmpl.vmtx  
and then you edit the vmtx files to point somewhere else. and then you register them. yes, you do. vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmtx

Wednesday, July 2, 2014

splunk is happiness

 let's install splunk on ubuntu 12 lts. yes?  
# wget -O splunk-6.0-182037-linux-2.6-amd64.deb 'http://www.splunk.com/page/download_track?file=6.0/splunk/linux/splunk-6.0-182037-linux-2.6-amd64.deb&ac=&wget=true&name=wget&platform=Linux&architecture=x86_64&version=6.0&product=splunkd&typed=release&elq=bca94a89-16b1-4f53-8e04-2424a8c7c4d1'  
 
# dpkg -i splunk-6.0-182037-linux-2.6-amd64.deb  
# cd /opt/splunk/bin  
# ./splunk start  
# ./splunk boot-start  
 
Connect to http://localhost:8000  

Create Syslog Receiver  
      Settings > Data > Data inputs  
      Under "TCP" click "Add New"  
 
      Splunk Data Inputs TCP Add New  
      TCP Port = 514  
      Accept Connections from all hosts? = yes  
      Set sourcetype = From List  
      Select source type from list = syslog  
      Save  
 
      Do the same for UDP  
 
Voila happiness.