[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$rgname,
[Parameter(Mandatory=$True,Position=2)]
[string]$rfname,
[Parameter(Mandatory=$True,Position=3)]
[string]$sendingmember,
[Parameter(Mandatory=$True,Position=4)]
[string]$receivingmember,
[Parameter(Mandatory=$True,Position=5)]
[int]$fcount
)
#$content=dfsrdiag backlog /rgname:gmac /rfname:gmac /sendingmember:hsm-fs02 /receivingmember:evi-dfs-p1
$content=dfsrdiag backlog /rgname:$rgname /rfname:$rfname /sendingmember:$sendingmember /receivingmember:$receivingmember
$state1=$content | Select-String -pattern "No Backlog" -Quiet
#Write-Host $content
If ($state1)
{
Write-Host "OK:" $content"|count=0;0;"$fcount
exit (0)
}
Else
{
#$content = "Member <evi-dfs-p1> Backlog File Count: 2 Backlog File Names (first 2 files) 1. E:\Shares\Users\Paula.Norman\Archive 2014.pst 2. E:\Shares\Users\Paula.Norman\archive old pc.pst Operation Succeeded"
$state2=$content | Select-String -pattern "Backlog File Count: (\d+)" -Quiet
[int]$m=$content | Select-String -pattern "Backlog File Count: (\d+)" | ForEach-Object{$_.Matches[0].Groups[1].value}
#Write-Host "match" $m
If ($state2)
{
If ($m -ge $fcount)
{
Write-Host "CRITICAL:" $content"|count="$m";0;"$fcount
exit (2)
}
else
{
Write-Host "WARNING:" $content"|count="$m";0;"$fcount
exit(1)
}
}
}
Write-Host "UNKNOWN: $content Please check running command on the remote server manually|count="$m";0;"$fcount
exit(3)
Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$rgname,
[Parameter(Mandatory=$True,Position=2)]
[string]$rfname,
[Parameter(Mandatory=$True,Position=3)]
[string]$sendingmember,
[Parameter(Mandatory=$True,Position=4)]
[string]$receivingmember,
[Parameter(Mandatory=$True,Position=5)]
[int]$fcount
)
#$content=dfsrdiag backlog /rgname:gmac /rfname:gmac /sendingmember:hsm-fs02 /receivingmember:evi-dfs-p1
$content=dfsrdiag backlog /rgname:$rgname /rfname:$rfname /sendingmember:$sendingmember /receivingmember:$receivingmember
$state1=$content | Select-String -pattern "No Backlog" -Quiet
#Write-Host $content
If ($state1)
{
Write-Host "OK:" $content"|count=0;0;"$fcount
exit (0)
}
Else
{
#$content = "Member <evi-dfs-p1> Backlog File Count: 2 Backlog File Names (first 2 files) 1. E:\Shares\Users\Paula.Norman\Archive 2014.pst 2. E:\Shares\Users\Paula.Norman\archive old pc.pst Operation Succeeded"
$state2=$content | Select-String -pattern "Backlog File Count: (\d+)" -Quiet
[int]$m=$content | Select-String -pattern "Backlog File Count: (\d+)" | ForEach-Object{$_.Matches[0].Groups[1].value}
#Write-Host "match" $m
If ($state2)
{
If ($m -ge $fcount)
{
Write-Host "CRITICAL:" $content"|count="$m";0;"$fcount
exit (2)
}
else
{
Write-Host "WARNING:" $content"|count="$m";0;"$fcount
exit(1)
}
}
}
Write-Host "UNKNOWN: $content Please check running command on the remote server manually|count="$m";0;"$fcount
exit(3)