help • App. L: High Availability Solution for SwyxWare • Monitoring with Grafana and Prometheus • Optional: install sonar-perfmon exporter
L.7.7 Optional: install sonar-perfmon exporter
You can install and configure the sonar-perfmon exporter on the SwyxWare system so that Prometheus can also query and save Windows performance counters and you can visualize them on a Grafana dashboard. This also includes the values provided by SwyxWare via the Performance Monitor API.
In deviation from the sonar-perfmon installation instructions (https://www.infragravity.com/knowledge-base/sonar-023-install-windows-host/), we recommend not to run the sonar-perfmon service under the LOCALSYSTEM account, but to use an account with less rights.
This manual applies to sonar-perfmon 0.25:
1 Download sonar-perfmon, extract the ZIP file on the SwyxWare VM to c:\sonar.
* 
If you use a different path, adjust it accordingly in the following steps.
 
2 Open a PowerShell with administrator rights.
3 Install the service:
 
sc.exe create sonard binpath= c:\sonar\out\Sonard.exe start= auto obj= "NT AUTHORITY\LocalService" depend= "WinRM"
 
4 Configure a service SID:
 
sc.exe sidtype sonard unrestricted
 
5 Give the service the necessary access rights to the installation directory:
 
icacls.exe C:\Sonar /grant "NT Service\sonard:(OI)(CI)(M)"
 
6 Add the service account to the local group "Remote Management Users" so that the service can use the WMI interface:
 
Add-LocalGroupMember -Group "Remote Management Users" -Member "nt service\sonard"
 
On older Windows systems on which "Add-LocalGroupMember" is not available, you can use "net.exe":
 
net localgroup "Remote Management Users" "NT Service\sonard" /add
 
The group name depends on the Windows system language. Adjust the command line accordingly.
On a German-language Windows, use the group name "Remoteverwaltungsbenutzer" instead of "Remote Management Users" in this step.
 
7 In the file "c:\sonar\out\sonard.dll.config", adjust the path to the configuration (parameter "ConfigPath").
Set the parameter to "c:\Sonar\sonard.config". Set the "ExporterPort" on which the service provides the data to 5001.
* 
Do not use port 5000, as this is already used by the HealthMonitor service.
 
The configuration file should look like this:
 
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="Sonar" type="Infragravity.Sonar.SonarConfigurationSection, Sonar"/>
</configSections>
<appSettings>
<add key="ConfigPath" value="c:\Sonar\sonard.config"/>
<add key="RuntimeType" value="Service"/>
<add key="LogLevel" value="Information"/>
<add key="LogPath" value="c:\Sonar\sonar.log"/>
<add key="ExporterPort" value="5001"/>
<add key="ExporterCacheMilliseconds" value="60000"/>
<add key="ExporterEnabled" value="true"/>
<appSettings>
</configuration>
8 Release the port that you configured in the previous step in the Windows firewall:
 
netsh advfirewall firewall add rule name="sonard" dir=in action=allow protocol=TCP localport=5001 remoteip=<ip-monitoring>
 
Replace <ip-monitoring> with the IP address of the monitoring system. If you do not want to restrict the accessibility of the Prometheus interface, omit the "remote-ip" parameter.
9 For a German-speaking Windows system, copy the file "sonard.de.config" from the directory "Monitoring/sonar-perfmon" to "c:\sonar\sonard.config".
10 For an English-speaking Windows system, copy the "sonard.en.config" file from the "Monitoring/sonar-perfmon" directory to "c:\sonar\sonard.config".
11 Start the sonar-perfmon service:
 
start-service sonard
 
12 Open the page "http://localhost:5001/metrics" in a web browser.
*You should see a text output with all the metrics that are configured in "sonard.config".