Automation

 View Only
  • 1.  Get /tmp details for all esxi

    Posted Nov 11, 2019 03:52 AM

    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



  • 2.  RE: Get /tmp details for all esxi
    Best Answer

    Posted Nov 11, 2019 08:22 AM

    You could do something like this

    $report = @()

    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

       



  • 3.  RE: Get /tmp details for all esxi

    Posted Nov 11, 2019 09:28 PM

    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



  • 4.  RE: Get /tmp details for all esxi

    Posted Nov 12, 2019 06:27 AM

    You can change the Where-clause

    where{$_.RamDiskName -eq 'tmp' -and [int]$_.Free -lt 50} |



  • 5.  RE: Get /tmp details for all esxi

    Posted Nov 12, 2019 10:58 PM

    Thanks for your reply. Always been of great help.  :smileyhappy: LucD