Optional: sonar-perfmon Exporteur installieren
To enable Prometheus to query and save Windows performance counters and to visualize them on a Grafana dashboard, you can install and configure the sonar-perfmon exporter on the SwyxWare system. 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 privileges.
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 on 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" to allow the service to use the WMI interface:
 
Add-LocalGroupMember -Group "Remote Management Users" -Member "nt service\sonard"
 
On older Windows systems where "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 Adjust the configuration path (parameter "ConfigPath") in the file "c:\sonar\out\sonard.dll.config".
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 because it 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 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 limit the accessibility of the Prometheus interface, leave out the "remote-ip" parameter.
9 For a German Windows system, copy the file "sonard.de.config" from the directory "Monitoring/sonar-perfmon" to "c:\sonar\sonard.config".
10 For an English language 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 Call up the page "http://localhost:5001/metrics" in a web browser.
*You should see a text output with all metrics configured in "sonard.config".
Last modified date: 01/24/2024