macOS integration for Grafana Cloud
The macOS integration uses the agent to collect metrics related to the operating system, including aspects like CPU usage, load average, memory usage, and disk and networking I/O. It also supports system logs being scraped by the agent using promtail. An accompanying dashboard is provided to visualize these metrics and logs.
This integration includes 9 useful alerts and 1 pre-built dashboard to help monitor and visualize macOS metrics and logs.
Before you begin
This integration running MacOS machine running alongside Grafana Agent.
Each MacOS node being observed must have a dedicated Grafana Agent running.
Install macOS integration for Grafana Cloud
- In your Grafana Cloud stack, click Connections in the left-hand menu.
- Find macOS and click its tile to open the integration.
- Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send macOS 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 macOS setup.
Post-install configuration for the macOS integration
This integration is configured to work with the node_exporter
, which is embedded in Grafana Agent.
Enable the integration by adding the provided snippets to your agent configuration file.
This integration supports metrics and logs from MacOS.
If you want to show logs and metrics signals correlated in your dashboards, as a single pane of glass, ensure the following:
job
andinstance
label values must match fornode_exporter
integration andlogs
scrape config in your agent configuration file.job
label must be set tointegrations/macos-node
(already configured in the snippets).instance
label must be set to a value that uniquely identifies your MacOS Node. Please replace it according to your environment, it should be set manually. Please note that if you uselocalhost
for multiple nodes the dashboards will not be able to filter correctly by instance.
Note that on Macs with an M1 architecture you might encounter errors similar to the following:
level=error integration=node_exporter msg="collector failed" name=thermal duration_seconds=0.001089125 err="no CPU power status has been recorded"
To avoid collector errors, you can add disable_collectors
setting to the node_exporter integration to disable it:
disable_collectors:
- thermal # disable on M1
For a full description of configuration options see how to configure the node_exporter_config
block in the agent documentation.
Configuration snippets for Grafana Agent
Below integrations
, insert the following lines and change the URLs according to your environment:
node_exporter:
enabled: true
relabel_configs:
- replacement: '<your-instance-name>'
target_label: instance
- replacement: "integrations/macos-node"
target_label: job
Below logs.configs.scrape_configs
, insert the following lines according to your environment.
- job_name: integrations/node_exporter_direct_scrape
static_configs:
- targets:
- localhost
labels:
__path__: /var/log/*.log
instance: '<your-instance-name>'
job: integrations/macos-node
pipeline_stages:
- multiline:
firstline: '^([\w]{3} )?[\w]{3} +[\d]+ [\d]+:[\d]+:[\d]+|[\w]{4}-[\w]{2}-[\w]{2} [\w]{2}:[\w]{2}:[\w]{2}(?:[+-][\w]{2})?'
- regex:
expression: '(?P<timestamp>([\w]{3} )?[\w]{3} +[\d]+ [\d]+:[\d]+:[\d]+|[\w]{4}-[\w]{2}-[\w]{2} [\w]{2}:[\w]{2}:[\w]{2}(?:[+-][\w]{2})?) (?P<hostname>\S+) (?P<sender>.+?)\[(?P<pid>\d+)\]:? (?P<message>(?s:.*))$'
- labels:
sender:
hostname:
pid:
- match:
selector: '{sender!="", pid!=""}'
stages:
- template:
source: message
template: '{{.sender }}[{{.pid}}]: {{ .message }}'
- labeldrop:
- pid
- output:
source: message
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 macOS 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_.*|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.
node_exporter:
enabled: true
relabel_configs:
- replacement: '<your-instance-name>'
target_label: instance
- replacement: "integrations/macos-node"
target_label: job
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/node_exporter_direct_scrape
static_configs:
- targets:
- localhost
labels:
__path__: /var/log/*.log
instance: '<your-instance-name>'
job: integrations/macos-node
pipeline_stages:
- multiline:
firstline: '^([\w]{3} )?[\w]{3} +[\d]+ [\d]+:[\d]+:[\d]+|[\w]{4}-[\w]{2}-[\w]{2} [\w]{2}:[\w]{2}:[\w]{2}(?:[+-][\w]{2})?'
- regex:
expression: '(?P<timestamp>([\w]{3} )?[\w]{3} +[\d]+ [\d]+:[\d]+:[\d]+|[\w]{4}-[\w]{2}-[\w]{2} [\w]{2}:[\w]{2}:[\w]{2}(?:[+-][\w]{2})?) (?P<hostname>\S+) (?P<sender>.+?)\[(?P<pid>\d+)\]:? (?P<message>(?s:.*))$'
- labels:
sender:
hostname:
pid:
- match:
selector: '{sender!="", pid!=""}'
stages:
- template:
source: message
template: '{{.sender }}[{{.pid}}]: {{ .message }}'
- labeldrop:
- pid
- output:
source: message
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.
global:
scrape_interval: 60s
wal_directory: /tmp/grafana-agent-wal
Dashboards
The macOS integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.
- Node Exporter / MacOS
MacOS overview
MacOS logs
Alerts
The macOS integration includes the following useful alerts:
Alert | Description |
---|---|
NodeFilesystemAlmostOutOfSpace | Warning: Filesystem has less than 5% space left. |
NodeFilesystemAlmostOutOfSpace | Critical: Filesystem has less than 3% space left. |
NodeFilesystemFilesFillingUp | Warning: Filesystem is predicted to run out of inodes within the next 24 hours. |
NodeFilesystemFilesFillingUp | Critical: Filesystem is predicted to run out of inodes within the next 4 hours. |
NodeFilesystemAlmostOutOfFiles | Warning: Filesystem has less than 5% inodes left. |
NodeFilesystemAlmostOutOfFiles | Critical: Filesystem has less than 3% inodes left. |
NodeNetworkReceiveErrs | Warning: Network interface is reporting many receive errors. |
NodeNetworkTransmitErrs | Warning: Network interface is reporting many transmit errors. |
NodeTextFileCollectorScrapeError | Warning: Node Exporter text file collector failed to scrape. |
Metrics
The most important metrics provided by the macOS integration, which are used on the pre-built dashboard and Prometheus alerts, are as follows:
- node_cpu_seconds_total
- node_disk_io_time_seconds_total
- node_disk_io_time_weighted_seconds_total
- node_disk_read_bytes_total
- node_disk_written_bytes_total
- node_filesystem_avail_bytes
- node_filesystem_files
- node_filesystem_files_free
- node_filesystem_readonly
- node_filesystem_size_bytes
- node_load1
- node_load15
- node_load5
- node_memory_Buffers_bytes
- node_memory_Cached_bytes
- node_memory_MemAvailable_bytes
- node_memory_MemFree_bytes
- node_memory_MemTotal_bytes
- node_memory_Slab_bytes
- node_memory_compressed_bytes
- node_memory_internal_bytes
- node_memory_purgeable_bytes
- node_memory_total_bytes
- node_memory_wired_bytes
- node_network_receive_bytes_total
- node_network_receive_drop_total
- node_network_receive_errs_total
- node_network_receive_packets_total
- node_network_transmit_bytes_total
- node_network_transmit_drop_total
- node_network_transmit_errs_total
- node_network_transmit_packets_total
- node_textfile_scrape_error
- node_uname_info
- node_vmstat_pgmajfault
Changelog
# 0.0.10 - August 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.
# 0.0.9 - August 2023
* Add regex filter for logs datasource
# 0.0.8 - July 2023
* Update agent snippets
# 0.0.7 - January 2023
* Status panels fixes
- Update status panel query to return only single series
- Resolve status panels not opening when clicking view button
* Update node mixin to latest version
# 0.0.6 - November 2022
* Add integration status panel
# 0.0.5 - September 2022
* Update dashboard panels descriptions.
# 0.0.4 - May 2022
* Reverse fsSpaceAvailableCriticalThreshold and fsSpaceAvailableWarningThreshold
* Update units for disk and networking panels
# 0.0.3 - May 2022
* Use $(hostname) in the generated agent config to avoid manual snippet editing
# 0.0.2 - May 2022
* Update timestamp parsing in logs
# 0.0.1 - May 2022
* Initial release
Cost
By connecting your macOS 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.
Was this page helpful?
Related resources from Grafana Labs


