locked
Cluster Memory Check - Available Memory RRS feed

  • Question

  • Hello everyone,


    I have found the below script that give us the Free Memory of a hole cluster, what I am trying to do is to gather al the info from the Free Memory table to create a Total of it, but I don't know how to do this, could you please help me on this?


    ----------------------------------------------------------------------------------------------------------------

    function Get-ClusterNodesMemory
    {
        [CmdletBinding()]
        [Alias()]
        [OutputType([int])]
        Param
        (
            [Parameter(Mandatory=$true,Position=0)]
            [string]$ClusterName
        )
        Begin
        {
        }
        Process {
            foreach ($Cluster in $ClusterName) {
                $ClusterNodes = Get-ClusterNode -Cluster $Cluster | Where-Object {$_.State -ne "Down"}
                $MemoryStatistics = Get-WmiObject win32_operatingsystem -ComputerName $ClusterNodes | Sort-Object -Property FreePhysicalMemory -Descending | Select @{l='ComputerName';e={$_.__SERVER}}, @{l='Free Memory(GB)';e={$_.FreePhysicalMemory / 1MB -as [int]}}, @{l='Total Memory(GB)';e={$_.TotalVisibleMemorySize / 1MB -as [int]}}
                $MemoryStatistics
                }
            }
        End
        {
        }
    }
    Get-ClusterNodesMemory

    -------------------------------------------------------------------------------------------------------------------------------------

    ComputerName                                                  Free Memory(GB)                Total Memory(GB)
    ------------                                                                ---------------                       ----------------
    ServerNode01                                                              286                                    768
    ServerNode02                                                              278                                    768
    ServerNode03                                                              274                                    768
    ServerNode04                                                              247                                    768
    ServerNode05                                                              229                                    768
    ServerNode06                                                              167                                    768

    Total Available Memory:                                                 ?

    In this case the equation should give us 1481, but i don't know how to gather and sum the Free Memory Column.

    Your help will be match appreciate, thanks best regards.

    • Moved by Bill_Stewart Monday, June 6, 2016 9:39 PM This is not "fix/adjust for me this long script I found on the Internet" forum
    Friday, April 29, 2016 1:36 PM

Answers

  • Get-ClusterNodesMemory |Measure-Object -Sum TotalMemory

    \_(ツ)_/

    • Marked as answer by D.M.L Sunday, November 11, 2018 12:28 AM
    Friday, April 29, 2016 2:20 PM

All replies

  • You should ask the author of you script to modify it for you.  We don't fix scripts found on the Internet. We can answer a specific question.

    \_(ツ)_/

    Friday, April 29, 2016 2:12 PM
  • mmmm but i don't want to mod the code, just I want to now how to get the info from the second column, but thanks.
    Friday, April 29, 2016 2:15 PM
  • Get-ClusterNodesMemory |Measure-Object -Sum TotalMemory

    \_(ツ)_/

    • Marked as answer by D.M.L Sunday, November 11, 2018 12:28 AM
    Friday, April 29, 2016 2:20 PM
  • Thanks JRV for that!!!! :):):):)
    Friday, April 29, 2016 2:34 PM
  • Oh.  Ok.  Why didn't you just do that to begin with?

    Anyway - good luck.


    \_(ツ)_/

    Friday, April 29, 2016 2:44 PM
  • Thanks JRV for that!!!! :):):):)

    Did it solve ?? You need to select FreeMemory Column.

    Get-ClusterNodesMemory |Measure-Object -Sum "FreeMemory(GB)"


    Friday, April 29, 2016 6:41 PM
  • Hi Mukesh, yes it worked, thanks!!!!! :)
    Friday, April 29, 2016 7:14 PM