Hi Josh,
we are using a Custom Script Sensor and the modpoll.exe program.
The modpoll program is a command line tool to access a MODBUS System and available at the internet.
Here is the script we are using (not 100% finished):
Param(
[Parameter(Mandatory=$true,Position=1)]
[string]$SlaveIP,
[Parameter(Mandatory=$true,Position=2)]
[string]$SlaveID,
[Parameter(Mandatory=$true,Position=3)]
[int]$ReadAddress,
[Parameter(Mandatory=$false,Position=4)]
[single]$Divisor=1
)
cd "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE"
$Response = @(.\modpoll.exe -m tcp -a $SlaveID -r $ReadAddress -t 3 -1 -0 $SlaveIP)
if ($Response.Count -ge 1)
{
if ($Response[$Response.Count -1].Contains("[$ReadAddress]:"))
{
$TmpResult = $Response[$Response.Count -1].Split(':')
$Result = [single]$TmpResult[1]
if ($Result -le 0)
{
$Result = $Result + 65536
}
$iResult = [single]($Result / $Divisor)
Write-Host "$iResult :OK"
}
}
The script parameter are <MODBUS slave IP or DNS> <Slave address> <MODBUS address to read> <Divisor (optional)>
Hope this helps ;-)
Add comment