菜单
Grafana云

macOS集成Grafana云

macOS集成使用代理收集指标相关的操作系统,包括CPU使用率等方面,平均负载、内存使用和磁盘和网络I / O。它还支持系统日志被代理使用promtail刮。一篇仪表板提供可视化这些指标和日志。

这种集成包括9有用的警报和1预构建仪表盘来帮助监控和可视化macOS指标和日志。

在你开始之前

这种集成运行MacOS机器运行与Grafana代理。

被观察到的每个MacOS节点必须有一个专门的Grafana代理运行。

安装macOS集成Grafana云

  1. 在你Grafana云栈,点击连接在左边的菜单中。
  2. 找到macOS并点击打开集成的瓷砖。
  3. 审查的先决条件配置细节选项卡并设置Grafana代理发送macOS指标和日志Grafana云实例。
  4. 点击安装添加这个集成的预构建的仪表板和警报Grafana云实例,你可以开始监视macOS设置。

安装后配置macOS集成

这种集成配置的工作node_exporter,这是嵌入在Grafana代理。

使提供的集成通过添加配置文件片段的货给你们的代理商。

这种集成支持指标和MacOS的日志。

如果你想显示日志和仪表盘指标信号相关,作为一个单一的窗格玻璃,确保以下几点:

  • 工作实例标签值必须匹配node_exporter集成和日志刮你的代理配置文件中配置。
  • 工作标签必须设置为集成/ macos-node(已经在片段中配置)。
  • 实例标签必须设置一个值,惟一地标识你的MacOS节点。请替换它根据您的环境,它应该是手动设置。请注意,如果您使用本地主机对多个节点仪表板将无法正确过滤实例。

注意,在mac M1架构可能遇到错误类似如下:

水平=错误集成= node_exporter味精=“收集器失败”的名字=热duration_seconds = 0.001089125呃=“没有CPU状态记录”

为了避免收集器错误,您可以添加disable_collectors设置为禁用它node_exporter集成:

disable_collectors: M1 -热#禁用

为一个完整的描述的配置选项如何配置node_exporter_config在代理文档。

配置片段Grafana代理

下面集成,插入下面的线条和改变url根据您的环境:

node_exporter:启用:真正relabel_configs:替换:美元(主机名)source_labels: [agent_hostname] target_label:实例-替代:“集成/ macos-node”source_labels: [agent_hostname] target_label:工作

下面logs.configs.scrape_configs根据您的环境,插入下面的线。

- job_name:集成/ node_exporter_direct_scrape static_configs:目标:localhost标签:实例:美元(主机名)__path__: /var/log/*.工作日志:集成/ macos-node pipeline_stages:多行:得力:“^ ((\ w) {3}) ?{3}(\ w) + (\ d) + \ [d]: [\ d] +: [\ d] + | (\ w) {4} - [\ w] {2} [\ w] {2} [\ w] {2}: [\ w] {2}: [\ w] {2} (?: (+ -) (\ w) {2}) ?”——正则表达式:表达式:“(?P <时间> ((\ w) {3}) ?{3}(\ w) + (\ d) + \ [d]: [\ d] +: [\ d] + | (\ w) {4} - [\ w] {2} [\ w] {2} [\ w] {2}: [\ w] {2}: [\ w] {2} (?: (+ -) (\ w) {2}) ?) (? P <主机名> \ S +) (P <发送方>。+ ?)\ [(? < pid > \ d +页)\]:?(? P <消息> (? s: *))美元”——标签:发送方:主机名:pid:匹配:选择器:“{发送者!= " ",pid != " "}’阶段:模板:来源:消息模板:“{{。发送方}}{{。pid}}: {{.message}}’- labeldrop: pid -输出:来源:消息

完整的示例配置Grafana代理

请参考以下Grafana代理配置一个完整的示例,其中包含所有的片段用于macOS集成。这个例子还包括指标被发送到监控你Grafana代理实例。

集成:prometheus_remote_write: - basic_auth:密码:< your_prom_pass >用户名:< your_prom_user > url: < your_prom_url >代理:启用:真正的relabel_configs: -行动:取代source_labels:——agent_hostname target_label:实例——行动:取代target_label:工作替代:“集成/代理来检查”metric_relabel_configs: -行动:保持正则表达式:(prometheus_target_。* | prometheus_sd_discovered_targets | agent_build。* | agent_wal_samples_appended_total | process_start_time_seconds) source_labels: - __name__ #这里添加任何片段,属于“集成”部分。#正确的缩进,复制粘贴片段从Grafana初云。node_exporter:启用:真正relabel_configs:替换:美元(主机名)source_labels: [agent_hostname] target_label:实例-替代:“集成/ macos-node”source_labels: [agent_hostname] target_label:工作日志:配置:-客户:- basic_auth:密码:< your_loki_pass >用户名:< your_loki_user > url: < your_loki_url >名称:集成职位:文件名:/ tmp /职位。yaml scrape_configs: #这里添加任何属于“logs.configs的片段。scrape_configs”部分。#正确的缩进,复制粘贴片段从Grafana初云。- job_name:集成/ node_exporter_direct_scrape static_configs:目标:localhost标签:实例:美元(主机名)__path__: /var/log/*.工作日志:集成/ macos-node pipeline_stages:多行:得力:“^ ((\ w) {3}) ?{3}(\ w) + (\ d) + \ [d]: [\ d] +: [\ d] + | (\ w) {4} - [\ w] {2} [\ w] {2} [\ w] {2}: [\ w] {2}: [\ w] {2} (?: (+ -) (\ w) {2}) ?”——正则表达式:表达式:“(?P <时间> ((\ w) {3}) ?{3}(\ w) + (\ d) + \ [d]: [\ d] +: [\ d] + | (\ w) {4} - [\ w] {2} [\ w] {2} [\ w] {2}: [\ w] {2}: [\ w] {2} (?: (+ -) (\ w) {2}) ?) (? P <主机名> \ S +) (P <发送方>。+ ?)\ [(? < pid > \ d +页)\]:?(? P <消息> (? s: *))美元”——标签:发送方:主机名:pid:匹配:选择器:“{发送者!= " ",pid != " "}’阶段:模板:来源:消息模板:“{{。发送方}}{{。pid}}: {{.message}}”- labeldrop: pid -输出:来源:信息指标:配置:-名称:集成remote_write: - basic_auth:密码:< your_prom_pass >用户名:< your_prom_user > url: < your_prom_url > scrape_configs: #这里添加任何片段,属于“metrics.configs。scrape_configs”部分。 # 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

指示板

macOS集成安装下列指示板在你Grafana云实例来帮助监视您的系统。

  • 节点出口商/ MacOS

MacOS概述

图像

MacOS日志

图像

警报

macOS集成包括以下有用的提醒:

警报 描述
NodeFilesystemAlmostOutOfSpace 警告:文件系统空间小于5%。
NodeFilesystemAlmostOutOfSpace 关键:文件系统空间小于3%。
NodeFilesystemFilesFillingUp 警告:文件系统将耗尽节点在接下来的24小时。
NodeFilesystemFilesFillingUp 关键:文件系统预计在未来4小时inode。
NodeFilesystemAlmostOutOfFiles 警告:文件系统索引节点离开不到5%。
NodeFilesystemAlmostOutOfFiles 关键:文件系统索引节点离开不到3%。
NodeNetworkReceiveErrs 警告:网络接口是许多接受错误报告。
NodeNetworkTransmitErrs 警告:网络接口是许多传输错误报告。
NodeTextFileCollectorScrapeError 警告:文本文件收集器节点出口国没有刮。

指标

macOS集成提供的最重要的指标,使用预先构建的仪表板和普罗米修斯警报,如下:

  • 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

更新日志

# 0.0.7 - 2023年1月*状态面板修复更新状态面板查询只返回单一系列——解决状态时不能打开面板点击查看按钮*更新节点mixin # 0.0.6 - 2022年11月最新版本*添加集成状态面板# 0.0.5 - 2022年9月*更新仪表板板描述。# 0.0.4 - 2022年5月*反向fsSpaceAvailableCriticalThreshold和fsSpaceAvailableWarningThreshold *更新单位磁盘和网络面板# 0.0.3 - 2022年5月*使用$(主机名)在生成代理配置,避免手工代码片段编辑#发布- 2022年5月*更新时间戳解析日志# 0.0.1 - 2022年5月*最初版本

成本

通过连接macOS实例Grafana云,你可能会产生费用。查看信息活动系列的数量Grafana云账号用途指标包括在每个云层,明白了活跃的系列和数据处理机使用云线价格