Friday, September 15, 2017
Rescan All HBA of all ESXI in a simple way.
NAGARAJU AVALA
Friday, September 15, 2017
0
For a Specific Cluster:
get-cluster -name “MY CLUSTER” | get-vmhost | Get-VMHostStorage -RescanAllHBA
All Hosts in VC:
get-vmhost | Get-VMHostStorage -RescanAllHBA
Tags
# VMware
Continue Reading
Thursday, September 14, 2017
Repairing Linux ext2 or ext3 FS
NAGARAJU AVALA
Thursday, September 14, 2017
0
Repairing Linux ext2 or ext3 file system
1) File system must be unmounted, you cannot repair it while it is running. Take system down to runlevel one (make sure you run all command as root user):# init 12)Unmount file system, for example if it is /home (/dev/sda3) file system then type command
# umount /home OR# umount /dev/sda3
3) Now run fsck on the partition:
# fsck /dev/sda3
However be sure to specify the file system type using -t option. Recenly one of our sys admin run the command on ext3 file system w/o specifying file system. Result was more corruption as fsck by default assumes ext2 file system.
# fsck -t ext3 /dev/sda3
OR# fsck.ext3 /dev/sda3
Tip if you don't know your file system type then typing mount command will display file system type.
fsck will check the file system and ask which problems should be fixed or corrected. If you don't wanna type y every time then you can use pass -y option to fsck
# fsck -y /dev/sda3
Please not if any files are recovered then they are placed in /home/lost+found directory by fsck command.
4) Once fsck finished, remount the file system:
# mount /home
5) Go to multiuser mode# init 3
Read man page of fsck for more.
How tcpdump command is used to find out the network switch information which is connected to the physical server?
Kalaiselvan Nachimuthu
Thursday, September 14, 2017
0
Run the below tcpdump command on physical server.
[root@testserver001 ~]# tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000'
tcpdump: WARNING: eth0: no IPv4 address assigned
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 1500 bytes
05:51:39.526913 CDPv2, ttl: 180s, checksum: 692 (unverified), length 434
Device-ID (0x01), length: 21 bytes: 'TEST01.switch.com'
Version String (0x05), length: 295 bytes:
Cisco Internetwork Operating System Software
IOS (tm) s72033_rp Software (s72033_rp-ADVIPSERVICESK9_WAN-M), Version 12.2(18)SXF17a, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2010 by cisco Systems, Inc.
Compiled Tue 02-Mar-10 01:50 by tinhuang
Platform (0x06), length: 16 bytes: 'cisco WS-C6506-E'
Address (0x02), length: 13 bytes: IPv4 (1) 159.166.128.131
Port-ID (0x03), length: 16 bytes: 'FastEthernet3/12'
Capability (0x04), length: 4 bytes: (0x00000029): Router, L2 Switch, IGMP snooping
VTP Management Domain (0x09), length: 0 byte: ''
1 packets captured
3 packets received by filter
0 packets dropped by kernel
[root@testserver001 ~]# tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000'
tcpdump: WARNING: eth0: no IPv4 address assigned
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 1500 bytes
05:51:39.526913 CDPv2, ttl: 180s, checksum: 692 (unverified), length 434
Device-ID (0x01), length: 21 bytes: 'TEST01.switch.com'
Version String (0x05), length: 295 bytes:
Cisco Internetwork Operating System Software
IOS (tm) s72033_rp Software (s72033_rp-ADVIPSERVICESK9_WAN-M), Version 12.2(18)SXF17a, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2010 by cisco Systems, Inc.
Compiled Tue 02-Mar-10 01:50 by tinhuang
Platform (0x06), length: 16 bytes: 'cisco WS-C6506-E'
Address (0x02), length: 13 bytes: IPv4 (1) 159.166.128.131
Port-ID (0x03), length: 16 bytes: 'FastEthernet3/12'
Capability (0x04), length: 4 bytes: (0x00000029): Router, L2 Switch, IGMP snooping
VTP Management Domain (0x09), length: 0 byte: ''
1 packets captured
3 packets received by filter
0 packets dropped by kernel
Powershell script to list the Virtual Machines in SCVMM
NAGARAJU AVALA
Thursday, September 14, 2017
0
Windows PowerShell (SCVMM)
SCVMM One-liner command 1: Outputs the VMName, VM Configuration File path, VHDCount, VHD Location, VHDSize, MaxVHDSize, Cluster for all VMs managed by the SCVMM server connected by PowerShell (in a single line)
$report = @(); $vms = get-vm; foreach ($vm in $vms){foreach ($vhd in $vm.VirtualHardDisks){$maxvhdsize = [math]::Round($vhd.MaximumSize/1024/1024/1024,1); $vhdsize = [math]::Round($vhd.Size/1024/1024/1024,1); $row = "" | select VMName, VMCPath, VHDCount, VHDLocation, VHDSize, MaxVHDSize, VMCluster; $row.VMName = $vm.Name; $row.VMCPath = $vm.VMCPath; $row.VHDCount = $vm.VirtualHardDisks.Count; $row.VHDLocation = $vhd.Location; $row.VHDSize = $vhdSize; $row.MaxVHDSIze = $MaxVHDSize; $row.VMCluster = $vm.VMHost.HostCluster.Name; $report += $row;};};$report | export-csv C:\Temp\Hyper-V-VMs.csv -NoTypeInformation
Brief Introduction about Annotation/ custom attributes in Vmware
NAGARAJU AVALA
Thursday, September 14, 2017
0
What are custom attributes?
Custom Attributes are attributes that a administrator can define for all Virtual Machines and Hosts in vCenter. The attributes are then displayed in the “Annotations” box for each VM. The custom attributes are also displayed alongside the VM Name, Status, State, CPU Usage, etc, when listing virtual machines in the Datacenter, cluster, host, and resource pool views.Why use them?
Daily, we receive lots of clone requests for VMs. Clones are very good for application development and application troubleshooting. When an application on a VM goes pear shaped, the application vendor may request a clone for a system. They can then work on the clone system to try and fix some issues while the production system (if not broken completely) may in some cases still remain partially available to the end users. Once they are confident that they have resolved the issue, they can then implement the fix in the production environment.
This is all good and well, but here’s the problem. Clones are a drain on your resources. As administrator, you should be very careful to simply hand out clones as the requests come in. Virtual Machine clones can create a nightmare for administrators as they use huge amounts of additional disk space. Some of the clones we have today are in excess of 420GB. When creating clones, we need to make sure that the following information is recorded somewhere in vCenter:
· Who requested the clone;
· The requestor’s contact number/email address
· The date that the clone was made;
· The size of the clone on disk (all vDisk sizes combined + the amount of RAM assigned to the VM);
· Does it need to be backed up (Yes / No);
· Reason for the clone;
Specifying your own Custom Attributes
Creating custom attributes is very simple. In the VI (or vSphere) client on the menu bar, click “Administration” >> “Custom Attributes...”
You’ll now be presented with the Custom Attributes dialog: You can file them b editing them manually once created.
Tags
# VMware
Continue Reading
Getting ESXi Network driver firmware details by using Script.
NAGARAJU AVALA
Thursday, September 14, 2017
0
Find the script as follows.
$ExportFilePath = "C:\Users\user\Desktop\esxi.txt"
$PuttyUser = "root"
$PuttyPwd = "w2k8the$"
$HostNic = "vmnic0,vmnic1"
$Plink = "C:\Users\user\Desktop\plink.exe"
$PlinkOptions = " -v -batch -pw $PuttyPwd"
$RCommand = '"' + "ethtool -i " + $HostNic + '"'
$ESXHosts = Get-VMHost | where {$_.Model -match "ProLiant BL*"} | Sort Name
$Report = @()
ForEach ($ESXHost in $ESXHosts) {
$Message = ""
$HostInfo = {} | Select HostName,ESXVersion,Cluster,pNic,DriverName,DriverVersion,DriverFirmware
$HostInfo.HostName = $ESXHost.Name
$HostInfo.ESXVersion = $ESXHost.Version
$HostInfo.Cluster = (Get-Cluster -VMHost $ESXHost.Name).Name
$HostInfo.pNic = $HostNic
Write-Host "Connecting to: " $ESXHost.Name -ForegroundColor Green
$Command = $Plink + " " + $PlinkOptions + " " + $PuttyUser + "@" + $ESXHost.Name + " " + $rcommand
$Message = Invoke-Expression -command $command
$HostInfo.DriverName = ($Message[0] -split"driver:")[1]
$HostInfo.DriverVersion = ($Message[1] -split"version:")[1]
$HostInfo.DriverFirmware = ($Message[2] -split"firmware-version:")[1]
$Report += $HostInfo
}
$Report = $Report | Sort-Object HostName
IF ($Report -ne "") {
$Report | Export-Csv $ExportFilePath -NoTypeInformation
}
Invoke-Item $ExportFilePath
$ExportFilePath = "C:\Users\user\Desktop\esxi.txt"
$PuttyUser = "root"
$PuttyPwd = "w2k8the$"
$HostNic = "vmnic0,vmnic1"
$Plink = "C:\Users\user\Desktop\plink.exe"
$PlinkOptions = " -v -batch -pw $PuttyPwd"
$RCommand = '"' + "ethtool -i " + $HostNic + '"'
$ESXHosts = Get-VMHost | where {$_.Model -match "ProLiant BL*"} | Sort Name
$Report = @()
ForEach ($ESXHost in $ESXHosts) {
$Message = ""
$HostInfo = {} | Select HostName,ESXVersion,Cluster,pNic,DriverName,DriverVersion,DriverFirmware
$HostInfo.HostName = $ESXHost.Name
$HostInfo.ESXVersion = $ESXHost.Version
$HostInfo.Cluster = (Get-Cluster -VMHost $ESXHost.Name).Name
$HostInfo.pNic = $HostNic
Write-Host "Connecting to: " $ESXHost.Name -ForegroundColor Green
$Command = $Plink + " " + $PlinkOptions + " " + $PuttyUser + "@" + $ESXHost.Name + " " + $rcommand
$Message = Invoke-Expression -command $command
$HostInfo.DriverName = ($Message[0] -split"driver:")[1]
$HostInfo.DriverVersion = ($Message[1] -split"version:")[1]
$HostInfo.DriverFirmware = ($Message[2] -split"firmware-version:")[1]
$Report += $HostInfo
}
$Report = $Report | Sort-Object HostName
IF ($Report -ne "") {
$Report | Export-Csv $ExportFilePath -NoTypeInformation
}
Invoke-Item $ExportFilePath
Wednesday, September 13, 2017
Collecting diagnostic information of all ESXi By using PowerCLi Script
NAGARAJU AVALA
Wednesday, September 13, 2017
0
VMware Technical Support routinely requests
diagnostic information from you when a support request is handled. This
diagnostic information contains product specific logs, configuration
files, and data appropriate to the situation. The information is
gathered using a specific script or tool for each product and can
include a host support bundle from the ESXi host and vCenter Server
support bundle. Data collected in a host support bundle may be
considered sensitive.
#Variable declaration
$vCenterIPorFQDN="VCName"
$vCenterUsername="domain\user" #Any User name who has access to Vcenter.
$vCenterPassword="xxxx"
$destination ="C:\Users\user\Desktop\naga\" #Location where to download support bundles
Write-Host "Connecting to vCenter" -foregroundcolor "magenta"
Connect-VIServer -Server $vCenterIPorFQDN -User $vCenterUsername -Password $vCenterPassword
$hosts = Get-VMHost #Retrieve all hosts from vCenter
Write-Host "Downloading vCenter support bundle" -foregroundcolor "magenta"
Get-Log -Bundle -DestinationPath $destination
foreach ($esxihost in $hosts){
Write-Host "Downloading support bundle for ESXi host $($esxihost.Name)" -foregroundcolor "magenta"
Get-Log -VMHost (Get-VMHost -Name $esxihost.Name) -Bundle -DestinationPath $destination
}
This article provides the procedures for obtaining this diagnostic
information of all ESX/ESXi hosts
using VMware vSphere PowerCLI.
#Variable declaration
$vCenterIPorFQDN="VCName"
$vCenterUsername="domain\user" #Any User name who has access to Vcenter.
$vCenterPassword="xxxx"
$destination ="C:\Users\user\Desktop\naga\" #Location where to download support bundles
Write-Host "Connecting to vCenter" -foregroundcolor "magenta"
Connect-VIServer -Server $vCenterIPorFQDN -User $vCenterUsername -Password $vCenterPassword
$hosts = Get-VMHost #Retrieve all hosts from vCenter
Write-Host "Downloading vCenter support bundle" -foregroundcolor "magenta"
Get-Log -Bundle -DestinationPath $destination
foreach ($esxihost in $hosts){
Write-Host "Downloading support bundle for ESXi host $($esxihost.Name)" -foregroundcolor "magenta"
Get-Log -VMHost (Get-VMHost -Name $esxihost.Name) -Bundle -DestinationPath $destination
}
Tags
# VMware
Continue Reading