What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Make SNMP generate OK or System Error

Votes:

0

This is more something that perhaps other people can use too. PRTG is very good for monitoring value's from SNMP, I use it a lot for my Cisco's, harddisk usage etc. But now I wanted PRTG to generate an error (red button) when the temperature from one of our environment sensors reached a certain value.

So this is how I did that.

1. Installed Simple SNMP Query Tool (http://www.digigrupp.com/ssnmpq/)

2. Build a Powershell script that take parameters and uses the above program :

param([string]$OID,[string]$COMMUNITY,[string]$SHOST,[int]$TVALUE)

$OID = "/o:$OID"

# For a little debugging from my side, can be removed
write-host $OID $COMMUNITY $SHOST $TVALUE 

# Get SNMP values
cd "C:\Program Files\ssnmpq"
$waarde=./ssnmpq.exe /h:$SHOST /c:$COMMUNITY $OID|Select-String Value

# Remove some spaces and stuff
$waarde = $waarde -replace " ",""
$waarde = $waarde -replace "'",""
[int]$waardeg = [int]$waarde.Substring(6)

if ($waardeg -ge $TVALUE)
 {
  write-host $waardeg":NOK"
  exit 2
 }
else
 {
  write-host $waardeg":OK"
  exit 0
 }

3. Created a custom sensor in PRTG which uses (for example) these parameters:
"1.3.6.1.4.1.9.9.13.1.3.1.3.1005" "public" "192.168.1.1" 40

Mind you, I am no programmer so feel free to shoot on this, perhaps I can learn something from it, too :)

powershell prtg snmp

Created on Jul 23, 2010 5:22:11 PM

Last change on Jul 26, 2010 9:58:00 AM by  Daniel Zobel [Product Manager]



2 Replies

Accepted Answer

Votes:

0

Thanks!

But why don't you use an "SNMP Custom" sensor with this OID and set an alarm/warning level in the channels settings?

This will also give you a red sensor if the temperature value is too high.

Created on Jul 28, 2010 3:39:08 PM by  Dirk Paessler [Founder Paessler AG] (11,025) 3 6



Votes:

0

Owww shoot, I didn't knew that was possible hehe I always missed the "Enable Limits" option.

Oh well, perhaps someone can use this example for something else :)

Created on Jul 30, 2010 1:39:44 PM




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.