Reply to Message

View discussion in a popup

Replying to:
Marcus316
Enthusiast
Enthusiast

Hi Adriano,

Sorry for the delay in response!

It would not be easy to do that in the script's current form, since it has all the numbers in the script as "Integers".

You could do a check to know if a certain Integer is under a defined threshold(in a certain part of the script, the function), however, the problem is you would have to find a way to add the HTML tags to highlight that number (which is in another part of the script).

Take this function for example :

Function GetVMHostAverageMemoryUsagePercentage ($vmhosttemp) { #For the last 30 days

    $AverageMemoryUsagePercentage = Get-Stat -Entity ($vmhosttemp)-start (get-date).AddDays(-30) -Finish (Get-Date)-MaxSamples 31 -stat mem.usage.average

    $AverageMemoryUsagePercentage = $AverageMemoryUsagePercentage | Measure-Object -Property value -Average

    $AverageMemoryUsagePercentage = $AverageMemoryUsagePercentage.Average   

    $AverageMemoryUsagePercentage = [system.math]::ceiling($AverageMemoryUsagePercentage) # Round up

    return $AverageMemoryUsagePercentage

}

Since this function returns an Integer, and the script later EXPECTS an integer, that would mean you have to do a lot of work to adapt the script to use Strings instead of Integers and then add the highlighting condition.

I've considered adding this feature in the past to my script, however it just seemd like too much work compared to the potential benefit...

Reply
0 Kudos