New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Sensor for BGP status

Votes:

0

Your Vote:

Up

Down

I work with BGP in my network. every site have about 5 BGP peers. I know how to monitor a single peer with the OID, but what I realy need is to monitor all of them and find if one of them is in active state. I know that there is OID for the bgp peer table.(1.3.6.1.2.1.15.3) but how can I monitor a snmp table?

Best Regards, Meir

bgp custom-script-exe paetemplate sensor snmp table

Created on Sep 26, 2011 6:41:14 AM by  meirely (0) 1

Last change on Mar 7, 2018 6:49:13 AM by  Luciano Lingnau [Paessler Support]



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

There are two very distinct ways of monitoring BGP Peers in PRTG. Essentially, the "best" solution for you will depend on the number of peers that you have and the granularity you need. If unsure, try the "Device Template" approach first.

Device Template

The most detailed and easier to set-up approach is to use a Custom Device Template, this will deploy one sensor per peer on your BGP Router. The instructions, set-up guide and result are described here:

This approach may be good for small deployments, but if you have dozens or hundreds of peers it becomes unpractical. If you have a highly dynamic deployment (where peers change very frequently) it may also lead to frustration.

Custom Script

The custom script provides a summarized overview of all peers in a single sensor. It focuses on the actual number of peers in each state and will list any "offending" peers in the sensor's message. The setup is more complex and it requires additional software. In its current form it does not support SNMP V3. The instructions, set-up guide and result are described here:

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Mar 6, 2018 1:23:27 PM by  Luciano Lingnau [Paessler Support]

Last change on Mar 19, 2018 6:27:18 PM by  Gerald Schoch [Paessler Support]



37 Replies

Votes:

0

Your Vote:

Up

Down

Hello,

in the moment this is not possible, but considered for a future release of PRTG. Please bear with us.

best regards.

Created on Sep 27, 2011 3:44:32 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello,

I'm looking for a tool to do exactly this. It would be great if I could use PRTG.

Regards, Paul

Created on Jan 10, 2012 8:55:12 AM by  paulskinner (0) 1



Votes:

0

Your Vote:

Up

Down

hi has this function been included in any new releases?

Created on Jun 25, 2012 1:30:13 PM by  roberthillcoat (0) 1



Votes:

0

Your Vote:

Up

Down

Not yet, we are still working on implementing this, albeit I would be hard pressed to give you an ETA. Please bear with us.

Created on Jun 25, 2012 1:48:13 PM by  Patrick Hutter [Paessler Support] (7,104) 3 3



Votes:

0

Your Vote:

Up

Down

How is the implementation of this mesurement going on? Do you have an ETA?

Created on Apr 12, 2013 8:16:06 PM by  Macphisto (0)



Votes:

0

Your Vote:

Up

Down

I'm very much afraid we cannot provide an ETA. What we can say with some certainty, however, is that this is part of a SNMP rewrite in progress, albeit this particular aspect is at the tail end of the task list, so it is highly likely this will take a while. How long, however, is beyond our ability, at the moment. Sorry.

Created on Apr 17, 2013 1:00:18 PM by  Patrick Hutter [Paessler Support] (7,104) 3 3



Votes:

1

Your Vote:

Up

Down

We are monitoring each peer individually to at least have visibility into BGP Peer Status.

Cisco's Documentation

1 : idle
2 : connect
3 : active
4 : opensent
5 : openconfirm
6 : established

Created on Jun 14, 2013 8:04:14 PM by  Randolfini (260) 2 1

Last change on Jul 9, 2015 12:08:40 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thanks Randolfini. I did the same thing like you did eventually. if the sensor value is not 6 (Established), it sets an alarm.

Meir

Created on Jun 17, 2013 8:24:45 AM by  meirely (0) 1



Votes:

0

Your Vote:

Up

Down

Can someone here tell me how to I create this costum sensor on PRTG?

Created on Apr 7, 2015 11:58:14 AM by  madprod209 (0)



Votes:

0

Your Vote:

Up

Down

This can be done with a SNMP Custom sensor and the OID above. Also, use a custom lookup file to make PRTG interpret the various states as OK, Warning and Error.

Created on Apr 7, 2015 12:39:33 PM by  Stephan Linke [Paessler Support]

Last change on Apr 7, 2015 12:40:17 PM by  Stephan Linke [Paessler Support]



Votes:

2

Your Vote:

Up

Down

This article applies to PRTG Network Monitor 15 or later

Monitoring BGP Peer Status using a Custom Script based sensor

You can use an example script written in PowerShell that allows PRTG to monitor the bgpPeerState from the bgpPeerTable as described in the Cisco documentation. Add an EXE/Script Advanced sensor to your PRTG installation and select this script in the sensor settings.

Requirements

  • NET-SNMP Tools installed in the Probe and available "in the path" of the Probe performing the queries. (Windows Download )
  • Powershell Version 3 or above enabled and working on the Probe performing the queries.
  • Monitored Device must respond to SNMP Requests

Logic

The custom EXE/Script sensor will perform a walk at the 1.3.6.1.2.1.15.3.1.2 OID and count the numbers of peers in each state. It will additionally display a message indicating which peers are NOT in the Established state.

Within PRTG this can be very useful together with limits: You can get a warning or error sensor status if any amount of peers in any status goes above or below a limit. The default Warning Limit for the non-primary channels is 1.

Overview Thumbnail
Sensor Overview (Click here to enlarge.)

Settings Thumbnail
Sensor Settings (Click here to enlarge.)

Custom Sensor

The script we provide is a PowerShell script that actually uses the snmpwalk.exe component from NET-SNMP Tools to perform a walk on the SNMP Table from the router.

If the result is valid, it is parsed using substring. Furthermore, the IP addresses are extracted from the string array using the split command.

The result is an XML output that conform with the PRTG API.

Because EXE/Script sensors have a considerable impact on PRTG's performance, Windows Server 2012 R2 is the best probe candidate for this type of sensor.

Usage/Set-up instructions

  1. Copy the code below and paste it in blank notepad document
  2. The file should be saved in the following folder: "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML" with your name of choice. (i.e. Custom Powershell Monitor BGP Peers.ps1)
  3. Head to your device that runs BGP, select Add Sensor, browse and select EXE/Script Advanced Sensor
  4. Select the Script from the drop-down (Custom Powershell Monitor BGP Peers.ps1)
  5. Enter the required parameters -hostaddr '%host' -community '%snmpcommunity'
  6. Save/Continue

Code

This is the code of the custom sensor (also available as download at the top of this post). It can also be downloaded here.

# Monitor Status of BGP Peers in Cisco Devices using bgpPeerState within 1.3.6.1.2.1.15.3.1.2 in PRTG (Summaries) v0.5 10/01/2017
# Originally published here: https://kb.paessler.com/en/topic/25313
#
# Parameters in PRTG should be: 
# -hostaddr '%host' -community '%snmpcommunity' -port '161' -timeout '5'
# Alternatively (without placeholders):
# -hostaddr 'myrouter.domain.tld' -community 'public' -port '161' -timeout '5'
#
# Requites net-snmp installed and in the path since it will use snmpwalk.exe (http://www.net-snmp.org/)
#
# It's recommended to use large scanning intervals for exe/xml scripts. (Not below 300 seconds)


param(
    [string]$hostaddr = "router.domain.tld",
    [string]$community = "public",
    [string]$port = "161",
    [string]$timeout = "5",
    [string]$troubleshooting = 0
)

$version = "0.5"

$queryMeasurement = [System.Diagnostics.Stopwatch]::StartNew()
$walkresult = (snmpwalk.exe -Ln -On -v 2c -c $community $hostaddr":"$port ".1.3.6.1.2.1.15.3.1.2" -t $timeout 2>&1)

if ($troubleshooting -eq 1){
    snmpwalk.exe -Ln -On -v 2c -c $community $hostaddr":"$port ".1.3.6.1.2.1.15.3.1.2" -t $timeout
    Exit
    }

#Check if snmwalk.exe suceeded.
if ($LASTEXITCODE -ne 0 ){
    write-host "<prtg>"
    write-host "<error>1</error>"
    write-host "<text>Error: $($walkresult) / ScriptV: $($version) / PSv: $($PSVersionTable.PSVersion)</text>"
    write-host "</prtg>"
    Exit
}

#Validate output. Expects *INTEGER* in the result. Example: "12.34.56.78 = INTEGER: 6" - String and array have distinc handling.
if (($walkresult -is [String]) -and ($walkresult -notlike "*INTEGER*") -or ($walkresult -is [array]) -and ($walkresult[0].ToString() -notlike "*INTEGER*")){
    write-host "<prtg>"
    write-host "<error>1</error>"
    write-host "<text>Error: $($walkresult) / ScriptV: $($version) / PSv: $($PSVersionTable.PSVersion)</text>"
    write-host "</prtg>"
    Exit
}

$walkresult = $walkresult.Substring(22)
$peersmsg = $null

foreach($entry in $walkresult | where-object { $_ -notlike "*: 6"}){
    $peersmsg += "$($entry.split()[-0]) "
}

$peerstatus = new-object int[] 6
$peerstatus[5] = ($walkresult | where-object { $_ -like "*: 6"}).Count
$peerstatus[4] = ($walkresult | where-object { $_ -like "*: 5"}).Count
$peerstatus[3] = ($walkresult | where-object { $_ -like "*: 4"}).Count
$peerstatus[2] = ($walkresult | where-object { $_ -like "*: 3"}).Count
$peerstatus[1] = ($walkresult | where-object { $_ -like "*: 2"}).Count
$peerstatus[0] = ($walkresult | where-object { $_ -like "*: 1"}).Count

$queryMeasurement.Stop()

write-host "<prtg>"

write-host "<result>"
write-host "<channel>Peers Established</channel>"
write-host "<value>$($peerstatus[5])</value>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Peers OpenConfirm</channel>"
write-host "<value>$($peerstatus[4])</value>"
Write-host "<LimitMode>1</LimitMode>"
write-host "<LimitMaxWarning>1</LimitMaxWarning>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Peers OpenSent</channel>"
write-host "<value>$($peerstatus[3])</value>"
Write-host "<LimitMode>1</LimitMode>"
write-host "<LimitMaxWarning>1</LimitMaxWarning>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Peers Active</channel>"
write-host "<value>$($peerstatus[2])</value>"
Write-host "<LimitMode>1</LimitMode>"
write-host "<LimitMaxWarning>1</LimitMaxWarning>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Peers Connect</channel>"
write-host "<value>$($peerstatus[1])</value>"
Write-host "<LimitMode>1</LimitMode>"
write-host "<LimitMaxWarning>1</LimitMaxWarning>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Peers Idle</channel>"
write-host "<value>$($peerstatus[0])</value>"
Write-host "<LimitMode>1</LimitMode>"
write-host "<LimitMaxWarning>1</LimitMaxWarning>"
write-host "</result>"

Write-Host "<result>"
Write-Host "<channel>Script Execution Time</channel>"
Write-Host "<value>$($queryMeasurement.ElapsedMilliseconds)</value>"
Write-Host "<CustomUnit>msecs</CustomUnit>"
Write-Host "</result>"

if ($peersmsg) {
    write-host "<text>Not Established: $($peersmsg)</text>"
    write-host "<Warning>1</Warning>"
}

write-host "</prtg>"

The script was tested against a router with 65 peers on PRTG 15.3.17, using NET-SNMP 5.5.0 x86 with PRTG/Probe running on Windows Server 2012 R2 x64 (not all versions of windows have the same PowerShell support). Please note that we cannot provide deep technical support for custom scripts.

Version History

0.12015/07Initial Release
0.42017/01Improved error handling and error output. Now includes error details in message.
0.52017/01Even better error handling and logging. :)

Best Regards, Luciano Lingnau

Created on Jul 9, 2015 12:06:48 PM by  Luciano Lingnau [Paessler Support]

Last change on Mar 6, 2018 1:16:36 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

This script works fine for me but I had to update the powershell up to V3 I had V2 on my serveur.

Also make sure you saved the script into folder path "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\"

Thanks for this custom BGP monitoring sensor that is essential in our live now.

Created on Aug 20, 2015 12:57:14 PM by  danielj (0)



Votes:

0

Your Vote:

Up

Down

Hi,

Follow all steps to create the sensor of BGP Status, but, that message appear:

"Última mensagem: XML: O xml retornado não corresponde aos esquemas esperados. (código: PE233) -- JSON: O json retornado não corresponde à estrutura esperada (No mapping for the Unicode character exists in the target multi-byte code page). (código: PE231)"

Created on Sep 19, 2015 2:27:53 PM by  Rodrigo Corte (0)



Votes:

0

Your Vote:

Up

Down

Hello Rodrigo,
Kindly make sure that the probe system is updated to the LATEST PRTG version and meets the following requirements as described above:

  • NET-SNMP Tools installed in the Probe and available "in the path".
  • Powershell Version 3 or above enabled and working
  • Monitored Device must respond to SNMP Requests

Kindly run the powershell-script from powershell's command line to check what result the script provides. if the script works correctly from the console interface, configure the Exe/XML Sensor to "Write EXE result to disk" (within settings) and check the resulting log file under the respective Probe:

C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)\

Kindly note that we cannot provide deep technical support for custom scripts.

Created on Sep 21, 2015 7:17:24 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I did work after adjustment of powershell permissions and changing a little bit the way to run the script. I Create a "bat" script and that call the PSI script. Thats way, works fine.

Thank you so much.

Created on Sep 21, 2015 6:02:11 PM by  Rodrigo Corte (0)



Votes:

0

Your Vote:

Up

Down

HI, This script does not work on snmp v3 because of using public community, would you please give me the equal script work on SNMP V3 (username authProtocol SHA authPassword privProtocol DES privPassword)... Thanks for your cooperation.....

Created on Apr 17, 2016 12:54:34 PM by  farahani (0)



Votes:

0

Your Vote:

Up

Down

It is not working on SNMP V3 configuration on cisco router, what is the correct script (syntax) that use SNMP V3 to walk on MIP and return result???

Created on Apr 17, 2016 1:20:06 PM by  farahani (0)



Votes:

0

Your Vote:

Up

Down

Hello farahani,
thank you for your post.

For SNMP V3 authentication you will need to edit line 16 from the script:

$walkresult = (snmpwalk.exe -Ln -On -v 2c -c $community $hostip":"$port ".1.3.6.1.2.1.15.3.1.2" -t $timeout 2>&1)

For SNMP V3 you need to use -v 3 instead of -v 2c and also replace -c $community with the parameters for SNMP V3 authentication, for instance -aw SomeAuthPass -pp DES pw:SomePrivPass. You can test it by invoking snmpwalk.exe from the command-prompt and try out the credentials, once you get it working update the file/script and set-up the sensor.

Best Regards,

Created on Apr 18, 2016 6:10:39 AM by  Luciano Lingnau [Paessler Support]

Last change on Apr 18, 2016 6:10:47 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi dear support team

unfortunately, I'm confused on script syntax near version 3 of SNMP, would you please give me the correct script syntax from line 8 till line 17 (e.g. HostIp:192.168.1.2 and community = User:abcd AuthenticationType:SHA Password:pass123 EncryptionType:DES EncryptionKey:pass456).

Thanks and Regards

Created on Apr 23, 2016 7:45:05 AM by  farahani (0)

Last change on Apr 25, 2016 7:32:48 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello farahani,
thank you for your reply.

There are several ways to implement SNMP v3 authentications; MD5, SHA, with AES or with DES, so there's no "fit all" solution. Please check NET-SNMP's documentation on SNMP V3 authentication for further details.

Once you get the walk working from the command-line, adjust the required parameters in the script file.

Best Regards,

Created on Apr 25, 2016 7:44:08 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi Dude,

Any news about this feature in future versions? Also want to know if any Script for Mikrotik Core Routers.

Thank you

Created on Jul 20, 2016 11:23:34 PM by  RafaelBarboza (0)



Votes:

0

Your Vote:

Up

Down

Dear Rafael,

Please follow the guide from Luciano (see Answer 2) to create a sensor for the BG Peer Status. For your Mikrotik devices, kindly follow this aritcle.

Best, Felix

Created on Jul 21, 2016 6:34:03 AM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Rafael, thank you for your reply.

Please note that this script is based on Cisco's documentation but the BGP4-MIB is published by the IETF and thus may be implemented by different vendors. The script should be compatible with devices from other vendors as long as they stick to the standard. Feel free to try the script out with your Mikrotik device, if you require assistance with the set-up please contact us via a support ticket.

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Jul 25, 2016 6:27:36 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello, I had some problems also, and I found this:

On the script you need put all path do snmpwalk.exe

On the original script was:

$walkresult = (snmpwalk.exe

I changed to

$walkresult = (C:\usr\bin\snmpwalk.exe

And now it is working fine.

I Hope this can help


Edit: This was the error that the user was encountering:

Response not wellformed: "(snmpwalk.exe : The term 'snmpwalk.exe' 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 correct and try again. At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\Custom Powershell Monitor BGP Peers .ps1:18 char:16 + $walkresult = (snmpwalk.exe -Ln -On -v 2c -c $community $hostip":"$port ".1.3.6. ... + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (snmpwalk.exe:String) [], Comman dNotFoundException + FullyQualifiedErrorId : CommandNotFoundException <prtg> <error>1</error> <text>snmpwalk.exe failed.</text> </prtg> )" (code: PE132)

Created on Jul 27, 2016 2:32:31 PM by  danielnogueira (0)

Last change on Jul 28, 2016 12:14:51 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hey everyone...

I am fairly new to coding and have been running into a brick wall. I am getting the snmpwalk.exe failed error. Some questions...

In the sensor settings there were a few parameters listed:......................................
routeraddress public 161 20

?????Do I need to edit any of these??????

In the script the parameters were listed as follows:.....................................

param(
    [string]$hostip = "localhost",
    [string]$community = "public",
    [string]$port = "161",
    [string]$timeout = "20"
)

????? Do I need to edit any of these????

Questions:

  1. Because I am adding the sensor to the router I want to monitor do I need to change "routeraddress" to the IP of my router? Or is that pulled from PRTG when the script is run.
  2. Our community string is not "public". Is that something I need to change in both the sensor settings parameter AND the param in the script or is this something PRTG will pull down?
  3. When you say snmpwalk.exe needs to be "in path" what exactly do you mean? I updated the path in the script to point to the installation directory of 32bit Net-SNMP. ($walkresult = (D:\net-snmp86\usr\bin\snmpwalk.exe)

Please note:

  • Windows Server 2012
  • Script has been placed in: D:\Program Data\PRTG Network Monitor\Custom Sensors\EXEXML
  • Downloaded and installed 32bit Net-SNMP
  • Updated 32bit Powershell Execution policy to: bypass

Any help would be appreciated. Thank you!

Created on Dec 16, 2016 12:58:49 AM by  Eratone (0)

Last change on Dec 16, 2016 6:37:36 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello Eratone,
thank you for your reply.

The parameters don't need to be edited, but when deploying the sensor, make sure that you configure the correct Parameters. Please refer to the screenshot from the Setup above. I've also created a new section in the guide called Usage/Set-up instructions. Please have a look at it and let me know whenever it helps.

  1. PRTG will only send the router's IP/address to the script if the parameter is configured within the Exe/Script advanced sensor.
  2. If your custom community is configured within PRTG, the %snmpcommunity in PRTG will take care to forward the correct community to the sensor. You could also define it directly within the sensor's settings/setup.
  3. As long as "D:\net-snmp86\usr\bin\" is part of your PATH, powershell should be able to locate this path when it tries to run snmpwalk.exe, changes to the script shouldn't be required.

Please review my replies and refer to the newly added Usage/Set-up instructions in the guide. If you need to further troubleshoot the script, remove the following lines (1824) :

if (($LASTEXITCODE -ne 0) -or ($walkresult -isnot [array])){
    write-host "<prtg>"
    write-host "<error>1</error>"
    write-host "<text>snmpwalk.exe failed.</text>"
    write-host "</prtg>"
    Exit
}

This will throw the whole error/exception as sensor's message. You can then enable the Write EXE result to disk to inspect the actual error/issue. You could also troubleshoot the sensor's execution outside of PRTG by calling-up the script from powershell's command-line and providing the appropriate parameters.

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Dec 16, 2016 8:54:13 AM by  Luciano Lingnau [Paessler Support]

Last change on Dec 16, 2016 8:54:43 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello Luciano,

Thank you for the custom sensor script.

When I setup the script and run it, PRTG throws an "unexpected JSON format" error.

To troubleshoot, I ran the script from powershell CLI, and found that it is throwing the following error, as shown below:

PS D:\Program Files\PRTG Network Monitor\Custom Sensors\EXEXML> .\bgpPeer.ps1 HostIP v2cString
Method invocation failed because [System.Object[]] doesn't contain a method named 'Substring'.
At D:\Program Files\PRTG Network Monitor\Custom Sensors\EXEXML\bgpPeer.ps1:26 char:36
+ $walkresult = $walkresult.Substring <<<< (22)
    + CategoryInfo          : InvalidOperation: (Substring:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

<prtg>
<result>
<channel>Peers Established</channel>
<value>2</value>
</result>
<result>
<channel>Peers OpenConfirm</channel>
<value>0</value>
<LimitMode>1</LimitMode>
<LimitMaxWarning>1</LimitMaxWarning>
</result>
<result>
<channel>Peers OpenSent</channel>
<value>0</value>
<LimitMode>1</LimitMode>
<LimitMaxWarning>1</LimitMaxWarning>
</result>
<result>
<channel>Peers Active</channel>
<value>0</value>
<LimitMode>1</LimitMode>
<LimitMaxWarning>1</LimitMaxWarning>
</result>
<result>
<channel>Peers Connect</channel>
<value>0</value>
<LimitMode>1</LimitMode>
<LimitMaxWarning>1</LimitMaxWarning>
</result>
<result>
<channel>Peers Idle</channel>
<value>0</value>
<LimitMode>1</LimitMode>
<LimitMaxWarning>1</LimitMaxWarning>
</result>
</prtg>
PS D:\Program Files\PRTG Network Monitor\Custom Sensors\EXEXML>

Line 26 of the the script appears to be the same as yours:

$walkresult = $walkresult.Substring(22)

Any ideas?

Created on Dec 16, 2016 4:49:47 PM by  MMueller (0)

Last change on Dec 19, 2016 7:25:49 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi there MMueller,

Which Powershell version are you running? On the PRTG Probe where you're trying to deploy the sensor, please run the following:

$PSVersionTable

The output should look like the following:

PS C:\Users\llingnau> $PSVersionTable

Name                           Value                                                                                                                                                                                                
----                           -----                                                                                                                                                                                                
PSVersion                      5.0.10586.672
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.672
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Dec 19, 2016 7:28:49 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thank you for the reply and your time!

Powershell version was indeed out of date, so I updated it to 3.0. (Windows Server 2008 R2)

Now, the script executes in Powershell CLI without errors, but I am getting a ["Powershell.exe" not found" ] from PRTG.

Any other ideas?

Created on Dec 19, 2016 3:24:11 PM by  MMueller (0)

Last change on Dec 20, 2016 6:48:27 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello MMueller,

Based on the message I guess that powershell.exe is not in your path.

Does the following work from a command prompt in your system?

C:\Users\llingnau>powershell.exe
Windows PowerShell
Copyright (C) 2015 Microsoft Corporation. All rights reserved.

Please refer to the following KB-Post:

You may also want to check out this discussion on Microsoft's Technet:

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Dec 20, 2016 6:48:17 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello, I have tried using this script and get the following error :

XML: The returned xml does not match the expected schema. (code: PE233) -- JSON: The returned json does not match the expected structure (Invalid JSON.). (code: PE231)

Powershell version is the min requirements

Name                           Value
----                           -----
PSVersion                      3.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.17929
BuildVersion                   6.2.9200.16398
PSCompatibleVersions           {1.0, 2.0, 3.0}
PSRemotingProtocolVersion      2.2

any ideas?

Created on Jan 14, 2018 8:45:57 AM by  waynemillskidals (0)

Last change on Jan 15, 2018 10:13:36 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello waynemillskidals,
we appreciate your contact.

Are the other requirements also met?

Please attempt to run the script manually to see how it goes. If it fails you can also attempt to append -troubleshooting 1 to the command-line when running the script interactively, that should give you more details.

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Jan 15, 2018 10:16:09 AM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

For the last output of the script:

if ($peersmsg) {
    write-host "<text>Not Established: $($peersmsg)</text>"
    write-host "<Warning>1</Warning>"
}

Is there a way to include that information in a notification email?

Created on Feb 8, 2018 2:10:00 PM by  cwykoff (0)

Last change on Feb 8, 2018 2:20:45 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hello cwykoff,
thank you for your KB-Post.

<text>Not Established: $($peersmsg)</text> will actually become the sensor's message when there are peers in a state other than Established. This means that if your notification includes the %lastmessage or %message placeholder the list of peers should be part of the notification's content.

This can be configured under Setup > Notifications > (select notification)

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Feb 8, 2018 4:07:39 PM by  Luciano Lingnau [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Perfect, thanks

Created on Feb 8, 2018 7:27:39 PM by  cwykoff (0)



Votes:

0

Your Vote:

Up

Down

This article applies to PRTG Network Monitor 16.3.25 or later

Monitoring BGP Peers using single Sensor per Peer via Device Template

While there are no BGP Peer sensors in PRTG by default, I've put together a couple of lookups and a device template, which can be used to automate the deployment of these sensors using auto-discovery. The sensors will focus on the BGP peer's state.

Adding Custom Sensors using the Auto-Discovery + Template

You can use the device template that we provide below to automatically create custom sensors with the PRTG auto-discovery.

The metrics that are available can vary. The sensors can monitor the following if the data is available:

  • BGP Peer
    • State
    • Admin Status (Started/Stopped)
    • Established Time
    • Established Transitions

The device template creates the available and compatible sensors based on the data at hand. The sensors implement default alerts whenever possible, but you can still fine-tune most channels by defining additional limits in the sensor channels settings or modifying the lookups included by default.

Requirements

  • PRTG Network Monitor 16.3.25 or later
  • Because the device template relies on the auto-discovery process, the device you want to monitor needs to be reachable via PING.
  • SNMP must be enabled and the device must support the BGP4-MIB.

Known Issues and Limitations

  • If a peer's address changes, you will need to handle this manually. This can be done by deleting the sensor and re-running the auto-discovery or by updating the Identifier in the sensor's settings to the new address. You can re-run the auto-discovery as many times as you want, it will never duplicate sensors.
  • To discover new peers automatically, use the Discovery Schedule from within the device's settings
  • PRTG shows some of the alerts as reported by the monitored device via SNMP using lookups. If the status is not reported correctly via SNMP, PRTG cannot detect any issues. For additional alerts, please set up limits for additional channels.
  • This device template was created based on data collected from other customers, so we cannot guarantee that the sensors described above will work on your systems or that the default thresholds are optimal for your use case. Use these components at your own risk. Please test and validate the sensors in your environment after deploying them.

Deployment and Usage

  1. Download the required zip archive containing the template's files here.
  2. Extract the archive to your PRTG program directory. By default, this is %Program Files (x86)%\PRTG Network Monitor\.
  3. In PRTG, restart the core server: open Setup | System Administration | Administrative Tools | Restart Core Server and click Go!. This ensures that the MIB and lookups are loaded before you run the auto-discovery.
  4. Create a new device in PRTG with the address (IP or FQDN) of the device that you want to monitor and configure the SNMP credentials accordingly.
  5. Right-click your new device, select Run Auto Discovery with Template, browse for BGP and select the Custom BGP v4 Peer State v0.x template from the list.
    Note: Using the auto-discovery with a dedicated device template is convenient here because it automates the creation of the custom sensors in an organized fashion.
  6. The sensors are deployed after a couple of seconds.
  7. You can adjust the channel limits or lookups to your needs later.

Result

The resulting sensors look like this:

Device Overview

Device View

Right-click and select Open Image in New Tab for full-screen view

Sensor Overview

Sensor View

Right-click and select Open Image in New Tab for full-screen view

No sensors deployed? :(
Please read ahead for troubleshooting.


Troubleshooting

Have any issues? Please don't hesitate to contact us by replying to this post or via a support ticket. Please make sure to mention this KB post. Please read ahead for troubleshooting steps that you can take in advance.

Auto-Discovery Log

Your auto-discovery log tells you a lot about what went wrong during the sensor's deployment. You can troubleshoot the auto-discovery by inspecting the auto-discovery log. If you get entries like the one below (NOT FOUND), it means that the required protocol or Object Identifier (OID) is not available and the sensors can't be deployed.

[...]
21.08.2017 09:17:17: Template Loaded; Device ID: 22848; Name: Custom BGP v4 Peer State v0.2
21.08.2017 09:17:18: Template Check; Device ID: 22848; Check ID: ping; FOUND
21.08.2017 09:17:19: Template Check; Device ID: 22848; Check ID: snmp; FOUND
21.08.2017 09:17:20: Template Check; Device ID: 22848; Check ID: snmptable_bgpPeerTable; NOT FOUND
[...]

In the example above, some sensors were skipped because the device did not respond to the snmptable_bgpPeerTable check. This means that this data is probably not available on your device. You can track this data by looking for the name after snmptable_. In this case, a search for bgpPeerTable will tell you what OID from what MIB is missing.

You can also use this log to identify if the discovery was interrupted because the device did not respond to PING or to a basic SNMP check.

SNMP Data

If the discovery log is not sufficient, you can review the SNMP data directly from your device. To do so, save the text below (in the white box) as .txt and use it with the Scan Script option in our SNMP Tester. This will allow you to review which SNMP queries succeed and which do not deliver any data. Please have this information at hand when contacting our support team.

--------
Walk Default
--------
hrSystemUptime
walk=1.3.6.1.2.1.25.1.1
--------
MIB-2 System
walk=1.3.6.1.2.1.1
--------
Sensor Specific Queries
----
walk=1.3.6.1.2.1.15.3
---

Version History

VersionDescription
0.1Internal Version
0.2Corrected the sensor naming



Best Regards,
Luciano Lingnau [Paessler Support]

Created on Feb 19, 2018 2:43:20 PM by  Luciano Lingnau [Paessler Support]

Last change on Mar 6, 2018 1:24:22 PM by  Luciano Lingnau [Paessler Support]



Accepted Answer

Votes:

0

Your Vote:

Up

Down

There are two very distinct ways of monitoring BGP Peers in PRTG. Essentially, the "best" solution for you will depend on the number of peers that you have and the granularity you need. If unsure, try the "Device Template" approach first.

Device Template

The most detailed and easier to set-up approach is to use a Custom Device Template, this will deploy one sensor per peer on your BGP Router. The instructions, set-up guide and result are described here:

This approach may be good for small deployments, but if you have dozens or hundreds of peers it becomes unpractical. If you have a highly dynamic deployment (where peers change very frequently) it may also lead to frustration.

Custom Script

The custom script provides a summarized overview of all peers in a single sensor. It focuses on the actual number of peers in each state and will list any "offending" peers in the sensor's message. The setup is more complex and it requires additional software. In its current form it does not support SNMP V3. The instructions, set-up guide and result are described here:

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Mar 6, 2018 1:23:27 PM by  Luciano Lingnau [Paessler Support]

Last change on Mar 19, 2018 6:27:18 PM by  Gerald Schoch [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.