Skip to content

Instantly share code, notes, and snippets.

@lechidung
Created January 2, 2023 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lechidung/f5dfb6c5875bd61d129cf1655c201da5 to your computer and use it in GitHub Desktop.
Save lechidung/f5dfb6c5875bd61d129cf1655c201da5 to your computer and use it in GitHub Desktop.
Grafana cloud
## Replace `hostname-spy-amz-fe` -> name filter
integrations:
node_exporter:
enabled: true
relabel_configs:
- replacement: hostname-spy-amz-fe
target_label: instance
prometheus_remote_write:
- basic_auth:
password: eyJrI...
username: 712491
url: https://prometheus....grafana.net/api/prom/push
logs:
configs:
- clients:
- basic_auth:
password: eyJrIjoiMjQ1NzlmMW...
username: 355215
url: https://log....grafana.net/loki/api/v1/push
name: spy-amz-fe
positions:
filename: /tmp/positions.yaml
scrape_configs:
- job_name: integrations/node_exporter_journal_scrape
journal:
labels:
instance: hostname-spy-amz-fe
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/node_exporter_direct_scrape
static_configs:
- labels:
__path__: /var/log/{syslog,messages,*.log}
instance: hostname-spy-amz-fe
job: integrations/node_exporter
targets:
- localhost
target_config:
sync_period: 10s
metrics:
configs:
- name: spy-amz-fe
remote_write:
- basic_auth:
password: eyJrIjoi...
username: 712491
url: https://prome....grafana.net/api/prom/push
global:
scrape_interval: 60s
wal_directory: /tmp/grafana-agent-wal
## Install grafana agent
sudo mkdir -p /etc/apt/keyrings/
sudo wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg
sudo echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install grafana-agent
## Grafana agent command
sudo systemctl start grafana-agent
sudo systemctl status grafana-agent
sudo systemctl enable grafana-agent
sudo systemctl restart grafana-agent
## Update config grafana agent
sudo vi /etc/agent-config.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment