我设置了grafana云并连接了apachehttp服务器集成,当我尝试启动时,我收到了一个错误。我阅读了文档,但不幸的是,我没有学到任何合理的
加载配置文件/etc/grafana-agent.yaml:yaml:unmarshal错误:第12行:在类型集成中找不到字段apache_http。Manager配置/etc/grafana-agent.yaml
agent:
enabled: true
metric_relabel_configs:
- source_labels:
- exported_job
target_label: job
- source_labels:
- exported_instance
target_label: instance
- action: labeldrop
regex: (exported_instance|exported_job)
apache_http:
enabled: true
instance: <yourhostname>
scrape_uri: http://localhost:9090/server-status?auto
node_exporter:
enabled: true
relabel_configs:
- replacement: hostname
target_label: instance
prometheus_remote_write:
- basic_auth:
password: test
username: test
url: test
logs:
configs:
- clients:
- basic_auth:
password: test
username: test
url: test
name: integrations
positions:
filename: /tmp/positions.yaml
scrape_configs:
- job_name: integrations/node_exporter_journal_scrape
journal:
labels:
instance: hostname
job: integrations/node_exporter
max_age: 24h
relabel_configs:
- source_labels:
- __journal__systemd_unit
target_label: unit
- source_labels:
- __journal__boot_id
target_label: boot_id
- source_labels:
- __journal__transport
target_label: transport
- source_labels:
- __journal_priority_keyword
target_label: level
- job_name: integrations/apache_error
pipeline_stages:
- regex:
expression: '^[[^ ]* (?P<timestamp>[^]]*)] [(?:(?P<module>[^:]]+):)?(?P<level>[^]]+)](?: [pid (?P<pid>[^]]*)])?(?: [client (?P<client>[^]]*)])? (?P<message>.*)$'
- labels:
level: null
module: null
- static_labels:
logtype: error
static_configs:
- labels:
__path__: /var/log/httpd/error.log
instance: <yourhostname>
job: integrations/apache_http
targets:
- localhost
- job_name: integrations/apache_access
pipeline_stages:
- regex:
expression: '^(?P<ip>[^ ]*) [^ ]* (?P<user>[^ ]*) [(?P<timestamp>[^]]*)] "(?P<method>S+)(?: +(?P<path>[^ ]*) +S*)?" (?P<code>[^ ]*) (?P<size>[^ ]*)(?: "(?P<referer>[^"]*)" "(?P<agent>.*)")?$'
- metrics:
response_http_codes:
config:
buckets:
- 199
- 299
- 399
- 499
- 599
description: Apache responses by HTTP codes
prefix: apache_
source: code
type: Histogram
- labels:
method: null
- static_labels:
logtype: access
static_configs:
- labels:
__path__: /var/log/httpd/access.log
instance: <yourhostname>
job: integrations/apache_http
targets:
- localhost
target_config:
sync_period: 10s
metrics:
configs:
- name: integrations
remote_write:
- basic_auth:
password: test
username: test
url: test
global:
scrape_interval: 60s
wal_directory: /tmp/grafana-agent-wal```
这是源代码中的错误,并在新版本中修复,但云使用旧版本的配置。下载安装程序并手动进行
wget https://raw.githubusercontent.com/grafana/agent/release/production/grafanacloud-install.sh
和变更线:
RELEASE_VERSION="0.25.1"
至最新https://github.com/grafana/agent/releases/
然后使其可执行
chmod +x grafanacloud-install.sh
并像他们建议的那样运行安装,只需将命令从curl更改为本地脚本:
sudo ARCH=amd64 GCLOUD_STACK_ID="***" GCLOUD_API_KEY="***" GCLOUD_API_URL="***" /bin/sh -c "./grafanacloud-install.sh"