4 Replies Latest reply on Nov 12, 2019 2:58 PM by bansne

    Get /tmp details for all esxi

    bansne Enthusiast

      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

        • 1. Re: Get /tmp details for all esxi
          LucD Guru
          Community WarriorsUser ModeratorsvExpert

          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

             

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: Get /tmp details for all esxi
            bansne Enthusiast

            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

            • 3. Re: Get /tmp details for all esxi
              LucD Guru
              vExpertUser ModeratorsCommunity Warriors

              You can change the Where-clause

               

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

              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
              1 person found this helpful
              • 4. Re: Get /tmp details for all esxi
                bansne Enthusiast

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