Hi,
I found out this thread Free INODES and % free RAMDISK with exactly what I was looking for.
However, I want export that will list details of only ESXi with more than 50% memory been used under /tmp directory. eq to 100 or maybe greater than 50%.
foreach($esxi in (Get-VMHost)){
$esxcli = Get-EsxCli -vmhost $esxi
$details +=(
$esxcli.system.visorfs.get() |
if ($details | where {$_.'Ramdisk Name' -eq "tmp"}) -eq 100){ write-output $esxi.name}
}
LucD
Regards
You could do something like this
foreach($esxi in (Get-VMHost)){
$esxcli = Get-EsxCli -VMHost $esxi -V2
$report += $esxcli.system.visorfs.ramdisk.list.Invoke() |
where{$_.RamDiskName -eq 'tmp' -and [int]$_.Free -lt 100} |
Add-Member -Name VMHost -Value $esxcli.VMHost.Name -MemberType NoteProperty -PassThru
}
$report | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You could do something like this
foreach($esxi in (Get-VMHost)){
$esxcli = Get-EsxCli -VMHost $esxi -V2
$report += $esxcli.system.visorfs.ramdisk.list.Invoke() |
where{$_.RamDiskName -eq 'tmp' -and [int]$_.Free -lt 100} |
Add-Member -Name VMHost -Value $esxcli.VMHost.Name -MemberType NoteProperty -PassThru
}
$report | Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
The script works i am getting values less than100 and =0 . However , what if i want all values greater than 50% or equal to 100%.
What i want is to check if my /tmp directory is full or about to be full. I got alert on one esxi "The ramdisk 'root' is full. As a result, the file /testfile could not be written." need to validate other hosts stats in vc.
Regards
You can change the Where-clause
where{$_.RamDiskName -eq 'tmp' -and [int]$_.Free -lt 50} |
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your reply. Always been of great help. LucD