- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Content translations are temporarily unavailable due to site maintenance. We apologize for any inconvenience. Visit our blog to learn more.
03-17-2021 09:30 AM
We are using PRTG for network monitoring and need to have alerts created and sent when an IPsec tunnel goes down. i found some article for scripts to use with the advanced script sensor, but we run into issues when actually trying to run the script. it seems to just stop the connection and Powershell ISE shows an error for the line invoking the rest method.
Here is the script we are trying to use :
# Disable SSL certificate checking so we can connect to servers using a cert signed by a private CA
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
#Set Powershell to use TLS1.2 when connecting to the Firewall
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12,
[Net.SecurityProtocolType]::Tls11
$VPNTunnelURI = @{uri = "https://(FW IP Address)/api/?type=op&cmd=<show><vpn><ipsec-sa><tunnel>(TUNNEL NAME)</tunnel></ipsec-sa></vpn></show>&key=(Key Removed)";
"Method" = 'GET';
}
#Set Powershell to use TLS1.2 when connecting to the Firewall
#[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
[xml]$VPNTunnelStateXML = Invoke-RestMethod @VPNTunnelURI
$VPNTunnelStateTest = $VPNTunnelStateXML.SelectSingleNode("//response/result/error")
If ($VPNTunnelStateTest -ne $null) {
$VPNTunnelStateResult = 1
}
Else {
$VPNTunnelStateResult = 0
}
Write-Output "STATE"
Write-Output $VPNTunnelStateTest
# XML Output for PRTG
Write-Host "<result>"
"<channel>$VPNTunnelName</channel>"
"<value>$VPNTunnelStateResult</value>"
"<showChart>1</showChart>"
"<showTable>1</showTable>"
"<LimitMaxError>0</LimitMaxError>"
"<LimitMode>1</LimitMode>"
"</result>"
Write-Host "</prtg>"
This is a screen shot of the error we get when testing, upon research it looked like a TLS issue but this is with the script being forced to use TLS1.2 and we verified with wireshark it is connecting over TLS1.2
Looking for any help with the script or another possible method to be able to get tunnel down alerts with PRTG
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!