Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Access Your Prometheus Configuration File: Log into your EC2 instance where Prometheus is running. You'll typically find the prometheus.yml configuration file in the directory where you have Prometheus installed, or under /etc/prometheus/ if you used a package manager to install Prometheus.

  2. Edit the Configuration File: Open prometheus.yml in a text editor. You can use nano, vi, or any editor you're comfortable with. For example:

    Code Block
    sudo vi /etc/prometheus/prometheus.yml
  3. Add a New Job to Scrape HiveMQ Metrics: In the scrape_configs section of the configuration file, add a new job to scrape metrics from the HiveMQ Prometheus operator. You'll specify the metrics path and the address of the server where HiveMQ is running. For example, we used EC2 IP and port 9399 for HiveMQ job:. Note that the default binding IP address can be 0.0.0.0

    Code Block
    scrape_configs:
      - job_name: 'hivemq'
        static_configs:
          - targets: ['<ec2-auto-assigned-ip>:9399']
        metrics_path: '/metrics'
  4. Save and Close the File: After adding the new job, save your changes and exit the text editor.

  5. Reload Prometheus Configuration: Prometheus needs to reload its configuration to start scraping metrics from the new endpoint. You can do this by sending a SIGHUP signal to the Prometheus process. If you're using systemd, you can reload the Prometheus service using:

    Code Block
    sudo systemctl reload prometheus

    If you're not using systemd, find the Prometheus process ID and send a SIGHUP signal to it:

    Code Block
    kill -HUP $(pidof prometheus)
  6. Verify Configuration: After reloading the configuration, you can check that Prometheus is successfully scraping metrics from HiveMQ by accessing the Prometheus UI and navigating to the ‘Targets’ page.(http://<ec2-auto-assigned-ip>/targets) You should see your new job listed with a status indicating whether the scrape is successful.

  7. Going back to http://<ec2-auto-assigned-ip>/graph, you should be able to see HiveMQ metrics scrapped.

...