Get-CacheServerStatistics
This PowerShell cmdlet displays the statistics of the specified cache. It displays a list of performance counters by default which can be extended by a list of custom counters. It enables saving the counters to a .CSV file which can be opened in Microsoft Excel. Moreover, the .CSV file can be converted to .blg format for viewing counters in Cache Performance Monitor.
Note
This feature is also available in the NCache Open Source. Please keep in mind that NCache Open Source has different parameters in some cmdlet instances.
Get-CacheServerStatistics -CacheName [-Server] `
[-CounterNames] [-Continuous] `
[-DoNotShowDefaultCounters] `
[-TlsCertPath] [-TlsCertPassword] `
[-Format] [-SampleInterval] `
[-MaxSamples] [-NoLogo] [-Credentials]
Examples
- This command displays the default counters of the server for defaultCache from the default node.
Get-CacheServerStatistics -CacheName defaultCache
- This command displays the default counters for the cache defaultCache from the client nodes 20.200.20.11 and 20.200.20.12.
Get-CacheServerStatistics -CacheName defaultCache -Server "20.200.20.11,20.200.20.12"
- This command gets values of specified counter names alongside the default counters for defaultCache.
Get-CacheServerStatistics -CacheName defaultCache -Server "20.200.20.11,20.200.20.12" `
-CounterNames "Hits/sec,Misses/sec"
- This command gets the 50 samples from defined counters for defaultCache.
Get-CacheServerStatistics -CacheName defaultCache -Server "20.200.20.11,20.200.20.12" `
-CounterNames "Hits/sec,Misses/sec" -MaxSamples 50
- This command gets values of specified counter names for defaultCache. It does not display the values of default counters.
Get-CacheServerStatistics -CacheName defaultCache -Server "20.200.20.11,20.200.20.12" `
-CounterNames "Hits/sec,Misses/sec" -DoNotShowDefaultCounters
- This command gets default counters for the cache defaultCache continuously after every 3-second interval.
Get-CacheServerStatistics -CacheName defaultCache -Server "20.200.20.11,20.200.20.12" `
-Continuous -SampleInterval 3
- This command gets values of counters for defaultCache continuously after every 5 seconds.
Get-CacheServerStatistics -CacheName defaultCache -Server "20.200.20.11,20.200.20.12" `
-Continuous -SampleInterval 5
- This command gets values of default counters for defaultCache continuously after every 1 second and saves the output in .CSV format at the given location.
Get-CacheServerStatistics -CacheName defaultCache -Continuous `
-SampleInterval 1 -Format CSV | Out-File "C:\stats.csv" -Encoding ASCII
- This command displays server statistics for defaultCache on the specified servers with mutual TLS (mTLS) enabled. It runs from a machine where NCache is not installed and uses
C:\certs\client.pemto authenticate the machine running the cmdlet. The-TlsCertPasswordparameter decrypts the certificate’s password-protected private key. Omit this parameter if the private key is not encrypted.
Get-CacheServerStatistics -CacheName defaultCache -Servers "20.200.20.11,20.200.20.12" `
-TlsCertPath "C:\certs\client.pem" -TlsCertPassword "clientKeyPassword"
- This command displays the default counters of the server for defaultCache from the default node, using security credentials.
Get-CacheServerStatistics -CacheName defaultCache -Credentials(Get-Credential john_smith)
Properties
Note
The parameters with asterisk (*) on 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. NOTE: The cache must already exist on the source server. |
- |
-Server |
<String> |
Specifies a server name where the NCache Service is running and a cache with the specified cache-name is registered. NOTE: Comma-separated server names enclosed in double quotes are to be specified in case of multiple servers. |
IP of local machine |
-CounterNames |
<String> |
Specifies one or more counter(s) not included in default counters that should be displayed. NOTE: Comma-separated counter names enclosed in double quotes 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 -CounterNames are provided. |
False |
-Format |
<String> |
By default, the display format is tabular but it can be set to .CSV, and that output can be saved in a .CSV file for future use. | Tabular |
-SampleInterval |
<Integer> |
Specifies the time between samples in seconds. Minimum value is 1 second. | 3 |
-MaxSamples |
<Long> |
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 a 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 |
-Credentials |
<pscredential> |
Specifies the user credentials required to authorize access for the specified operation. These credentials should belong to a user with the appropriate permissions at the node. | - |
-TlsCertPath |
<string> |
Path to the client PEM certificate used to authenticate the machine running the NCache PowerShell cmdlet when connecting to an NCache server with mutual TLS (mTLS) enabled. The PEM file must contain the private key, leaf certificate, and any intermediate certificates. You can generate a certificate using New-NCacheTlsCertificate. This parameter is required when running the PowerShell module from a machine where NCache is not installed and the server requires mTLS. On a machine with an NCache server installation, the node's own certificate is used automatically. Relative paths are resolved against the current PowerShell location, and the file must exist. To configure the certificate presented by the server, use -CustomCertificatePath. |
- |
-TlsCertPassword |
<string> |
Password used to load the encrypted private key in the PEM file specified by -TlsCertPath. Required only when the private key is password-protected. Not needed for an unencrypted private key. The password is used only to load the client certificate for the current command's connections. It is not saved in the NCache server configuration. |
- |