Skip to content

Josh's IT-Blog

Information Technology, and other interesting things …

  • Home
  • About
  • Contact
  • Links

Create a calculated SNMP monitor

Posted on 11. October 201122. June 2020 By Burkard Josh No Comments on Create a calculated SNMP monitor
SCOM

Sometimes you need a SCOM monitor which was calculated from one or more SNMP values. Maybe the values have to be calculated, cause the value is in an unhandy format or unit. In this example i will monitor the input frequency for an for an UPS. The originaly readed value is in 1/10 Hz, but i like to monitor in Hz.

Create the monitor

Select Timed Script Two State Monitor and select the destination managementpack.

Insert this code to the field Script:

Dim oAPI, oBag
Set oAPI = CreateObject("MOM.ScriptAPI")
On Error Resume Next
err.clear
Dim oArgs
Set oArgs = WScript.Arguments
strDeviceIP = oArgs(0)
strCommunity = Decode(oArgs(1))
set objSNMP = CreateObject("OlePrn.OleSNMP")
objSNMP.Open strDeviceIP, strCommunity, 2, 1000
intValue = Int(objSNMP.Get(".1.3.6.1.2.1.33.1.4.2.0"))
intValue = intValue / 10

' Return the values to SCOM
Set oBag = oAPI.CreatePropertyBag()
If intValue < 45 Or intValue > 55 Then
   Call oBag.AddValue("devState", "BAD")
Else
   Call oBag.AddValue("devState", "GOOD")
End If
Call oBag.AddValue("PerfValue", intValue )
Call oAPI.Return(oBag)

Function Decode(strB64)
' decode CommunityString
   strXML = "<B64DECODE xmlns:dt=" & Chr(34) & _
   "urn:schemas-microsoft-com:datatypes" & Chr(34) & " " & _
   "dt:dt=" & Chr(34) & "bin.base64" & Chr(34) & ">" & _
   strB64 & "</B64DECODE>"
   Set oXMLDoc = CreateObject("MSXML2.DOMDocument.3.0")
   oXMLDoc.LoadXML(strXML)
   decode = oXMLDoc.selectsinglenode("B64DECODE").nodeTypedValue
   set oXMLDoc = nothing
End Function

As you see, you have to define the SNMP OID in the script. After this you can calculate with the returned value and define rules for the GOOD and BAD state.

To get the devices ip address and communitystring, you have to define this parameters, which could be readed by the script with Wscript.Arguments. Click to the Parameters-button:

$Target/Property[Type="MicrosoftSystemCenterNetworkDeviceLibrary6172210!Microsoft.SystemCenter.NetworkDevice"]/IPAddress$ $Target/Property[Type="MicrosoftSystemCenterNetworkDeviceLibrary6172210!Microsoft.SystemCenter.NetworkDevice"]/CommunityString$ $Target/Property[Type="MicrosoftSystemCenterNetworkDeviceLibrary6172210!Microsoft.SystemCenter.NetworkDevice"]/Version$

Please note, that all parameters have to be insert as one (1) line, separated only with a space.

You created your first calculated SNMP monitor, but you didn’t enable it. To enable it, you have to create an override for a group, containing the desired devices.

Share this:

  • Facebook
  • Twitter
  • Email
  • Print
Tags: SCOM 2007 R2 SNMP

Post navigation

❮ Previous Post: Clone your Active Directory in 18 minutes using VMware
Next Post: Collect warranty informations with SCCM ❯

Leave a Reply Cancel reply

About

Author Image
My name is Josh Burkard.
I'm a DevOps Engineer working with one of swiss largest telecom and full-service hosting provider. in my work I have a lot to do with Microsoft server operating systems, System Center, VMware, Microsoft Azure Cloud and other software.
On this site I will write some posts about different technology problems and their solutions.
please note also my tweets and retweets from this area.

Follow me on Twitter

My Tweets

Categories

  • General (13)
  • Hardware (9)
    • Network (8)
      • Cisco (2)
    • Storage (2)
  • Microsoft Azure (1)
    • Automation (1)
  • PowerShell (1)
  • Software (1)
    • Excel (1)
  • System Center (19)
    • SCCM (3)
    • SCDPM (1)
    • SCOM (13)
    • SCSM (1)
    • SMA (1)
  • VMware (8)
  • Windows 2008 R2 (10)
    • Active Directory (7)
  • Windows 2012 R2 (1)
  • Windows 2016 (1)
  • Windows 7 (4)
    • BitLocker (1)
  • WordPress (1)

Links

  • Burkard-Fingerlin Family
  • Swisscom (Schweiz) AG
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

About

Author Image
My name is Josh Burkard.
I'm a DevOps Engineer working with one of swiss largest telecom and full-service hosting provider. in my work I have a lot to do with Microsoft server operating systems, System Center, VMware, Microsoft Azure Cloud and other software.
On this site I will write some posts about different technology problems and their solutions.
please note also my tweets and retweets from this area.

Follow me on Twitter

My Tweets

FOLLOW ME ON GITHUB

joshburkard (Josh Burkard)

Josh Burkard

joshburkard
Belgium
https://www.burkard.it
Joined on Jul 10, 2015
13 Public Repositories
0 Public Gists

Copyright © 2023 Josh's IT-Blog.

Theme: Oceanly by ScriptsTown

 

Loading Comments...
 

    loading Cancel
    Post was not sent - check your email addresses!
    Email check failed, please try again
    Sorry, your blog cannot share posts by email.