« Previous Next »

Thread: WMI data

Last post 03-22-2007 1:32 PM by thomad. 11 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (12 items)

Sort Posts:

  • 03-15-2007, 12:56 PM

    • blacktop
    • Top 500 Contributor
    • Joined on 03-02-2007, 7:12 PM
    • Seattle, WA
    • Posts 18

    WMI data

    Hello Everyone,

    It appears IIS 7 no longer reports data to the class Win32_PerfFormattedData_W3SVC_WebService. After doing some searching I found Get to know the IIS7 WMI provider using CIM Studio. I downloaded and installed the WMI CIM Studio and looked around, but I don't think the WebAdministration Namespace has what I am looking for. Can anyone direct me here?

    Sincerely,
    Matt

  • 03-15-2007, 3:17 PM In reply to

    • thomad
    • Top 25 Contributor
    • Joined on 08-20-2002, 11:28 AM
    • Redmond
    • Posts 503

    Re: WMI data

    Matt,

     This is probably an IIS6 WMI provider class. We have a new WMI provider in IIS7 and don't install the IIS6 WMI provider by default. You have to go to the Control Panel - Programs - "Turn Windows features on or off" and select "IIS6 WMI Compatibility" under "Internet Information Services" - "Web Management Tools" - "IIS6 Management Compatibility".

     

    Hope this helps.

    Thomas Deml
    Program Manager
    Internet Information Services
    Microsoft Corp.
  • 03-15-2007, 3:52 PM In reply to

    • blacktop
    • Top 500 Contributor
    • Joined on 03-02-2007, 7:12 PM
    • Seattle, WA
    • Posts 18

    Re: WMI data

    Thanks Thomas,

    OK, so can you point me in the direction of the documentation on the new provider?

    Sincerely,
    Matt

  • 03-15-2007, 3:58 PM In reply to

    • thomad
    • Top 25 Contributor
    • Joined on 08-20-2002, 11:28 AM
    • Redmond
    • Posts 503

    Re: WMI data

    Thomas Deml
    Program Manager
    Internet Information Services
    Microsoft Corp.
  • 03-15-2007, 7:45 PM In reply to

    • blacktop
    • Top 500 Contributor
    • Joined on 03-02-2007, 7:12 PM
    • Seattle, WA
    • Posts 18

    Re: WMI data

    OK, great.  Now, do you know of a way to access a bunch of these WMI providers efficiently?  I think this is what the Win32_PerfFormattedData_W3SVC_WebService class did for IIS 6.  All you need to do from there is use a ManagementObjectSearcher to query the class and then use ManagementObject service.GetPropertyValue to get the data.  (GetRequestsPersec and TotalGetRequests are two examples.)

    Maybe I need to go back and read it better.  But, please feel free to help out.  :)

    Sincerely,
    Matt

  • 03-16-2007, 6:51 AM In reply to

    Re: WMI data

    When I'm trying to figure out WMI related things.  I use wbemtest along with WMI Code Creator 1.0.  This is a free Winforms application.  I've found it handy when trying to figure out what is available using WMI

    http://www.microsoft.com/downloads/details.aspx?familyid=2CC30A64-EA15-4661-8DA4-55BBC145C30E&displaylang=en

    http://www.microsoft.com/technet/technetmag/issues/2006/01/UtilitySpotlight/?related=/technet/technetmag/issues/2006/01/UtilitySpotlight

    Here is an article I published access data from IIS7. It might help spark some ideas.

    http://weblogs.asp.net/steveschofield/archive/2006/10/08/IIS7-_2D00_-post-_2300_10.aspx

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 03-16-2007, 1:02 PM In reply to

    • blacktop
    • Top 500 Contributor
    • Joined on 03-02-2007, 7:12 PM
    • Seattle, WA
    • Posts 18

    Re: WMI data

    Great Links, thanks!

    Well, I guess the key phrase I was looking for was Performance Counter Classes.  It looks like the one I want is WMIPerfClass (for Vista and Longhorn).  Now, I am having trouble finding anything less than high level on it.  But I will keep searching.

    Sincerely,
    Matt

  • 03-16-2007, 2:18 PM In reply to

    • blacktop
    • Top 500 Contributor
    • Joined on 03-02-2007, 7:12 PM
    • Seattle, WA
    • Posts 18

    Re: WMI data

    OK, now I am all confused.  The original class started having counter data available (Win32_PerfFormattedData_W3SVC_WebService).

     Matt

  • 03-16-2007, 6:35 PM In reply to

    • blacktop
    • Top 500 Contributor
    • Joined on 03-02-2007, 7:12 PM
    • Seattle, WA
    • Posts 18

    Re: WMI data

    OK, it is the WMI Code Creator doing something to activate or initiallize the counters.  The counters start having data in them after I click "Search for Property Values."  I took a look at the code for the WMI Code Creator and it looked almost exactly like mine, but I changed mine to use the same constructors for ManagementObjectSearcher with no luck.

    What do you guys think?  Should the counters need to be activated or initiallized?  Or should I be able to access them and get valid data?  In other words, should the following code provide data?

    m_managObjSearch =
    ManagementObjectSearcher(new ManagementScope("root\\CIMV2"), new WqlObjectQuery("SELECT * FROM Win32_PerfFormattedData_W3SVC_WebService"), null);

    foreach (ManagementObject service in m_managObjSearch.Get())
    {
      Object tmpPropertyValue = service["ServiceUptime"];
      if (tmpPropertyValue != null)
      {
        context.Response.Write("ServiceUptime: " + tmpPropertyValue);
      }
    }

    Sincerely,
    Matt

  • 03-17-2007, 1:33 AM In reply to

    Re: WMI data

    Hi Matt,

    I'm glad the links helped.  As far as your questions, I'd think the perf counters should have valid data you can query, assuming anything is active on the machine. I'd verify your code again a few machines to ensure the behavior is consistant.  If if you have to download and run Web Application Stress tool to load down a test box, then you can test your application in a controlled environment.  That is how I rule out things like this.  Hope that helps. 

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 03-22-2007, 1:24 PM In reply to

    • blacktop
    • Top 500 Contributor
    • Joined on 03-02-2007, 7:12 PM
    • Seattle, WA
    • Posts 18

    Re: WMI data

    It appears it is a permissions issue.  I changed the Identity of the Application Pool to LocalSystem and I was able to access the performance counters without running the command line exe.  This was suggested by Microsoft Support (thanks Laura!).

     Matt

  • 03-22-2007, 1:32 PM In reply to

    • thomad
    • Top 25 Contributor
    • Joined on 08-20-2002, 11:28 AM
    • Redmond
    • Posts 503

    Re: WMI data

    Matt,

    I didn't try it but instead of running your AppPool as LocalSystem you might want to make your AppPool identity member of the "Performance Monitor Users" and/or "Performance Log Users" group. You have to restart WAS after you do this (iisreset).

    Here is the command-line to add NetworkService to the group:

    net localgroup "Performance Monitor Users" NetworkService /add

    Hope this helps.

    Thomas Deml
    Program Manager
    Internet Information Services
    Microsoft Corp.
Page 1 of 1 (12 items)
Microsoft Communities