-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc4263e
commit 5738fc9
Showing
12 changed files
with
166 additions
and
5 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
## Compose sample | ||
|
||
### Prometheus & Grafana | ||
|
||
Project structure: | ||
|
||
``` | ||
. | ||
├── compose.yaml | ||
├── grafana | ||
│ └── grafana-config.yaml | ||
├── prometheus | ||
│ └── prometheus-config.yaml | ||
└── README.md | ||
``` | ||
|
||
[_compose.yaml_](docker-compose.yaml) | ||
|
||
``` | ||
services: | ||
prometheus: | ||
image: prom/prometheus | ||
... | ||
ports: | ||
- 9090:9090 | ||
grafana: | ||
image: grafana/grafana | ||
... | ||
ports: | ||
- 3000:3000 | ||
``` | ||
|
||
Copy the `monitoring` directory over to your Docker host with secure copy like so: | ||
|
||
```bash | ||
scp -r home-ops/docker/monitoring sysadm@<docker-host>:/home/sysadm/monitoring | ||
``` | ||
|
||
Then use the directory path on the host to map your config files as example: | ||
|
||
```yaml | ||
volumes: | ||
- /home/sysadm/monitoring/prometheus:/etc/prometheus | ||
``` | ||
The compose file defines a stack with two services `prometheus` and `grafana`. | ||
|
||
When deploying the stack, docker compose maps port the default ports for each service to the equivalent ports on the host in order to inspect easier the web interface of each service. | ||
Make sure the ports 9090 and 3000 on the host are not already in use. | ||
|
||
## Deploy with docker compose | ||
|
||
``` | ||
$ docker compose up -d | ||
Creating network "prometheus-grafana_default" with the default driver | ||
Creating volume "prometheus-grafana_prom_data" with default driver | ||
... | ||
Creating grafana ... done | ||
Creating prometheus ... done | ||
Attaching to prometheus, grafana | ||
|
||
``` | ||
## Expected result | ||
Listing containers must show two containers running and the port mapping as below: | ||
``` | ||
$ docker ps | ||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | ||
dbdec637814f prom/prometheus "/bin/prometheus --c…" 8 minutes ago Up 8 minutes 0.0.0.0:9090->9090/tcp prometheus | ||
79f667cb7dc2 grafana/grafana "/run.sh" 8 minutes ago Up 8 minutes 0.0.0.0:3000->3000/tcp grafana | ||
``` | ||
Navigate to `http://localhost:3000` in your web browser and use the login credentials specified in the compose file to access Grafana. It is already configured with prometheus as the default datasource. | ||
![page](output.jpg) | ||
Navigate to `http://localhost:9090` in your web browser to access directly the web interface of prometheus. | ||
Stop and remove the containers. Use `-v` to remove the volumes if looking to erase all data. | ||
``` | ||
docker compose down -v | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: 1 | ||
|
||
datasources: | ||
- name: Prometheus | ||
type: prometheus | ||
url: http://prometheus:9090 | ||
isDefault: true | ||
access: proxy | ||
editable: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
global: | ||
scrape_interval: 15s | ||
evaluation_interval: 15s | ||
|
||
scrape_configs: | ||
- job_name: "prometheus" | ||
static_configs: | ||
- targets: ["localhost:9090", "192.168.7.70:9100"] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Run Redis Stack on Docker | ||
|
||
How to install Redis Stack using Docker | ||
|
||
To get started with Redis Stack using Docker, you first need to select a Docker image: | ||
|
||
- `redis/redis-stack` contains both Redis Stack server and Redis Insight. This container is best for local development because you can use the embedded Redis Insight to visualize your data. | ||
|
||
- `redis/redis-stack-server` provides Redis Stack server only. This container is best for production deployment. | ||
|
||
## Getting started | ||
|
||
**redis/redis-stack** | ||
|
||
To start a Redis Stack container using the redis-stack image, run the following command in your terminal: | ||
|
||
[_compose.yaml_](compose.yaml) | ||
|
||
The docker run command above also exposes Redis Insight on port `8001`. You can use Redis Insight by pointing your browser to `localhost:8001`. | ||
|
||
[https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/docker/](https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/docker/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '3.8' | ||
|
||
services: | ||
redis-stack: | ||
image: redis/redis-stack:latest | ||
container_name: redis-stack | ||
ports: | ||
- '6379:6379' | ||
- '8001:8001' | ||
volumes: | ||
- redis_data:/data | ||
|
||
volumes: | ||
redis_data: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters