Server Metrics Plugin Installation Manual

1. WordPress Plugin Installation

Download plugin here: https://github.com/netzencatura/server-metrics

2. Vector Installation

On each web server you want to monitor:

curl -L https://woolab.app/install-vector.sh | bash

This will install Vector with the initial configuration.

3. Vector Configuration

On each web server, you need to modify two configuration files:

a) Configure API endpoint and token

Edit file: /etc/vector/sinks/container_metrics_file.yaml

type: http
inputs: ["filter_container_metrics"]
method: post
uri: https://your-wordpress-site.com/wp-json/server-metrics/v1/collect/
encoding:
 codec: json
 except_fields: ["cpu_usage", "domain", "io_read_rate", "io_write_rate", "mem_usage", "uuid"]
request:
 headers:
 content-type: application/json
 X-API-Key: "your-api-token-from-plugin-settings"

b) Configure server name

Edit file: /etc/vector/transforms/parse_container_metrics.yaml

type: remap
inputs: ["container_metrics"]
source: |
 . = parse_regex!(string!(.message), r'^uuid=(?P[0-9a-f-]+)s+domain=(?P[^s]+)s+cpu_usage=(?P[0-9]+)s+mem_usage=(?P[0-9.]+)s+io_read_rate=(?P[0-9]+)s+io_write_rate=(?P[0-9]+)$')
 .container_metrics = {
 "uuid": .uuid,
 "domain": .domain,
 "cpu_usage": to_int!(.cpu_usage),
 "mem_usage": to_float!(.mem_usage),
 "io_read_rate": to_int!(.io_read_rate),
 "io_write_rate": to_int!(.io_write_rate),
 "timestamp": now(),
 "type": "usage",
 "server": "your-server-hostname"
 }

Note: Replace „your-server-hostname“ with your actual server hostname as detected in Enhance CP

4. Restart Vector

After making the changes, restart Vector:

systemctl restart vector

5. Verify Installation

4. Vector Service Management

After making configuration changes, you’ll need to restart Vector. Here are the common service commands:

# Restart Vector service
systemctl restart vector
# Stop Vector service
systemctl stop vector
# Start Vector service
systemctl start vector
# Verify Vector configuration
/root/.vector/bin/vector validate --config-dir /etc/vector

5. Verify Installation

Notes