Apache Mesos integration for Grafana Cloud
Apache Mesos is an open-source distributed systems kernel that acts as a platform for managing and orchestrating computing resources across clusters of machines. Apache Mesos integration for Grafana cloud allows users to monitor masters events queue, registrar state, allocator usage as well as disk, memory and logs for both the master and agent targets in an overview dashboard.
This integration supports Apache Mesos 1.4.x+
This integration supports the Prometheus Mesos Exporter v1.1.2
This integration includes 5 useful alerts and 1 pre-built dashboard to help monitor and visualize Apache Mesos metrics and logs.
Before you begin
In order for the integration to work properly, you must enable logs and set up the Prometheus Mesos Exporter on your primary host. In a production environment, Apache Mesos master and agent node are ran separately for better resource management, availability and fault tolerance. Each master or agent node has their own log path and requires a prometheus exporter installation.
Enable logs for Apache Mesos
Users must enable Apache Mesos Logs in order for log panels on the dashboard to populate. Logs are added to either the Mesos master or agent node by specifying the log directory using --log_dir=
. This path will also differ depending on if you are running Linux or Windows but is required so that Promtail can ingest the logs.
Run the Mesos master with the following flags:--log_dir=/var/log/mesos/master/
on Linux masters–-log_dir=C:\Program Files\mesos\master\
on Windows masters
Run the Mesos agent with the following flags:--log_dir=/var/log/mesos/agent/
on Linux agents–-log_dir=C:\Program Files\mesos\agent\
on Windows agents
Set up Prometheus Exporter for Apache Mesos
The Prometheus Mesos Exporter v1.1.2 must be setup with a Prometheus configuration file specifying a master or agent node. Run the Mesos exporter master process with mesos_exporter -master http://localhost:5050
and run the Mesos exporter for the agent process with mesos_exporter -slave http://localhost:5051
. For more information on how to configure the Prometheus exporter, please refer to Prometheus configuration documentation.
To validate that the Prometheus exporter is working correctly, curl the master Prometheus metrics endpoint on the port 9105
:
curl http://localhost:9105/metrics
Install Apache Mesos integration for Grafana Cloud
- In your Grafana Cloud stack, click Connections in the left-hand menu.
- Find Apache Mesos and click its tile to open the integration.
- Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send Apache Mesos metrics and logs to your Grafana Cloud instance.
- Click Install to add this integration’s pre-built dashboard and alerts to your Grafana Cloud instance, and you can start monitoring your Apache Mesos setup.
Configuration snippets for Grafana Alloy
Advanced mode
The following snippets provide examples to guide you through the configuration process.
To instruct Grafana Alloy to scrape your Apache Mesos instances, manually copy and append the snippets to your alloy configuration file, then follow subsequent instructions.
Advanced metrics snippets
discovery.relabel "metrics_integrations_integrations_apache_mesos" {
targets = [{
__address__ = "<node-name>:<node-exporter-port>",
}]
rule {
target_label = "mesos_cluster"
replacement = "<your-cluster-name>"
}
rule {
target_label = "instance"
replacement = constants.hostname
}
}
prometheus.scrape "metrics_integrations_integrations_apache_mesos" {
targets = discovery.relabel.metrics_integrations_integrations_apache_mesos.output
forward_to = [prometheus.remote_write.metrics_service.receiver]
job_name = "integrations/apache-mesos"
}
To monitor your Apache Mesos instance, you must use a discovery.relabel component to discover your Apache Mesos Prometheus endpoint and apply appropriate labels, followed by a prometheus.scrape component to scrape it.
Configure the following properties within each discovery.relabel
component:
__address__
: The address to your Apache Mesos Prometheus metrics endpoint.instance
label:constants.hostname
sets theinstance
label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Mesos instance. Make sure this label value is the same for all telemetry data collected for this instance.mesos_cluster
: Themesos_cluster
label to group your Apache Mesos instances within a cluster. Set the same value for all nodes within your cluster.
If you have multiple Apache Mesos servers to scrape, configure one discovery.relabel
for each and scrape them by including each under targets
within the prometheus.scrape
component.
Advanced logs snippets
linux
local.file_match "logs_integrations_integrations_apache_mesos" {
path_targets = [{
__address__ = "localhost",
__path__ = "<mesos-node-log-dir>",
instance = constants.hostname,
job = "integrations/apache-mesos",
mesos_cluster = "<mesos-cluster-name>",
}]
}
loki.source.file "logs_integrations_integrations_apache_mesos" {
targets = local.file_match.logs_integrations_integrations_apache_mesos.targets
forward_to = [loki.write.grafana_cloud_loki.receiver]
}
To monitor your Apache Mesos instance logs, you will use a combination of the following components:
local.file_match defines where to find the log file to be scraped. Change the following properties according to your environment:
__address__
: The Apache Mesos instance address__path__
: The path to the log file. It must be the log dir specified in the--log_dir=
depending on your node and OS as instructed when enabling logs for Apache Mesos whose default values would be either:/var/log/mesos/master/
for a master node on LinuxC:\Program Files\mesos\master\
for a master node on Windows/var/log/mesos/agent/
for an agent node on LinuxC:\Program Files\mesos\agent\
for an agent node on Windows
instance
label:constants.hostname
sets theinstance
label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Mesos instance. Make sure this label value is the same for all telemetry data collected for this instance.mesos_cluster
: Themesos_cluster
label to group your Apache Mesos instances within a cluster. Set the same value for all nodes within your cluster.
loki.source.file sends logs to Loki.
windows
local.file_match "logs_integrations_integrations_apache_mesos" {
path_targets = [{
__address__ = "localhost",
__path__ = "<mesos-node-log-dir>",
instance = constants.hostname,
job = "integrations/apache-mesos",
mesos_cluster = "<mesos-cluster-name>",
}]
}
loki.source.file "logs_integrations_integrations_apache_mesos" {
targets = local.file_match.logs_integrations_integrations_apache_mesos.targets
forward_to = [loki.write.grafana_cloud_loki.receiver]
}
To monitor your Apache Mesos instance logs, you will use a combination of the following components:
local.file_match defines where to find the log file to be scraped. Change the following properties according to your environment:
__address__
: The Apache Mesos instance address__path__
: The path to the log file. It must be the log dir specified in the--log_dir=
depending on your node and OS as instructed when enabling logs for Apache Mesos whose default values would be either:/var/log/mesos/master/
for a master node on LinuxC:\Program Files\mesos\master\
for a master node on Windows/var/log/mesos/agent/
for an agent node on LinuxC:\Program Files\mesos\agent\
for an agent node on Windows
instance
label:constants.hostname
sets theinstance
label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Apache Mesos instance. Make sure this label value is the same for all telemetry data collected for this instance.mesos_cluster
: Themesos_cluster
label to group your Apache Mesos instances within a cluster. Set the same value for all nodes within your cluster.
loki.source.file sends logs to Loki.
Grafana Agent static configuration (deprecated)
The following section shows configuration for running Grafana Agent in static mode which is deprecated. You should use Grafana Alloy for all new deployments.
Before you begin
In order for the integration to work properly, you must enable logs and set up the Prometheus Mesos Exporter on your primary host. In a production environment, Apache Mesos master and agent node are ran separately for better resource management, availability and fault tolerance. Each master or agent node has their own log path and requires a prometheus exporter installation.
Enable logs for Apache Mesos
Users must enable Apache Mesos Logs in order for log panels on the dashboard to populate. Logs are added to either the Mesos master or agent node by specifying the log directory using --log_dir=
. This path will also differ depending on if you are running Linux or Windows but is required so that Promtail can ingest the logs.
Run the Mesos master with the following flags:--log_dir=/var/log/mesos/master/
on Linux masters–-log_dir=C:\Program Files\mesos\master\
on Windows masters
Run the Mesos agent with the following flags:--log_dir=/var/log/mesos/agent/
on Linux agents–-log_dir=C:\Program Files\mesos\agent\
on Windows agents
Set up Prometheus Exporter for Apache Mesos
The Prometheus Mesos Exporter v1.1.2 must be setup with a Prometheus configuration file specifying a master or agent node. Run the Mesos exporter master process with mesos_exporter -master http://localhost:5050
and run the Mesos exporter for the agent process with mesos_exporter -slave http://localhost:5051
. For more information on how to configure the Prometheus exporter, please refer to Prometheus configuration documentation.
To validate that the Prometheus exporter is working correctly, curl the master Prometheus metrics endpoint on the port 9105
:
curl http://localhost:9105/metrics
Install Apache Mesos integration for Grafana Cloud
- In your Grafana Cloud stack, click Connections in the left-hand menu.
- Find Apache Mesos and click its tile to open the integration.
- Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send Apache Mesos metrics and logs to your Grafana Cloud instance.
- Click Install to add this integration’s pre-built dashboard and alerts to your Grafana Cloud instance, and you can start monitoring your Apache Mesos setup.
Post-install configuration for the Apache Mesos integration
After enabling Apache Mesos logs and the Prometheus Mesos Exporter, instruct the Grafana Agent to scrape your Apache Mesos cluster.
Make sure to change targets
in the snippet according to your environment master or agent name. The default port for Apache Mesos master targets is 9105
.
If you want to show logs and metrics signals correlated in your dashboards as a single pane of glass, ensure the following:
job
andmesos_cluster
label values must match for the Apache Mesos metrics and logs scrape config in your agent configuration file.job
must be set tointegrations/apache-mesos
Please replace the default hostname for the master or agent Mesos node name and port according to your environment manually.mesos_cluster
must be the value that identifies the Apache Mesos cluster master or agent it belongs to.mesos-node-log-dir
must be the log dir specified in the--log_dir=
depending on your node and OS as instructed when enabling logs for Apache Mesos whose default values would be either:/var/log/mesos/master/
for a master node on LinuxC:\Program Files\mesos\master\
for a master node on Windows/var/log/mesos/agent/
for an agent node on LinuxC:\Program Files\mesos\agent\
for an agent node on Windows
Configuration snippets for Grafana Agent
Below metrics.configs.scrape_configs
, insert the following lines and change the URLs according to your environment:
- job_name: integrations/apache-mesos
metrics_path: "/metrics"
static_configs:
# node refers to either the master or agent
- targets: ['<node-name>:<node-exporter-port>']
relabel_configs:
- target_label: mesos_cluster
replacement: '<your-cluster-name>'
- target_label: instance
replacement: '<your-instance-name>'
Below logs.configs.scrape_configs
, insert the following lines according to your environment.
- job_name: integrations/apache-mesos
static_configs:
- targets: [localhost]
labels:
job: integrations/apache-mesos
instance: '<your-instance-name>'
mesos_cluster: '<mesos-cluster-name>'
# See Apache Mesos pre instructions for node and OS specific log directory
# https://grafana.com/docs/grafana-cloud/data-configuration/integrations/integration-reference/integration-apache-mesos/#enable-logs-for-apache-mesos
__path__: '<mesos-node-log-dir>'
Full example configuration for Grafana Agent
Refer to the following Grafana Agent configuration for a complete example that contains all the snippets used for the Apache Mesos integration. This example also includes metrics that are sent to monitor your Grafana Agent instance.
integrations:
prometheus_remote_write:
- basic_auth:
password: <your_prom_pass>
username: <your_prom_user>
url: <your_prom_url>
agent:
enabled: true
relabel_configs:
- action: replace
source_labels:
- agent_hostname
target_label: instance
- action: replace
target_label: job
replacement: "integrations/agent-check"
metric_relabel_configs:
- action: keep
regex: (prometheus_target_sync_length_seconds_sum|prometheus_target_scrapes_.*|prometheus_target_interval.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds)
source_labels:
- __name__
# Add here any snippet that belongs to the `integrations` section.
# For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
logs:
configs:
- clients:
- basic_auth:
password: <your_loki_pass>
username: <your_loki_user>
url: <your_loki_url>
name: integrations
positions:
filename: /tmp/positions.yaml
scrape_configs:
# Add here any snippet that belongs to the `logs.configs.scrape_configs` section.
# For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
- job_name: integrations/apache-mesos
static_configs:
- targets: [localhost]
labels:
job: integrations/apache-mesos
instance: '<your-instance-name>'
mesos_cluster: '<mesos-cluster-name>'
# See Apache Mesos pre instructions for node and OS specific log directory
# https://grafana.com/docs/grafana-cloud/data-configuration/integrations/integration-reference/integration-apache-mesos/#enable-logs-for-apache-mesos
__path__: '<mesos-node-log-dir>'
metrics:
configs:
- name: integrations
remote_write:
- basic_auth:
password: <your_prom_pass>
username: <your_prom_user>
url: <your_prom_url>
scrape_configs:
# Add here any snippet that belongs to the `metrics.configs.scrape_configs` section.
# For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
- job_name: integrations/apache-mesos
metrics_path: "/metrics"
static_configs:
# node refers to either the master or agent
- targets: ['<node-name>:<node-exporter-port>']
relabel_configs:
- target_label: mesos_cluster
replacement: '<your-cluster-name>'
- target_label: instance
replacement: '<your-instance-name>'
global:
scrape_interval: 60s
wal_directory: /tmp/grafana-agent-wal
Dashboards
The Apache Mesos integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.
- Apache Mesos overview
Apache Mesos overview dashboard part 1
Apache Mesos overview dashboard part 2
Alerts
The Apache Mesos integration includes the following useful alerts:
Alert | Description |
---|---|
ApacheMesosHighMemoryUsage | Warning: There is a high memory usage for the cluster. |
ApacheMesosHighDiskUsage | Critical: There is a high disk usage for the cluster. |
ApacheMesosUnreachableTasks | Warning: There are an unusually high number of unreachable tasks. |
ApacheMesosNoLeaderElected | Critical: There is currently no cluster coordinator. |
ApacheMesosInactiveAgents | Warning: There are currently inactive agent clients. |
Metrics
The most important metrics provided by the Apache Mesos integration, which are used on the pre-built dashboard and Prometheus alerts, are as follows:
- mesos_exporter_build_info
- mesos_master_allocation_run_latency_ms
- mesos_master_allocation_run_ms
- mesos_master_allocation_run_ms_count
- mesos_master_cpus
- mesos_master_disk
- mesos_master_elected
- mesos_master_event_queue_dispatches
- mesos_master_event_queue_length
- mesos_master_gpus
- mesos_master_mem
- mesos_master_messages
- mesos_master_slaves_state
- mesos_master_task_states_current
- mesos_master_uptime_seconds
- mesos_registrar_log_recovered
- mesos_registrar_state_fetch_ms
- mesos_registrar_state_store_ms
- mesos_slave_disk_bytes
- mesos_slave_disk_used_bytes
- mesos_slave_mem_bytes
- mesos_slave_mem_used_bytes
- up
Changelog
# 1.0.0 - July 2024
* Add Kubernetes as a supported platform using Grafana Alloy
# 0.0.3 - September 2023
* New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working.
* New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label.
# 0.0.2 - August 2023
* Add regex filter for logs datasource
# 0.0.1 - June 2023
* Initial release
Cost
By connecting your Apache Mesos instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.