We are using Windows Failover Clusters and would like a sensor to alert when a node is not 'Up' (eg: Paused or Down).
We've previously had a Custom EXEXML sensor working for this, using a custom lookup (state 1 is OK), but it no longer works...
param ( [string]$server ) $s = New-PSSession $server Invoke-Command -Session $s -Scriptblock { $nodes = Get-ClusterNode Write-Output '<prtg>' foreach ($node in $nodes){ Write-Output '<result>' Write-Output '<channel>' + $node.Name + '</channel>' Write-Output '<value>' + (&{If($node.State -ceq 'Up') {1} else {0}}) + '</value>' Write-Output '</result>' } Write-Output '</prtg>' } Remove-PSSession $s
Any suggestions?
Article Comments
Thanks for the response Oscar.
The response in PS is;
<prtg>
<result>
<channel>
+
ServerNode1
+
</channel>
<value>
+
1
+
</value>
</result>
<result>
<channel>
+
ServerNode2
+
</channel>
<value>
+
1
+
</value>
</result>
</prtg>
It seems to be returning the node names (ServerNode1 & 2) & a status (1) in the output, however, it's also putting a '+' before and after each result...
UPDATE: I went through the script and saw the reason it wasn't working... Removed the '+' in the script and hey presto, it works. Funny how you can look at something for so long and completely miss what is right in front of your face :)
May, 2023 - Permalink
Hi Josh,
Thank you for the post, if you execute the ps1 on the probe what is the current output?
Do you see an error in the overview and logs page of the sensor?
Regards, Oscar
May, 2023 - Permalink