https://github.com/gathecageorge/vps-monitoring-prometheus-loki
Allow monitoring a VPS and grafana for dashboards and logs
https://github.com/gathecageorge/vps-monitoring-prometheus-loki
grafana loki node-exporter portainer prometheus promtail
Last synced: 6 months ago
JSON representation
Allow monitoring a VPS and grafana for dashboards and logs
- Host: GitHub
- URL: https://github.com/gathecageorge/vps-monitoring-prometheus-loki
- Owner: gathecageorge
- Created: 2022-02-02T12:20:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-14T14:00:30.000Z (about 1 year ago)
- Last Synced: 2024-11-07T13:40:49.701Z (12 months ago)
- Topics: grafana, loki, node-exporter, portainer, prometheus, promtail
- Language: Shell
- Homepage:
- Size: 65.4 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Setup monitoring on a your server using prometheus/node-exporter/promtail/loki/grafana/portainer
1. Clone this repository to the location you want.
2. Copy `.env_template` to `.env` and add the required changes sample command: `cp .env_template .env`
3. Modify .env as required. Under `COMPOSE_FILE` you can set the services you need deployed. By default its all of them. If you need to remove any of them, just remove its corresponding yml file from list. i.e to remove portainer, them remove `portainer.yml` from the list. Remember to remove the `:`(full collon) separator also.
4. Run `docker-compose up -d` to start all services.
5. Access grafana from the IP of machine and port 3000.## NB
- It is recommended that when running grafana, also run `prometheus-metrics.yml` and `loki-logs.yml` and `promtail-logs.yml`. Otherwise you need to login to grafana and change the prometheus and Loki datasource URLs as required.
- You can setup prometheus with remote write to another prometheus/mimir/thanos creating a `custom-prom.yml` file under prometheus directory. Sample in same folder.
- You can setup promtail with remote write to another loki creating a `custom-lokiurl.yml` file under prometheus directory. Sample in same folder.---
### NB: Grafana domain access
If you want domain access enabled, modify .env file and add domain in place of localhost. Example below```bash
GRAFANA_DOMAIN=mydomain.com
GRAFANA_ADMIN_USER=myadmin
GRAFANA_ADMIN_PASSWORD=myadmin
```### NB: Portainer access
If you want to access portainer using ssl, you need to modify port exposed to `9443` from `9000`## NOTE
Promtail and prometheus uses docker daemon to pick up logs/metrics for containers with label "promtail.logs=true" or "metrics.scrape=true".
Example when using docker compose:
```yaml
services:
node-exporter:
image: prom/node-exporter:latest
labels:
- promtail.logs=true- metrics.scrape=true
- metrics.path=/metrics
- metrics.port=9100
- metrics.instance=node-exporter
#.........other options for the service
```If you are running a container manually using docker run command specify the log options like below.
`docker run --rm -d --name randomlogger --label promtail.logs=true chentex/random-logger:latest 100 400`
This will run a random log generator generating logs randomly one for each time between 100 and 400 milliseconds. Read more about random log image from the owners github page
[https://github.com/chentex/random-logger](https://github.com/chentex/random-logger)