How to create a monitor to alert when a SCOM agent needs upgraded.

Brian W 126 Reputation points
2022-09-29T20:50:59.52+00:00

I need to create a monitor that will alert when an agent is a different version than the management or gateway servers.

System Center Operations Manager
System Center Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. XinGuo-MSFT 22,246 Reputation points
    2022-10-03T08:17:52.74+00:00

    Hi,

    SCOM Agents view will show the agent need to upgrade:
    image-11.png

    We could bulk upgrade and update SCOM agents using Tasks

    How to upgrade and update SCOM agents using Tasks

    0 comments No comments

  2. SChalakov 10,591 Reputation points MVP Volunteer Moderator
    2022-10-05T12:06:53.113+00:00

    Hi @Brian W ,

    I have never heard of an MP with this particular functionality, but I certainly know how I would do this. I won't go looking for the agent version on each agent locally, but rather get all agents versions directly from SCOM. I would do this using PowerShell and the create a PowerShell based Monitor, which will alert on "unwanted" agent version.
    This is pretty easy to achieve, you need:

    • the PowerShell Authoring MP from Cookdown/SquaredUp
    • the script
    • Integrate the script in SCOM, example in the article I wrote here:

    Monitoring Active Directory User Account Expiration using SCOM and PowerShell (Step by Step Guide)
    https://www.pohn.ch/monitor-active-directory-user-account-expiration-using-scom-and-powershell-step-by-step-guide/

    The script for this should be easy to create, something like this:

    #Compare alll agents to the SCOM 2019 UR4 Version  
    $VersionToCompare = "10.19.10200.0"  
      
      
    #Clear Errors  
    $Error.Clear()  
      
    #Prepare API and Property Bag Objects  
    $ScomAPI = New-Object -ComObject "MOM.ScriptAPI"  
    $PropertyBag = $ScomAPI.CreatePropertyBag()  
      
      
        try {  
             
            $AllAgents = Get-SCOMAgent  
      
            foreach ($Agent in $AllAgents)  
            {  
              
            #get the agent version  
            $AgentVersion = (Get-SCOMAgent -Name $Agent.Name).Version  
      
            if ($AgentVersion -eq $VersionToCompare) {  
      
            $PropertyBag.AddValue("State","Healthy")  
            $PropertyBag.AddValue("Version",$AgentVersion)  
      
            } else {  
              
            $PropertyBag.AddValue("State","Warning")  
            $PropertyBag.AddValue("Version",$AgentVersion)  
              
            }  
      
         }   
          
        } finally {  
          #Send the whole output to SCOM  
          $PropertyBag  
        }  
    

    Then you just create the monitor and you have it. Of course the Powershell script can be extended easily to accomodate even more complex logic, but I think thiss is a nice start.

    I hope I could help you out with that!

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
    Regards
    Stoyan Chalakov

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.