Setting up Prometheus
Now that we have the basic understanding of Prometheus, let’s get a Prometheus server up and start scraping some metrics. For this example I’ll set up the following architecture on Windows Server.
Installing windows_exporter
First, we will download the Node Exporter on all machines :
(Update: 6 Feb 2023), current prometheus version 1.5.0.
### for x64 arch (common server) - download from browser
https://github.com/prometheus-community/windows_exporter/releases/download/v0.20.0/windows_exporter-0.20.0-amd64.msi
Install the downloaded Installer, and after windows exporter installed, open browser & goto http://localIP:9182/metrics to see agent is installed.
Add new client to Prometheus Server
Register new IP of client to /etc/hosts on prom server
sudo vim /etc/hosts
## add this to bottom of the line
## example >> IPADDRESS hostname
10.0.0.86 pht-win-test
Add new config at prometheus server at /etc/prometheus/prometheus.yml
## add this to bottom of the line
## example >> - targets: ['CLIENTHOSTNAME:NODE_EXPORTERPORT']
- targets: ['pht-win-test:9182']
Restart the Prometheus server with this command
sudo systemctl restart prometheus.service
Check node target on Prom GUI at http://10.0.0.46:9090/targets
That’s it.