Menu
Grafana Cloud

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:

sh
curl http://localhost:9105/metrics

Install Apache Mesos integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find Apache Mesos and click its tile to open the integration.
  3. 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.
  4. 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

alloy
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 the instance 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: The mesos_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

alloy
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:
      1. /var/log/mesos/master/ for a master node on Linux
      2. C:\Program Files\mesos\master\ for a master node on Windows
      3. /var/log/mesos/agent/ for an agent node on Linux
      4. C:\Program Files\mesos\agent\ for an agent node on Windows
    • instance label: constants.hostname sets the instance 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: The mesos_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

alloy
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:
      1. /var/log/mesos/master/ for a master node on Linux
      2. C:\Program Files\mesos\master\ for a master node on Windows
      3. /var/log/mesos/agent/ for an agent node on Linux
      4. C:\Program Files\mesos\agent\ for an agent node on Windows
    • instance label: constants.hostname sets the instance 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: The mesos_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.

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 1

Apache Mesos overview dashboard part 2

Apache Mesos overview dashboard part 2

Alerts

The Apache Mesos integration includes the following useful alerts:

AlertDescription
ApacheMesosHighMemoryUsageWarning: There is a high memory usage for the cluster.
ApacheMesosHighDiskUsageCritical: There is a high disk usage for the cluster.
ApacheMesosUnreachableTasksWarning: There are an unusually high number of unreachable tasks.
ApacheMesosNoLeaderElectedCritical: There is currently no cluster coordinator.
ApacheMesosInactiveAgentsWarning: 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

md
# 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.