In vCheck daily report we have option to set threshold for Datastore free space and the threshold is configure for all the datastores under vCenter. Is there any way where I can configure differnt threshold for a specific size of Datastore? Like Datastore Free space threshold should be 10% for the 4TB Datastores and for all other Datastore size free-space threshold should be 15%
Plugin "03 Datastore Information", which is the one you are talking about I guess, only uses one threshold, namely the 15% defined in the $DatastoreSpace variable.
Changing this in the vCheck main function and settings file would be a breaking change to vCheck I'm afraid.
But you could adapt the plugin, something like this
# Start of Settings
# Set the warning threshold for Datastore % Free Space
$DatastoreSpace = "15"
$bigDatastoreSpace = "10"
# Do not report on any Datastores that are defined here (Datastore Free Space Plugin)
$DatastoreIgnore = "local"
# End of Settings
# Update settings where there is an override
$DatastoreSpace = Get-vCheckSetting $Title "DatastoreSpace" $DatastoreSpace
$DatastoreIgnore = Get-vCheckSetting $Title "DatastoreIgnore" $DatastoreIgnore
$Datastores | Where-Object {$_.Name -notmatch $DatastoreIgnore} |
Select-Object Name, Type,
@{N="CapacityGB";E={[math]::Round($_.CapacityGB,2)}},
@{N="FreeSpaceGB";E={[math]::Round($_.FreeSpaceGB,2)}},
PercentFree|
Sort-Object PercentFree |
Where-Object {($_.CapacityGB -le 4KB -and $_.PercentFree -lt $DatastoreSpace) -or ($_.CapacityGB -gt 4KB -and $_.PercentFree -lt $bigDatastoreSpace)}
But the problem would be in formatting the resulting table.
The following lines can not easily be converted, since the 15% part is hard-coded.
$Header = "Datastores (Less than $DatastoreSpace% Free) : [count]"
$TableFormat = @{"PercentFree" = @(@{ "-le 15" = "Row,class|warning"; },
@{ "-le 10" = "Row,class|critical" });
"CapacityGB" = @(@{ "-lt 499.75" = "Cell,style|background-color: #FFDDDD"})
}
The best/most elegant solution imho would be to create a new plugin for those +4TB datastores, and ignore these datastores on the original plugin.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Plugin "03 Datastore Information", which is the one you are talking about I guess, only uses one threshold, namely the 15% defined in the $DatastoreSpace variable.
Changing this in the vCheck main function and settings file would be a breaking change to vCheck I'm afraid.
But you could adapt the plugin, something like this
# Start of Settings
# Set the warning threshold for Datastore % Free Space
$DatastoreSpace = "15"
$bigDatastoreSpace = "10"
# Do not report on any Datastores that are defined here (Datastore Free Space Plugin)
$DatastoreIgnore = "local"
# End of Settings
# Update settings where there is an override
$DatastoreSpace = Get-vCheckSetting $Title "DatastoreSpace" $DatastoreSpace
$DatastoreIgnore = Get-vCheckSetting $Title "DatastoreIgnore" $DatastoreIgnore
$Datastores | Where-Object {$_.Name -notmatch $DatastoreIgnore} |
Select-Object Name, Type,
@{N="CapacityGB";E={[math]::Round($_.CapacityGB,2)}},
@{N="FreeSpaceGB";E={[math]::Round($_.FreeSpaceGB,2)}},
PercentFree|
Sort-Object PercentFree |
Where-Object {($_.CapacityGB -le 4KB -and $_.PercentFree -lt $DatastoreSpace) -or ($_.CapacityGB -gt 4KB -and $_.PercentFree -lt $bigDatastoreSpace)}
But the problem would be in formatting the resulting table.
The following lines can not easily be converted, since the 15% part is hard-coded.
$Header = "Datastores (Less than $DatastoreSpace% Free) : [count]"
$TableFormat = @{"PercentFree" = @(@{ "-le 15" = "Row,class|warning"; },
@{ "-le 10" = "Row,class|critical" });
"CapacityGB" = @(@{ "-lt 499.75" = "Cell,style|background-color: #FFDDDD"})
}
The best/most elegant solution imho would be to create a new plugin for those +4TB datastores, and ignore these datastores on the original plugin.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
