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

How can I specify "No such instance" (SNMP error # 223) as Normal/Ok?

Votes:

0

Using an SNMP Custom String sensor, how can I specify "No such instance" (SNMP error # 223) as Normal/Ok?

I have a device with dry contacts that can be monitored with SNMP. When the contacts are "closed" I get an SNMP response as "High Temperature" which is pretty easy to alert off of with configuring the settings to "Response Must Not Include" to "High Temperature". The problem is that when the contacts are "open", the SNMP response is "No such instance". So is there a way to configure PRTG to show green and "Ok" when the device responds with "No such instance"?

Or is there a way to use an SNMP Custom String Lookup sensor to show "No such instance" as green and "Ok"?

Thanks for your help.

no-such-instance oid snmp

Created on Oct 27, 2016 1:26:09 PM



1 Reply

Votes:

0

Hi Willi,

PRTG will always evaluate the "No such name" as an error condition and it will not be possible to differentiate between the status.

It will still be possible to perform the check with a custom sensor and process the results. This could be possible by creating an if-condition to return the value if available and to return 0 for everything else.

You can have a look at this article which describes this process with NetSNMP and PowerShell.

This is a simple example based on the linked example above:

cls
$var = cmd /c "snmpget.exe" -c "public" -v 2c -Oqv "%%HOSTNAME%%" .1.3.6.1.2.1.31.1.1.1.18.15 2>&1

if ($LASTEXITCODE -ne 0){
    $upsstatus = 0
   }else{
        $status = $var.replace(" ","")
        $upsstatus = switch -regex ($status){
        "Other Thing" {"2"; break}
	"High Temperature" {"1"; break}
        default {"0"}
        }
}

Write-Host "<prtg>"
Write-Host "<result>"
Write-Host "<value>$($upsstatus)</value>"
Write-Host "</result>"
Write-Host "</prtg>"

Essentially the "relevant" part of the script is 2>&1 that "catches" the error and then the ($LASTEXITCODE -ne 0) captures any issues with the execution and returns 0 when there an errors. This is intended to be used with lookups:


Best regards, Felix

Created on Oct 28, 2016 1:17:48 PM by  Felix Saure [Paessler Support]

Last change on Oct 28, 2016 1:45:06 PM by  Luciano Lingnau [Paessler]




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.