diff --git a/Cargo.lock b/Cargo.lock index 1067b3713..3cc1c471b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,7 +41,7 @@ dependencies = [ [[package]] name = "alerter" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "axum", @@ -922,7 +922,7 @@ dependencies = [ [[package]] name = "command" -version = "1.13.1" +version = "1.13.2" dependencies = [ "monitor_client", "run_command", @@ -1306,7 +1306,7 @@ dependencies = [ [[package]] name = "formatting" -version = "1.13.1" +version = "1.13.2" dependencies = [ "serror", ] @@ -1437,7 +1437,7 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "command", @@ -2041,7 +2041,7 @@ dependencies = [ [[package]] name = "logger" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "monitor_client", @@ -2111,7 +2111,7 @@ dependencies = [ [[package]] name = "migrator" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "chrono", @@ -2246,7 +2246,7 @@ dependencies = [ [[package]] name = "monitor_cli" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "clap", @@ -2262,7 +2262,7 @@ dependencies = [ [[package]] name = "monitor_client" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "async_timing_util", @@ -2294,7 +2294,7 @@ dependencies = [ [[package]] name = "monitor_core" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "async_timing_util", @@ -2349,7 +2349,7 @@ dependencies = [ [[package]] name = "monitor_periphery" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "async_timing_util", @@ -2773,7 +2773,7 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "periphery_client" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "monitor_client", @@ -4507,7 +4507,7 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "update_logger" -version = "1.13.1" +version = "1.13.2" dependencies = [ "anyhow", "logger", diff --git a/Cargo.toml b/Cargo.toml index ea3525b3e..f0a83d1d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["bin/*", "lib/*", "client/core/rs", "client/periphery/rs"] [workspace.package] -version = "1.13.1" +version = "1.13.2" edition = "2021" authors = ["mbecker20 "] license = "GPL-3.0-or-later" @@ -15,7 +15,7 @@ monitor_client = { path = "client/core/rs" } [workspace.dependencies] # LOCAL -monitor_client = "1.13.1" +monitor_client = "1.13.2" periphery_client = { path = "client/periphery/rs" } formatting = { path = "lib/formatting" } command = { path = "lib/command" } diff --git a/bin/periphery/src/config.rs b/bin/periphery/src/config.rs index d3d219525..8042387dd 100644 --- a/bin/periphery/src/config.rs +++ b/bin/periphery/src/config.rs @@ -65,6 +65,9 @@ pub fn periphery_config() -> &'static PeripheryConfig { include_disk_mounts: env .periphery_include_disk_mounts .unwrap_or(config.include_disk_mounts), + exclude_disk_mounts: env + .periphery_exclude_disk_mounts + .unwrap_or(config.exclude_disk_mounts), secrets: config.secrets, git_providers: config.git_providers, docker_registries: config.docker_registries, diff --git a/bin/periphery/src/stats.rs b/bin/periphery/src/stats.rs index a10ec07e0..df7731808 100644 --- a/bin/periphery/src/stats.rs +++ b/bin/periphery/src/stats.rs @@ -110,12 +110,17 @@ impl StatsClient { if d.file_system() != "overlay" { return false; } + let path = d.mount_point(); + for mount in &config.exclude_disk_mounts { + if path == mount { + return false; + } + } if config.include_disk_mounts.is_empty() { return true; } - let path = d.mount_point(); for mount in &config.include_disk_mounts { - if path.starts_with(mount) { + if path == mount { return true; } } diff --git a/client/core/rs/src/entities/config/periphery.rs b/client/core/rs/src/entities/config/periphery.rs index 368e3f76a..ee6067c18 100644 --- a/client/core/rs/src/entities/config/periphery.rs +++ b/client/core/rs/src/entities/config/periphery.rs @@ -136,7 +136,9 @@ pub struct Env { /// Override `passkeys` pub periphery_passkeys: Option>, /// Override `include_disk_mounts` - pub periphery_include_disk_mounts: Option>, + pub periphery_include_disk_mounts: Option>, + /// Override `exclude_disk_mounts` + pub periphery_exclude_disk_mounts: Option>, } /// # Periphery Configuration File @@ -190,7 +192,11 @@ pub struct PeripheryConfig { /// If non-empty, only includes specific mount paths in the disk report. #[serde(default)] - pub include_disk_mounts: Vec, + pub include_disk_mounts: Vec, + + /// Exclude specific mount paths in the disk report. + #[serde(default)] + pub exclude_disk_mounts: Vec, /// Mapping on local periphery secrets. These can be interpolated into eg. Deployment environment variables. /// Default: none @@ -236,6 +242,7 @@ impl Default for PeripheryConfig { allowed_ips: Default::default(), passkeys: Default::default(), include_disk_mounts: Default::default(), + exclude_disk_mounts: Default::default(), secrets: Default::default(), git_providers: Default::default(), docker_registries: Default::default(), diff --git a/config_example/aio.compose.yaml b/config_example/aio.compose.yaml index 88cc4e214..fef8891e8 100644 --- a/config_example/aio.compose.yaml +++ b/config_example/aio.compose.yaml @@ -52,7 +52,10 @@ services: - /var/run/docker.sock:/var/run/docker.sock - monitor-repos:/etc/monitor/repos # manage repos in a docker volume, or change it to an accessible host directory. # environment: - # PERIPHERY_INCLUDE_DISK_MOUNTS: /etc/monitor/repos # If the disk size is overreporting, only specific mounts. + # # If the disk size is overreporting, can use one of these to + # # whitelist / blacklist the disks to filter them, whichever is easier. + # PERIPHERY_INCLUDE_DISK_MOUNTS: /etc/monitor/repos + # PERIPHERY_EXCLUDE_DISK_MOUNTS: /snap monitor-mongo: image: mongo diff --git a/config_example/periphery.config.example.toml b/config_example/periphery.config.example.toml index deebcb834..f9f72549e 100644 --- a/config_example/periphery.config.example.toml +++ b/config_example/periphery.config.example.toml @@ -28,10 +28,14 @@ ## Env: PERIPHERY_LEGACY_COMPOSE_CLI # legacy_compose_cli = true -## Optional. Only include mounts with start with a specific path in the disk report. +## Optional. Only include mounts at specific paths in the disc report. ## Env: PERIPHERY_INCLUDE_DISK_MOUNTS # include_disk_mounts = ["/etc/monitor/repos"] +## Optional. Don't include these mounts in the disk report. +## Env: PERIPHERY_EXCLUDE_DISK_MOUNTS +# exclude_disk_mounts = ["/etc/monitor/repos"] + ######## # AUTH # ######## diff --git a/docsite/docs/core-setup.md b/docsite/docs/core-setup.md index 39901526f..d15dd4c09 100644 --- a/docsite/docs/core-setup.md +++ b/docsite/docs/core-setup.md @@ -13,11 +13,13 @@ Monitor Core itself can really only run remote builds. You also have to [**install the Monitor Periphery agent**](/docs/connecting-servers) on your hosts and connect them as **Servers** in order to alert / deploy etc. -If you only need to connect on one server (the one you are deploying Monitor Core on), you can do it all dockerized, -and use the [all-in-one compose file](https://github.com/mbecker20/monitor/blob/main/config_example/aio.compose.yaml). -This will deploy Monitor Core and Periphery, and automatically add the local periphery as a connected server. +If you **only need to connect on one server** (the one you are deploying Monitor Core on), you can do it all dockerized, +and use the [**all-in-one compose file**](https://github.com/mbecker20/monitor/blob/main/config_example/aio.compose.yaml). +This will deploy Monitor Core and Periphery, and automatically add the local periphery as a connected server. -You can currently and always will be able to **connect as many servers an you like** using the Periphery agent. +Deploying with the AIO compose file **will not** stop you from connecting more servers later, and is really just for setup convenience. + +You can currently and always will be able to **connect as many servers an you like** using the Periphery agent. ::: ### Configuration