Megosztás a következőn keresztül:


A Timesaver :: Run Perfmon with PowerShell

Welcome to my first post on the wonderful Tech Net Blogging Community.

Just sharing some time saving tips on how to quickly go into your Enterprise Search 2013 setup to help diagnose (for this example - content feeding and processing) issues with a set of predefined perfmon counters. Very fast and very portable. I presented this at a recent Microsoft Premier Field Engineering Conference. These are the mechanics of being able to quickly diagnose some issues. Check out this blog for a lot of detail on what you are actually looking at: https://blogs.technet.com/b/peter_dempsey/archive/2013/04/15/sharepoint-2013-monitor-and-tune-content-feed.aspx

-----------------------------------------------
1) To get started:
Here is the TN reference on the Get-Counter cmdlet which is used in my examples --> https://technet.microsoft.com/en-us/library/dd367892.aspx

-----------------------------------------------

2)How to see the counters in PS: eg - Search Content Router

 

What this enables you to do – create a small script that would call a specific set of counters for (crawling, feeding, CPC, QPC etc) and be able to look at a component quickly. Build a counter file that calls the specific counters addressing whatever problem you may be trying to investigate.

Script:
get-counter -counter (get-content C:\path\mycounters.txt) -MaxSamples 10 -sampleinterval 1

mycounters.txt - geared towards diagnosing CPC issues, can create additional files addressing other search component issues
\Search Flow Statistics(contentprocessingcomponent1)\# Items Queued For Processing
\Search Flow Statistics(contentprocessingcomponent1)\Input Queue Empty Time
\Search Submission Service(contentprocessingcomponent1)\# Pending Items
\Search Gatherer Projects - SharePointServerSearch(*content)\Transactions Waiting
\Search Gatherer Projects - SharePointServerSearch(*content)\Transactions In Progress
\Search Gatherer Projects - SharePointServerSearch(*content)\Transactions Completed
\Search Gatherer - SharePointServerSearch\Threads Accessing Network
\Search Gatherer - SharePointServerSearch\Threads Filtering
\Search Gatherer - SharePointServerSearch\Threads Idle
\Search Flow Statistics(contentprocessingcomponent1)\Input Queue Full Time
\Search Content Router(contentprocessingcomponent1*)\NumSuccessIndex
\Search Content Router(contentprocessingcomponent1*)\IndexTime
\Search Gatherer Content Plugin - SharePointServerSearch(_total)\Documents Lost
\Search Gatherer Content Plugin - SharePointServerSearch(_total)\Documents Failed 
 

This will give you some nice statistics on what is going on with content processing and if there are some issues. 

 

Timestamp CounterSamples                                                                                     
--------- --------------                                                                                     
5/30/2013 2:56:55 PM    

search flow statistics(contentprocessingcomponent1)\# items queued for processing :     
                          0                                                                                                                                                                                                  
search flow statistics(contentprocessingcomponent1)\input queue empty time :            
                          1320669544                                                                                         
search submission service(contentprocessingcomponent1)\# pending items :                
                          0                                                                                                   
search gatherer projects - sharepointserversearch(search_service_application_0_portal_content)\transactions waiting :         
                          0                                                                                                  
search gatherer projects - sharepointserversearch(search_service_application_0_portal_content)\transactions in progress :     
                          0                                                                                                   
search gatherer projects - sharepointserversearch(search_service_application_0_portal_content)\transactions completed :       
                          0                                                                                                  
search gatherer - sharepointserversearch\threads accessing network :                    
                          0                                                                                                  
search gatherer - sharepointserversearch\threads filtering :                            
                          0                                                                                                  
search gatherer - sharepointserversearch\threads idle :                                 
                          0                                                                                                  
search flow statistics(contentprocessingcomponent1)\input queue full time :             
                          46                                                                                                 
search content router(contentprocessingcomponent1.sp1cdca7e5860a)\numsuccessindex :     
                          18                                                                                                 
search content router(contentprocessingcomponent1_average)\numsuccessindex :            
                          18                                                                                                 
search content router(contentprocessingcomponent1_total)\numsuccessindex :              
                          18                                                                                                 
search content router(contentprocessingcomponent1_max)\numsuccessindex :                
                          18                                                                                                 
search content router(contentprocessingcomponent1.sp1cdca7e5860a)\indextime :           
                          0                                                                                                  
search content router(contentprocessingcomponent1_average)\indextime :                  
                          0                                                                                                  
search content router(contentprocessingcomponent1_total)\indextime :                    
                          0                                                                                                  
search content router(contentprocessingcomponent1_max)\indextime :                      
                          0                                                                                                  
search gatherer content plugin - sharepointserversearch(_total)\documents lost :         
                         0

 

3) It will also spit the output into the perfmon reporting GUI, so you can still get the nice readable format with the perfmon graphs. Just a matter of adding an export..(below)

 Script:
get-counter -counter (get-content C:\path\mycounters.txt) -MaxSamples 10 -sampleinterval 1 | Export-counter -Force -Path C:\path\data1.blg

    

Comments

  • Anonymous
    January 01, 2003
    Sweet!

  • Anonymous
    May 30, 2013
    Thx!

  • Anonymous
    January 30, 2014
    I wrote a basic overview of some of the counters needed to monitor and tune content feeding here . But

  • Anonymous
    March 10, 2014
    hi Can you post an example of powershell you are using please.

  • Anonymous
    August 28, 2015

create label and time stamp
set-variable -name timestamp -value ("counters_" + (get-date -f yyyy-MM-dd[hh=mm=ss]))

# Collect Metrics
Get-Counter "Network Interface()Bytes Total/sec", "Network Interface()Output Queue Length", "Network Interface()Packets Received Errors" -MaxSamples 60 -sampleinterval 1 | Export-counter -FileFormat BLG -Path temp.blg -Force
# or export to CSV using the following export instead
# Export-counter -FileFormat CSV -Path temp.csv -Force

#insert timestamp to file
get-childitem -Path temp.
| rename-item -NewName {$_ -replace "temp","$timestamp"}