Server Management Suite

 View Only
  • 1.  T-SQL to return resources targeted by agentless Monitoring Policy

    Trusted Advisor
    Posted Jan 20, 2016 03:39 AM

    We've got a few servers which are monitored agentlesslly and this has revealed a flaw in our T-SQL reporting.

    You see we can report on the resources targeted by any policy using the following T-SQL,

     

      -- ClassGuid = '0821A65B-5338-464C-824D-9F7CEC48EA56' --Agent based Monitor
      -- ClassGuid = 'F4767927-21AF-4875-B1B0-400852689DB1' --Agentless Monitor

    SELECT vc.name, 

           vnonresourceitem.name 

    FROM   vpolicyappliestoresource 

           JOIN vcomputer vc 

             ON vpolicyappliestoresource.resourceguid = vc.guid 

           JOIN vnonresourceitem 

             ON vnonresourceitem.guid = vpolicyappliestoresource.policyguid 

    WHERE  ( classguid = '0821A65B-5338-464C-824D-9F7CEC48EA56' 

              OR classguid = 'F4767927-21AF-4875-B1B0-400852689DB1' ) 

           AND enabled = 1

    ORDER  BY vc.name ASC 

     

    This works fine for agent-based monitoring, but for agentless monitoring the resource target is always the SMP. This kinda makes sense in that the SMP needs to do something a bit special for agentless, but I'm stumped as to how to move on from here.

    Has anyone got any ideas?

    Kind Regards,
    Ian./

     



  • 2.  RE: T-SQL to return resources targeted by agentless Monitoring Policy

    Broadcom Employee
    Posted Jan 20, 2016 06:09 AM

    Hi Ian,

    1. An agentless monitor policy xml goes only to "Remote Monitoring Service" (RMS) machine with all targeted resource guids of targeted monitored resources, therefore you will see there only NS machine with RMS plug-in installed or other remote RMS machines as targeted machines for an agentless monitor policy.

    2. An agent-based monitor policy xml goes directly to each targeted agent-based monitored computer (where Monitor Agent plug-in is installed) therefore they are shown as targeted.

    You can check this behavior for resource, which is added in "Resource Target" of Agentless monitor policy, just open "Resource Manager" of this resource and open "Summaries" -> "Policy Summary" -> you will see that there is no agentless monitor policy is shown.

    • Do the same for agent-based resource and you will see there list of targeted agent-based monitor policies.

    If you click on "RMS" Site Server, then you will see all information about monitored resources which are monitored by selected RMS and agentless monitor policy

    RMS.jpg

    Thanks,

    IP.

     



  • 3.  RE: T-SQL to return resources targeted by agentless Monitoring Policy

    Trusted Advisor
    Posted Jan 20, 2016 08:54 AM

    Hi Igor,

    Thanks for the explaination -that certainly helps to clarify why I'm in a pickle! Are you aware of a way in T-SQL to locate the resources targeted by the agent-less policy?



  • 4.  RE: T-SQL to return resources targeted by agentless Monitoring Policy
    Best Answer

    Broadcom Employee
    Posted Jan 28, 2016 11:18 AM

    Hi Ian,

    try this

    1. You can take SQL Query from default "Monitored Resources" filter

    SELECT DISTINCT a.[MonitoredResourceGuid] FROM [Inv_Monitor_Detected_Policies] a
    WHERE a.[_MonitorPolicyGuid] <> '00000000-0000-0000-0000-000000000000'
    AND NOT EXISTS (SELECT * FROM [Inv_AeX_AC_Network_Zone] zone WHERE zone.[_ResourceGuid] = a.[_ResourceGuid] AND zone.[IsOnInternet] = 1)
    AND NOT EXISTS (SELECT * FROM [SecurityEnrollmentQueue] s WHERE s.[ResourceGuid] = a.[MonitoredResourceGuid] AND (s.[State] IN (3,4) OR (s.[Flags] &1) = 1) )

    2. Take "Guid" of your agent-less monitor policy and specify it in this Query

    • As example with specified Guid of default agentless monitor policy
    SELECT DISTINCT a.[MonitoredResourceGuid] FROM [Inv_Monitor_Detected_Policies] a
    WHERE a.[_MonitorPolicyGuid] = '{b4bf716a-8b62-4deb-964a-8467dbcf4f44}'
    AND NOT EXISTS (SELECT * FROM [Inv_AeX_AC_Network_Zone] zone WHERE zone.[_ResourceGuid] = a.[_ResourceGuid] AND zone.[IsOnInternet] = 1)
    AND NOT EXISTS (SELECT * FROM [SecurityEnrollmentQueue] s WHERE s.[ResourceGuid] = a.[MonitoredResourceGuid] AND (s.[State] IN (3,4) OR (s.[Flags] &1) = 1) )

    ⇒ Now you should see list of all resources, which are monitored by appropriate agentless (or agent-based) Monitor policy, based on specified Guid of Monitor policy in this SQL Query.

    Best regards,

    IP.