Monitor Cache Server Counters using PowerShell
NCache provides a Get-CacheServerStatistics cmdlet to display the statistics of the cache specified. When executed, this cmdlet, by default, displays a list of all performance counters which can also be extended to geta list of all custom counters. Get-CacheServerStatistics
also allows you to save this list of counters in a .CSV file that can be opened in Microsoft Excel. You can convert this .CSV file into a .BLG file to view the saved counters in Performance Monitor.
Get-CacheServerStatistics [-CacheName] [-Servers] [-CounterNames] [-DoNotShowDefaultCounters] [-Continuous] [-Format] [-SampleInterval] [-MaxSamples] [-NoLogo]
The properties of Get-CacheServerStatistics
are explained in detail in the Properties section of this chapter.
Examples
- The command shown below displays the default counters from the default node of the server for demoCache.
Get-CacheServerStatistics -CacheName demoCache
- The command shown below displays the default counters from the client nodes 20.200.20.19 and 20.200.20.20 for the cache demoCache .
Get-CacheServerStatistics -CacheName demoCache -Clients "20.200.20.19,20.200.20.20"
- The command shown below only displays the specified counters for demoCache.
Get-CacheServerStatistics -CacheName demoCache -DoNotShowDefaultCounters -CounterNames "List Count"
- The command shown below displays both the default counters and specified counters of the cache demoCache.
Get-CacheServerStatistics -CacheName demoCache -CounterNames "Compression/sec"
- The command shown below displays the default counters continuously after every default sample interval for the cache demoCache.
Get-CacheServerStatistics -CacheName demoCache -Continuous
- The command shown below gets default counters continuously after every 3 second interval for the cache demoCache.
Get-CacheServerStatistics -CacheName demoCache -Continuous -SampleInterval 3
- The command shown below gets default counters and specified counters continuously after every 3 second interval for cache demoCache and displays output in csv format.
Get-CacheServerStatistics -CacheName demoCache -Continuous -SampleInterval 3 -Format csv
- The command shown below gets both the default counters and specified counters continuously after every 3 seconds for the cache demoCache and saves the output in .CSV file at the path provided.
Get-CacheServerStatistics -CacheName demoCache -Continuous -SampleInterval 3 -Format csv | Out-File -Encoding ascii "C:\test.csv"
Properties
Note: The parameters with an asterisk (*) with their names are the required parameters and the rest are optional.
Parameters | Data Types | Description | Default Value |
---|---|---|---|
-CacheName* |
<String> |
Specifies the name of the cache for which counters need to be fetched. | - |
-Servers |
<String> |
Specifies one or more server name(s) where the NCache service is running and a cache with the specified cache-name is running. NOTE: Comma (,) separated server names are to be specified in case of multiple clients. |
Local Machine |
-CounterNames |
<String> |
Specifies one or more counter(s) not included in default counters that should be displayed. NOTE: Comma (,) separated counter names are to be specified in case of multiple counters. The PerfMon counters mentioned on this page can be fetched by this switch. |
- |
-Continuous |
<SwitchParameter> |
Specified in order to get the statistics continuously. | - |
-DoNotShowDefaultCounters |
<SwitchParameter> |
Specifies whether default counters are to be shown. NOTE: This parameter is only valid if Counter Names are provided. |
False |
-Format |
<String> |
By default display format is tabular but it can be set to CSV, and that CSV output can be saved in CSV file for future use. | Tabular |
-SampleInterval |
<Integer> |
Specifies the time between samples in seconds. Minimum value is 3 seconds. | 1 |
-MaxSamples |
<Integer> |
Specifies the number of samples to get from each counter. To get samples continuously (no maximum sample size), use the Continuous parameter. NOTE: The Continuous parameter and the MaxSamples parameter cannot be used in the same command. If Sample Interval is provided, it will take the next Sample after that interval otherwise it will use the default value i.e. 3 seconds. |
1 |
-NoLogo |
<SwitchParameter> |
Suppresses display of the logo banner. | False |
See Also
Verify Cache Health
Test-Stress Cache
PerfMon Counters
Monitor Cache Using PerfMon
Cache Logs