-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Cadvisor #225
Open
sudo-Tiz
wants to merge
13
commits into
mother-of-all-self-hosting:main
Choose a base branch
from
sudo-Tiz:cadvisor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add Cadvisor #225
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
55fab67
feat: add cadvisor
394344b
upgrade cadvisor documentation
015997c
better documentation
eb0ca86
Update templates/group_vars_mash_servers
sudo-Tiz c202951
Update templates/group_vars_mash_servers
sudo-Tiz 01c33dc
Update templates/group_vars_mash_servers
sudo-Tiz 32046a1
Update group_vars_mash_servers
sudo-Tiz 79dfb71
Update cadvisor.md
sudo-Tiz e0f302c
update grafana doc
85ad2ea
Merge branch 'main' into cadvisor
sudo-Tiz 85435ed
Merge branch 'main' into cadvisor
a2f007b
Merge branch 'main' into cadvisor
4241e81
Merge branch 'main' into cadvisor
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,100 @@ | ||
# cAdvisor | ||
|
||
This playbook can configure [cAdvisor](https://github.com/google/cadvisor) | ||
|
||
## Dependencies | ||
|
||
This service requires the following other services: | ||
|
||
- (optionally) [Traefik](traefik.md) - a reverse-proxy server for exposing cadvisor publicly | ||
- (optionally) [Prometheus](./prometheus.md) - a database for storing metrics | ||
- (optionally) [Grafana](./grafana.md) - a web UI that can query the prometheus datasource (connection) and display the logs | ||
|
||
## Configuration | ||
|
||
To enable this service, add the following configuration to your `vars.yml` file and re-run the [installation](../installing.md) process: | ||
|
||
```yaml | ||
######################################################################## | ||
# # | ||
# cadvisor # | ||
# # | ||
######################################################################## | ||
|
||
cadvisor_enabled: true | ||
# You will have to mount specific folders depending on your need | ||
# cadvisor_container_extra_arguments: | ||
# - "--mount type=bind,source=/,destination=/rootfs,readonly" | ||
# - "--mount type=bind,source=/sys,destination=/sys,readonly" | ||
# - "--mount type=bind,source=/var/lib/docker/,destination=/var/lib/docker,readonly" | ||
# - "--mount type=bind,source=/dev/disk/,destination=/dev/disk,readonly" | ||
|
||
######################################################################## | ||
# # | ||
# /cadvisor # | ||
# # | ||
######################################################################## | ||
``` | ||
|
||
See the full list of options in the [default/main.yml](default/main.yml) file | ||
|
||
cAdvisor can scrape metrics from system and containers. These metrics can be : | ||
|
||
- Displayed on the cAdvisor Web UI | ||
- Exposed to a metric-storage server like [Prometheus](./prometheus.md). | ||
|
||
## Exposing publicly cAdvisor | ||
|
||
To expose cAdvisor WebUI and metrics to the web, you need to assign a hostname in `cadvisor_hostname` and optionally a path-prefix. | ||
|
||
```yaml | ||
# To expose the metrics publicly, enable and configure the lines below: | ||
cadvisor_hostname: mash.example.com | ||
cadvisor_path_prefix: / | ||
|
||
# To protect the web ui and your metrics with HTTP Basic Auth, enable and configure the lines below. | ||
# See: https://doc.traefik.io/traefik/middlewares/http/basicauth/#users | ||
cadvisor_container_labels_traefik_middleware_basic_auth_enabled: true | ||
cadvisor_container_labels_traefik_middleware_basic_auth_users: "" | ||
``` | ||
|
||
## Integrating with Prometheus | ||
|
||
### Prerequesites | ||
|
||
The bare minimium is to ensure Prometheus can reach cadvisor. | ||
|
||
- If cadvisor is on a different host than Prometheus, refer to section [Exposing publicly cAdvisor](cadvisor.md#Exposing-publicly-cAdvisor) | ||
- If cadvisor is on the same host than prometheus, refer to section [Ensure Prometheus is on the same container network as cadvisor.](cadvisor.md#) | ||
|
||
### Ensure Prometheus is on the same container network as cAdvisor. | ||
|
||
If cadvisor and prometheus do not share a network, you will have to | ||
|
||
- Either connect Prometheus container network to cadvisor by editing `prometheus_container_additional_networks_auto` | ||
- Either connect cadvisor container network to Prometheus by editing `cadvisor_container_additional_networks_custom` | ||
|
||
Exemple: | ||
|
||
```yaml | ||
prometheus_container_additional_networks: | ||
- "{{ cadvisor_container_network }}" | ||
``` | ||
|
||
### Write the scrape config for prometheus | ||
|
||
```yaml | ||
prometheus_config_scrape_configs_additional: | ||
- job_name: cadvisor | ||
scrape_interval: 5s | ||
scrape_timeout: 5s | ||
static_configs: | ||
- targets: | ||
- "{{ cadvisor_identifier }}:8080" | ||
``` | ||
|
||
replace the target by your ip_adress:port if cAdvisor is on a different host than Prometheus | ||
|
||
## Usage | ||
|
||
After [installing](../installing.md), refer to the documentation of [cAdvisor](https://github.com/google/cadvisor). |
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These variables do not seem to be defined anymore, yet.. they're here.
That said, I think it's better if metrics had their own Traefik router (separate from the web UI) and for them to respect the
mash_playbook_metrics_exposure_*
variables automatically (auto-enabling metrics exposure for this service, possibly protected with the Basic Auth credentials specified inmash_playbook_metrics_exposure_http_basic_auth_*
).The web UI could remain optional and have its (optional) separate set of Basic Auth credentials