Track the total number of running probes in Monika using Prometheus
This article will show you how to track the total number of running probes in Monika by integrating Monika with Prometheus
Monika, created by Hyperjump, is an open-source tool for synthetic monitoring of web services. It helps ensure that online services operate smoothly. In this article, we introduce a new feature for Monika users: the ability to track the total number of running probes using Prometheus.
Prometheus is a monitoring toolkit that enhances Monika’s capabilities by providing real-time data on system performance. The key update here is the new metric monika_probe_running_total
, which indicates how many probes are monitoring your services at any time. This feature is beneficial for developers, system administrators, and anyone interested in web service performance. We will explore how this new metric works, how to set it up, and the advantages it offers.
Overview
The introduction of the monika_probe_running_total
metric allows users to see how many of these probes are active, providing a clear picture of the monitoring workload. By knowing the exact number of active probes, users can adjust their monitoring strategies, ensuring that resources are used efficiently and effectively.
The technical implementation of the monika_probe_running_total
metric in Monika is a key aspect of this feature. It involves the use of an abort controller. The abort controller works by stopping unnecessary requests, which in turn reduces the load on the system and prevents the waste of resources.
Setting Up Monika with Prometheus
Setting up monitoring with Prometheus in Monika is a straightforward process. The setup involves using Docker Compose. By using Docker compose, users can easily integrate Prometheus into their Monika setup.
The process includes the following steps:
Run Prometheus with Docker Compose: Users need to configure the Docker compose file to run Prometheus. This step involves specifying the necessary services and settings. You can use the provided docker-compose.yaml and prometheus.yaml below:
docker-compose.yamlservices:
prometheus:
image: prom/prometheus
container_name: monika_prometheus
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- 9090:9090
network_mode: host
prometheus.yamlglobal:
scrape_interval: 1s
scrape_configs:
- job_name: "monika"
static_configs:
- targets: ["localhost:3001"]
Save the files and rundocker compose up -d
to run Prometheus in detached mode.Run Monika with Prometheus flag: Next step is to run Monika using Prometheus flag. First, let’s create an example Monika configuration to run:
monika.ymlprobes:
- id: "1"
requests:
- url: http://dev.to
- id: "2"
requests:
- url: https://kentcdodds.com
- id: "3"
requests:
- url: https://stackoverflow.blog
- id: "4"
requests:
- url: https://hackernoon.com
- id: "5"
requests:
- url: https://news.ycombinator.com
Save the file and runmonika -c monika.yml --prometheus 3001
to run Monika with Prometheus.Verification: After running both Monika and Prometheus, you can open Prometheus Expression Browser by visiting http://localhost:9090/graph in your browser. Then, Input
sum(monika_probe_running_total)
in the input field and click the Execute button. Finally, click the Graph tab to see the end result.
Introducing NEO Sense
In addition to the exciting features of Monika, we also offer NEO Sense, a web app version of Monika designed to make monitoring even more accessible and efficient. NEO Sense is a stress-free uptime monitoring service that keeps you informed about the status of your website or API. It provides notifications through various platforms like Telegram, Slack, and more, ensuring you're always updated about your service's performance.
NEO Sense is designed for easy integration, allowing you to set up monitoring for your applications quickly. It offers a broad range of notification channels and features like easy status page sharing and request chaining, which helps in monitoring user experience more effectively. With global tracking capabilities, NEO Sense ensures you're never caught off-guard by system downtimes or performance issues.
Experience the simplicity and efficiency of NEO Sense – an ideal solution for keeping your systems running smoothly and efficiently. For more information and to get started, visit NEO Sense.
Conclusion
In this article, we explored the innovative feature of tracking the total number of running probes in Monika using Prometheus. This integration offers a significant enhancement in monitoring web services, allowing for visualizing the total number of running probes in Monika and efficient resource management and optimization.
Overall, these developments in Monika (and NEO Sense) are stepping stones towards more efficient and effective web service monitoring, beneficial for developers, system administrators, and anyone interested in maintaining optimal online service performance.
References
For a more in-depth understanding and technical insights into the feature of tracking the total number of running probes in Monika using Prometheus, please refer to the GitHub Pull Request #1222 on the Hyperjump Monika repository. This PR provides detailed information about the implementation, setup, and usage of the feature.
Hyperjump is an open-source-first company providing engineering excellence service. We aim to build and commercialize open-source tools to help companies streamline, simplify, and secure the most important aspects of their modern DevOps practices.