How to get memory usage per target

I have been working together with Prometheus and Grafana where I am trying to integrate them both together. My problem currently is that my node exporter is currently redirecting to port 9100 which I was able to do:

Total

By doing

node_memory_MemTotal_bytes{job=“node”,instance=~“localhost:9100”}

However this would just sum up the whole computer status but what I want to do is that I would like to get RAM usage of each target:

# Sample config for Prometheus.

global:
  scrape_interval:     1s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 1s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
      monitor: 'example'

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets: ['localhost:9093']

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  
  - job_name: node
    # If prometheus-node-exporter is installed, grab stats about the local
    # machine by default.
    static_configs:
      - targets: [
				  'localhost:8000',
				  'localhost:8001',
				  'localhost:8002',
				  'localhost:8003',
				  'localhost:8004',
				  'localhost:8005',
				  'localhost:8006',
				  'localhost:8007',
				  'localhost:8008',
				  'localhost:8009',
				  'localhost:8010',
				  'localhost:8011',
				  'localhost:8012',
				  'localhost:8013',
				  'localhost:8014',
				  'localhost:8015',
				  'localhost:8016',
				  'localhost:8002',
				  'localhost:8017',
				  'localhost:8018',
				  'localhost:8019',
				  'localhost:8020',
				  'localhost:8021',
				  'localhost:8022',
				  'localhost:8023',
				  'localhost:8024',
				  'localhost:8025',
				  'localhost:8026',
				  'localhost:8027',
				  'localhost:8028',
				  'localhost:8029',
				  'localhost:8030',
				  'localhost:8030',
				  'localhost:8031',
				  'localhost:8032',
				  'localhost:8033',
				  'localhost:8034',
				  'localhost:8035',
				  'localhost:8036',
				  'localhost:8037',
				  'localhost:8038',
				  'localhost:8039',
				  'localhost:8040',
				  'localhost:9100'
				]

and now I am stuck where I do not know how or if its even possible to get the RAM usage that is being used by the different ports?

The output I would like to do is:

Output

Bumping and hoping I could get any help :slight_smile:

This topic was automatically closed after 365 days. New replies are no longer allowed.