AO monitoring
We use Prometheus to collect metrics from Windows servers. To install exporter on Windows, download the exporter (https://github.com/prometheus-community/windows_exporter) and install it with proper settings, for example:
msiexec /i c:\temp\windows_exporter-0.24.0-amd64.msi ENABLED_COLLECTORS=cpu,memory,process --% EXTRA_FLAGS="--collector.process.whitelist=".*Serv.*""
In some cases different windows and different PowerShell version you might need to modify EXTRA_FLAGS command's quotation. Another example(without quotes on whitelist): tested with (aholappserv)
msiexec /i c:\temp\windows_exporter-0.24.0-amd64.msi ENABLED_COLLECTORS=cpu,memory,process,os --% EXTRA_FLAGS="--collector.process.whitelist=.*Serv.*"
To configure Prometheus to scrape the metrics, add target to https://github.com/Attracs/attracs-linux-playbooks/blob/bf95e67ac96e1dbddcf1d8aade1c9b32fd8e0f4d/prometheus/configs/config.yml.j2 , for example:
- job_name: testappserv
scrape_interval: 60s
scrape_timeout: 10s
static_configs:
- targets:
- online-api.attracs.com:443
labels:
service: testappserv
metrics_path: /testserver_exporter/metrics
scheme: https
Apply changes with playbook: https://github.com/Attracs/attracs-linux-playbooks/blob/master/prometheus/prometheus.yml
For example(note that example contains --check and --diff):
ansible-playbook --check --diff -i inventory/linux-servers.ini prometheus/prometheus.yml
If the Prometheus doesn't have direct line of sight to exporter, one needs to route traffic through haproxy, for example by adding entry for online-API proxy (https://github.com/Attracs/attracs-linux-playbooks/blob/ddbbd9634d5a29e717d04daf3b39bd90ff0d5763/frontend/frontend-data.yml )
- {
instance: testserver_exporter,
backends: [ 'fi.1 172.31.0.126:9182'],
}Â Â Â
HAProxy needs to have exception for the scrape targets, for example (https://github.com/Attracs/attracs-linux-playbooks/blob/bf95e67ac96e1dbddcf1d8aade1c9b32fd8e0f4d/frontend/haproxy/configs/internal.cfg.j2):
acl path_attracs_online_testserver_exporter path_beg -i /testserver_exporter/
use_backend backend_online_api_testserver_exporter if src_attracs_online_allowed path_attracs_online_testserver_exporter
Apply HAproxy changes with https://github.com/Attracs/attracs-linux-playbooks/blob/master/frontend/frontend-update.yml One can use ready made shortcuts in /scripts to restrict update to specific frontend -hosts
For example:
./scripts/frontends-update-configs.sh