Skip to main content

Client Monitoring Agent Installation Guide

For target systems and server nodes whose metrics and logs need to be aggregated into the centralized Monitoring Stack, deploy the standard collection agents: Prometheus Node Exporter (for machine metrics) and Grafana Promtail (for centralized log shipping).


Node Exporter Installation Guide

Execute the following steps to deploy the standalone Prometheus Node Exporter (version 1.11.1) on any target Linux server.

1. Create System User

Isolate the Node Exporter runtime process under a dedicated user restricted from local interactive logins:

sudo useradd --no-create-home --shell /bin/false node_exporter

2. Download & Install Binary

Acquire the official architecture release and stage the execution binary:

# Download official Linux 64-bit archive
wget https://github.com/prometheus/node_exporter/releases/download/v1.11.1/node_exporter-1.11.1.linux-amd64.tar.gz

# Extract the archive
tar -zxvf node_exporter-1.11.1.linux-amd64.tar.gz

# Move the execution binary to system bin path
sudo mv node_exporter-1.11.1.linux-amd64/node_exporter /usr/local/bin/

# Assign isolated permissions
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter

# Cleanup artifacts
rm -rf node_exporter-1.11.1.linux-amd64*

3. Systemd Service Unit Definition

To authorize process persistence, supervisor restarts, and OS startup management, register the service with systemd:

sudo tee /etc/systemd/system/node_exporter.service <<EOF
[Unit]
Description=Prometheus Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter
Restart=always
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
EOF

4. Start & Enable Daemon

Initialize the service tracking loop:

sudo systemctl daemon-reload
sudo systemctl start node_exporter
sudo systemctl enable node_exporter

Verification

Query standard metrics formatting on default interface Port 9100:

curl -I http://localhost:9100/metrics

Grafana Promtail Installation Guide

Execute the following steps to install and configure Promtail (version 3.7.2) to scrape and securely ship local log files into your authenticating Loki gateway.

1. Create System User & Assign Group Permissions

To ensure Promtail can read secure system-level log files (such as /var/log/syslog or /var/log/auth.log), the sandboxed user must be added to the Linux adm group:

sudo useradd --no-create-home --shell /bin/false promtail
sudo usermod -aG adm promtail

2. Download & Extract Binary

Install standard processing utils, and retrieve the official binary payload:

# Install extraction utility if missing
sudo apt-get update && sudo apt-get install -y unzip

# Retrieve Promtail binary
wget https://github.com/grafana/loki/releases/download/v3.7.2/promtail-linux-amd64.zip

# Unzip contents
unzip promtail-linux-amd64.zip

# Stage execution binary
sudo mv promtail-linux-amd64 /usr/local/bin/promtail
sudo chown promtail:promtail /usr/local/bin/promtail

# Clean artifacts
rm -f promtail-linux-amd64.zip

3. Scaffold Data & Configuration Folders

Prepare configurations structures and sandboxed tracking databases (positions):

sudo mkdir -p /etc/promtail
sudo mkdir -p /var/lib/promtail
sudo chown promtail:promtail /etc/promtail
sudo chown promtail:promtail /var/lib/promtail

4. Configure Logs Scraper

Create the Promtail scraping logic in /etc/promtail/promtail-config.yaml. Ensure you replace <LOKI_GATEWAY_IP> with your central Loki management host IP address, and configure the Basic Auth credentials to match your Nginx gateway setup:

sudo tee /etc/promtail/promtail-config.yaml <<EOF
server:
http_listen_port: 9080
grpc_listen_port: 0

positions:
# Tracks line location offsets for files scraped
filename: /var/lib/promtail/positions.yaml

clients:
# Connect to Loki authenticating Nginx reverse-proxy
- url: http://<LOKI_GATEWAY_IP>:3100/loki/api/v1/push
basic_auth:
username: admin
password: btech@monitoring123

scrape_configs:
- job_name: syslog
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*log
EOF

Set proper file constraints:

sudo chown promtail:promtail /etc/promtail/promtail-config.yaml
sudo chmod 600 /etc/promtail/promtail-config.yaml

5. Systemd Service Unit Definition

Define process supervisions:

sudo tee /etc/systemd/system/promtail.service <<EOF
[Unit]
Description=Grafana Promtail log shipper
Wants=network-online.target
After=network-online.target

[Service]
User=promtail
Group=promtail
Type=simple
ExecStart=/usr/local/bin/promtail -config.file=/etc/promtail/promtail-config.yaml
Restart=always
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
EOF

6. Start & Enable Promtail

Bootstrap the aggregator:

sudo systemctl daemon-reload
sudo systemctl start promtail
sudo systemctl enable promtail

Verification

Ensure the agent running loop responds correctly:

sudo systemctl status promtail
curl -I http://localhost:9080/ready