1. Linux

1.1. Installation

  • Enter the following commands at a Command Line.

    sudo apt-get update
    sudo apt-get install prometheus prometheus-node-exporter
    
    sudo systemctl status prometheus
    sudo systemctl status prometheus-node-exporter

1.1.1. React Web UI

  • Enter the following commands at a Command Line.

    ls -al /usr/share/prometheus/web/static
    sudo /usr/share/prometheus/install-ui.sh
    ls -al /usr/share/prometheus/web/static
    ls -al /usr/share/prometheus/web/static/react

1.2. Configuration

  • Add targets into /etc/prometheus/prometheus.yml configuration file.

    scrape_configs:
      - job_name: 'server_label'
        static_configs:
          - targets: ['server_hostname:9100']
  • Install config file sample.

    sudo cp /usr/share/doc/prometheus/examples/consoles/* /etc/prometheus/consoles
    sudo mv /etc/prometheus/consoles/index.html.example /etc/prometheus/consoles/index.html
    sudo cp /usr/share/doc/prometheus/examples/console_libraries/* /etc/prometheus/console_libraries
    sudo gunzip /etc/prometheus/console_libraries/*.gz

1.3. Grafana Alloy

  • See Install Grafana Alloy on Linux.

  • Enter the following commands at a Command Line.

    # Installation.
    sudo apt-get install gpg
    sudo mkdir -p /etc/apt/keyrings
    sudo wget -O /etc/apt/keyrings/grafana.asc https://apt.grafana.com/gpg-full.key
    sudo chmod 644 /etc/apt/keyrings/grafana.asc
    echo "deb [signed-by=/etc/apt/keyrings/grafana.asc] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
    
    sudo apt-get update
    sudo apt-get install alloy
    sudo systemctl start alloy
    sudo systemctl status alloy
    sudo systemctl enable alloy.service
    # Configuration.
    # See https://grafana.com/docs/alloy/latest/configure/linux