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

[HP ProCurve Switch] Monitoring Version And Model

Votes:

2

Introduction

This sensor allows you to monitor the software version of your ProCurve switches and shows the model information in the sensor message. Version is divided into Major, Minor, and Patchlevel. Feel free to set limits accordingly to find old versions. Recommended sensor interval is 24h.

Screenshot

Please have a look at our guide for installing PowerShell based sensors for installation details.

Requirements

Needs snmpget.exe within the EXEXML directory, which can be obtained via
https://www.snmpsoft.com/cmd-tools/snmp-get/

Parameters

ParameterTypeDescription
TargetHostStringThe host address of the target appliance (can be set to %host)
PortIntegerThe used SNMP port, defaulting to 161
CommunityStringThe SNMP community, defaulting to public
OidsString[]The OIDs for the software version and the system info (model name, etc.)

Version History

DateVersionNotes
November 30rd, 20161.0Initial Release

Script

# ___ ___ _____ ___
#| _ \ _ \_   _/ __|
#|  _/   / | || (_ |
#|_| |_|_\ |_| \___|
#    NETWORK MONITOR
#-------------------
# Description: This sensor will show the software version (major, minor, patch) and model information 
# Parameters:
# -TargetHost:      The host address of the target appliance. Using %host within PRTG will work. 
# -Port             The used SNMP port, defaulting to 161
# -Community        The SNMP community
# -Oids             The OIDs for the software version and the system info (model name, etc.)
# 
# Requirements
# ------------------
# - needs snmpget.exe within the EXEXML directory (can be obtained via https://www.snmpsoft.com/cmd-tools/snmp-get/)
# 
# Version History
# ------------------
# Version  Date        Notes
# 1.0      11/30/2016  Initial Release
#
# ------------------
# (c) 2015 Stephan Linke | Paessler AG
param(
    [string]$TargetHost = "localhost", 
    [int]$Port = 161,
    [string]$Community = "public",
    [string[]]$Oids = @("1.3.6.1.2.1.47.1.1.1.1.9",".1.3.6.1.2.1.47.1.1.1.1.2.1")
)

$Result = @"
<?xml version="1.0" encoding="UTF-8" ?>
<prtg>
<result>
<channel>Major Version</channel>
<value>{0}</value>
</result>
<result>
<channel>Minor Version</channel>
<value>{1}</value>
</result>
<result>
<channel>Patch Level</channel>
<value>{2}</value>
</result>
<text>{3}</text>
</prtg>
"@

function getOid([string]$Oid){

$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\snmpget.exe"
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.UseShellExecute = $false
$pinfo.Arguments = [string]::Format("-r:{0} -p:{1} -t:10 -c:{2} -o:{3} -q", $TargetHost, $Port,$Community, $Oid); 
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null

#Do Other Stuff Here....
$p.WaitForExit()

return $p.StandardOutput.ReadToEnd();

} 

$Version = (getOid -oid $Oids[0]).Split(".");
$SysInfo = (getOid -oid $Oids[1]);

Write-Host ([string]::Format($result, $Version[0], $Version[1], $Version[2], $SysInfo));  

Notes

The script is provided as is and may or may not work with your installation. If you need any further customizations for your environment, feel free to implement them. If you encounter any bugs, feel free to share them :)

hp-procurve patchlevel powershell procurve snmpget version

Created on Nov 30, 2016 8:04:04 AM by  Stephan Linke [Paessler Support]

Last change on Sep 14, 2017 12:27:56 PM by  Luciano Lingnau [Paessler]



4 Replies

Votes:

0

Hi Stephan,

Thank you for this cool script !

Did you notice that you can do SNMP stuff in Powershell directly without using third party tools ?

Check : https://msdn.microsoft.com/en-us/library/ff554459(v=vs.85).aspx

$snmp = new-object -ComObject olePrn.OleSNMP
$snmp.open($IP,$community,$retry,$timeout)
$snmp.get(".1.3.6.1.2.1.1.5.0")
$snmp.close()

Only drawback : you cannot use it on port other than 161 :'(



Regards.

Created on Apr 19, 2017 11:34:44 AM



Votes:

0

Just to mention, that ProCurve J9728A does not hold it's Version on OID 1.3.6.1.2.1.47.1.1.1.1.9 For ProCurve it may be better to use 1.3.6.1.4.1.11.2.14.11.5.1.59.1.4.1.5.1 (tested with a couple of HP Switches like 29xx, 54xx, 18xx Series)

@klmj: the OleSNMP will not work if it could not resolve the OID to a known string. For example if I query for sysObjectId on an Enterasys B-Series Switch, it fails with an error SNMP_ERRORSTATUS_NOSUCHNAME (The requested SNMP operation identified an unknown variable).

regards

Created on Sep 2, 2017 11:38:52 AM



Votes:

0

I am clearly not smart enough to make this work.

I''ve imported the script (and had put all of the OIDS in that also, though not convinced I should've at this point.)

When configuring the parameters in the settings... along the lines of this.. obviously with a valid IP and community name.

-TargetHost x.x.x.x -Port 161 -Community xxxx -Oids 1.3.6.1.4.1.11.2.3.7.11.50

I am simply getting this;

%Wrong parameter (will be ignored): -o: %Obligatory parameter 'o' is missed. (Object ID of SNMP variable)

Created on Dec 21, 2022 1:22:01 PM



Votes:

0

Hello Bezzoh,

Feel free to reach out to us directly per mail at [email protected] so we can take a closer look as screenshots and log files of this sensor might help to troubleshoot further. For the latter you can go to the settings of the sensor and activate the "Store Result" option. Log files are stored on the corresponding probe under "C:\ProgramData\Paessler\PRTG Network Monitor\Logs\sensors.

Created on Dec 26, 2022 11:01:07 AM by  Timo Dambach [Paessler Support]




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.