Sonar version 0.2.3 and later
The latest version of this KB article is available here.
This step is required to deploy Sonar monitoring agent on target host. Create new folder, for example C:\Sonar. Next, download the latest zip file with the bits to Sonar folder from releases section in our GitHub repository and unzip the archive. This operation will create folder named “out” with the binaries in C:\Sonar directory.
Configure Windows Service
This step is required to install Sonar daemon as Windows service. To accomplish this, open command prompt with administrator permissions and execute the following command:
Define Service Settings
This step is required to specify path to metric collector configuration file and configure Sonar daemon. To complete this step, modify existing file named Sonar.dll.config file in C:\Sonar\out directory as follows:
The above settings are described as follows:
- ConfigPath – path to the metric collection configuration file.
- RuntimeType – should be set to “Service” to run as windows service or any other value to run as console application.
- LogLevel – sets logging level.
- LogPath – specifies path for log file for Sonar daemon running as windows service.
- ExporterPort – specifies port number to use for exposing metrics to Prometheus.
- ExporterCacheMilliseconds – specifies how long metric should remain in cache before being removed.
- ExporterEnabled – indicates that Prometheus exporter endpoint should be hosted by Sonar using port and cache settings described above.
Configure Windows Firewall
This step is optional and typically needed to access Sonar metric endpoint from external monitoring system – Prometheus. To accomplish this, execute the below command:
Configure Metric Collection
This step is required to configure which metrics Sonar should be monitoring. To complete this step, create copy of Sonar.config file as Sonard.config in C:\Sonar directory to match ConfigPath setting described in the previous step. Next, modify Sonard.config file by adding or removing metrics for collection, for example:
This step is required when WS-Management adapter is required to collect metrics from WMI. To complete this step, execute the following command:
For non-production scenarios, WinRm can be configured to use HTTP:
The WinRM HTTPS listener can be configured to list certificates and set thumbprint from the chosen certificate thumbprint for HTTPS listener:
Start Sonar Service
Next, start monitoring agent to collect metrics:
You can run Sonar daemon as console for troubleshooting. To accomplish this simply change value of RuntimeType setting in Sonard.dll.config to “Console” and execute Sonard.exe file manually. Inspect Sonard.log file to verify no errors have been logged for configured metrics.