Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Jun 16, 2024
1 parent c4dfdbd commit a852111
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,27 @@ To install and run `alloy` on hosts

```zsh
$ mkdir -p /opt/alloy
$ mkdir -p /var/lib/alloy

$ cd /tmp
$ wget https://github.com/grafana/alloy/releases/download/v1.0.0/alloy-linux-amd64.zip
$ wget https://github.com/grafana/alloy/releases/download/v1.1.1/alloy-linux-amd64.zip
$ unzip alloy-linux-amd64.zip

$ mv alloy-linux-amd64 /opt/alloy/agent

$ groupadd -f alloy
$ useradd -g alloy --no-create-home --shell /bin/false alloy

$ chown -R alloy:alloy /opt/alloy
$ chown -R alloy:alloy /var/lib/alloy
```

Create `/opt/alloy/config.alloy` from `config.alloy` in this repo. Then run alloy as a systemd service.

```zsh
$ echo "[Unit]
Description=Node Exporter
Documentation=https://prometheus.io/docs/guides/node-exporter/
Description=Alloy
Documentation=https://github.com/grafana/alloy
Wants=network-online.target
After=network-online.target
Expand All @@ -66,7 +70,7 @@ Environment="REMOTE_LOKI_WRITE_URL=http://X.X.X.X:3100/loki/api/v1/push"
Environment="REMOTE_PROMETHEUS_WRITE_URL=http://X.X.X.X:9090/api/v1/write"
Environment="REMOTE_PROMETHEUS_USERNAME=admin"
Environment="REMOTE_PROMETHEUS_PASSWORD=password"
ExecStart=/opt/alloy/agent run /opt/alloy/config.alloy
ExecStart=/opt/alloy/agent run --storage.path=/var/lib/alloy /opt/alloy/config.alloy
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/alloy.service
Expand Down
8 changes: 4 additions & 4 deletions config.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ logging {

// Collect metrics from the local running Alloy instance and forward to
// Prometheus.
prometheus.exporter.self "home_rpi_alloy" {}
prometheus.scrape "home_rpi_alloy" {
targets = prometheus.exporter.self.home_rpi_alloy.targets
prometheus.exporter.self "cougar_host" {}
prometheus.scrape "cougar_host" {
targets = prometheus.exporter.self.cougar_host.targets

forward_to = [prometheus.remote_write.remote_prometheus.receiver]
}

loki.source.file "badger_logs" {
targets = [
{__path__ = "/var/logs/badger.log", "color" = "pink", "service_name" = "badger", "component" = "backend"},
{__path__ = "/var/log/badger.log", "color" = "pink", "service_name" = "badger", "component" = "backend"},
]
forward_to = [loki.write.remote_loki.receiver]
}

0 comments on commit a852111

Please sign in to comment.