Hi,
I am trying get some info about FailoverCluster Storage from one of the servers. I made a simple script to read percentage free space of shared volumes. I setup UserParameter in config file, restart agent, let agent run under user which can control failover cluster.
But when I try zabbix_get i get Error that I cant load FailoverCluster module. So is my script ok or am I missing something? Also when I want get this key from Zabbix it self i go error "Value Should be a JSON object".
Script:
Import-Module FailoverClusters
$obj =
$objs = @()
$csvs = Get-ClusterSharedVolume
foreach ( $csv in $csvs )
{
$csvinfos = $csv | select -Property Name -ExpandProperty SharedVolumeInfo
$obj = New-Object PSObject -Property @{
'{#Name}' = $csvinfos.Name
'{#PercentFree}' = $csvinfos.Partition.PercentFree
}
$objs += $obj
}
write-host "{"
write-host " `"data`":"
$objs | ConvertTo-Json
write-host
write-host "}"
+ Import-Module FailoverClusters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (FailoverClusters:String) [
Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Comm
ands.ImportModuleCommand
Get-ClusterSharedVolume : The term 'Get-ClusterSharedVolume' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correc
t and try again.
At C:\Zabbix\scripts\get_volperc.ps1:4 char:9
+ $csvs = Get-ClusterSharedVolume
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-ClusterSharedVolume:String)
[], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
{
"data":
}
UserParameter:
UserParameter=volperc.discovery,powershell -NoProfile -executionPolicy Bypass -File C:\Zabbix\scripts\get_volperc.ps1
Error:
+ Import-Module FailoverClusters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (FailoverClusters:String) [
Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Comm
ands.ImportModuleCommand
Get-ClusterSharedVolume : The term 'Get-ClusterSharedVolume' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correc
t and try again.
At C:\Zabbix\scripts\get_volperc.ps1:4 char:9
+ $csvs = Get-ClusterSharedVolume
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-ClusterSharedVolume:String)
[], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
{
"data":
}
I am trying get some info about FailoverCluster Storage from one of the servers. I made a simple script to read percentage free space of shared volumes. I setup UserParameter in config file, restart agent, let agent run under user which can control failover cluster.
But when I try zabbix_get i get Error that I cant load FailoverCluster module. So is my script ok or am I missing something? Also when I want get this key from Zabbix it self i go error "Value Should be a JSON object".
Script:
Import-Module FailoverClusters
$obj =
$objs = @()
$csvs = Get-ClusterSharedVolume
foreach ( $csv in $csvs )
{
$csvinfos = $csv | select -Property Name -ExpandProperty SharedVolumeInfo
$obj = New-Object PSObject -Property @{
'{#Name}' = $csvinfos.Name
'{#PercentFree}' = $csvinfos.Partition.PercentFree
}
$objs += $obj
}
write-host "{"
write-host " `"data`":"
$objs | ConvertTo-Json
write-host
write-host "}"
+ Import-Module FailoverClusters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (FailoverClusters:String) [
Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Comm
ands.ImportModuleCommand
Get-ClusterSharedVolume : The term 'Get-ClusterSharedVolume' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correc
t and try again.
At C:\Zabbix\scripts\get_volperc.ps1:4 char:9
+ $csvs = Get-ClusterSharedVolume
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-ClusterSharedVolume:String)
[], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
{
"data":
}
UserParameter:
UserParameter=volperc.discovery,powershell -NoProfile -executionPolicy Bypass -File C:\Zabbix\scripts\get_volperc.ps1
Error:
+ Import-Module FailoverClusters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (FailoverClusters:String) [
Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Comm
ands.ImportModuleCommand
Get-ClusterSharedVolume : The term 'Get-ClusterSharedVolume' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correc
t and try again.
At C:\Zabbix\scripts\get_volperc.ps1:4 char:9
+ $csvs = Get-ClusterSharedVolume
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-ClusterSharedVolume:String)
[], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
{
"data":
}
Comment