Dockerized grafana dashboard to visualize node metrics

Has anyone other than @roland or @Jadkin had any success with this?

I keep running into the error
"Error loading config (--config.file=/etc/prometheus/prometheus.yml)" file=/etc/prometheus/prometheus.yml err="open /etc/prometheus/prometheus.yml: no such file or directory"

Being lazy, I thought I’d ask here before I try to attach a terminal to the prometheus container.

1 Like

I hope you don’t mind. But here is GPT4’s output for the error. I have no idea of course :slight_smile:

The error message you provided indicates that Prometheus is unable to find or load its configuration file at the specified location: /etc/prometheus/prometheus.yml.

Here are some steps to diagnose and potentially resolve the issue:

  1. Check if the file exists: Verify that the prometheus.yml file exists in the /etc/prometheus/ directory.

    ls -l /etc/prometheus/prometheus.yml

    If the file doesn’t exist, you need to create or place a valid configuration file at that location.

  2. File Permissions: Ensure that the user running Prometheus has the appropriate permissions to read the file.

    sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
    sudo chmod 644 /etc/prometheus/prometheus.yml

    Replace prometheus:prometheus with the appropriate user and group if different.

  3. Configuration File Validity: Ensure that the configuration file is valid. A corrupted or improperly formatted configuration file might cause issues. You can check its contents with:

    cat /etc/prometheus/prometheus.yml

    Ensure that the YAML formatting is correct and all required fields are present.

  4. Alternative Configuration Path: If you intentionally placed the configuration file in a different directory, you must adjust the --config.file flag value accordingly when starting Prometheus.

  5. Default Configuration: If you’re unsure about the contents of the configuration file, you can start with a basic configuration. Here’s a simple example:

      scrape_interval: 15s
      - job_name: 'prometheus'
        - targets: ['localhost:9090']

    Save this configuration to /etc/prometheus/prometheus.yml and restart Prometheus.

  6. Reinstall Prometheus: If you suspect a bad installation, consider reinstalling Prometheus. Before doing this, make sure to back up any data or configuration files you want to keep.

  7. Logs: Check the Prometheus logs for more detailed error messages. They might offer additional insight into what’s going wrong.

  8. File System Issues: Ensure there’s no problem with the file system, like being full or read-only. You can check the disk space using:

    df -h
  9. Check Prometheus Version: Ensure you’re using a version of Prometheus compatible with your configuration file. Over time, configurations might change, and older versions may not support newer configuration options.

If none of these steps resolve the issue, please provide additional information or context so I can assist further.

1 Like

Hey @Southside, thank you for taking your time to try out the dashboard! Looking at the error message, it seems like the prometheus.yml file has not been generated yet.
For some context, the prometheus.yml contains the localhost:port of the metrics server. This metrics server is started alongside a safenode if the --feature=open-metrics flag is used during the compilation.

Since the yml file contains the info about the nodes(and its metrics server) running on a particular machine, there is no default config for it. Instead, we might have to create the config using the following sub-crate safe_network/metrics.

The above link contains the step-by-step guide to get the dashboard working.

The TLDR is that,

  • build and run safenode with --features=open-metrics
  • clone safe_network, cd to safe_network/metrics, and execute cargo run --release -- --run
    This should create the yml file and start the dashboard.