only show size of / and paths including "external"

This commit is contained in:
mbecker20
2022-12-18 02:41:36 +00:00
parent 6284a48a3a
commit 81e96861d7
5 changed files with 19 additions and 14 deletions

View File

@@ -17,6 +17,6 @@ RUN sh ./${DEPS_INSTALLER}.sh
COPY --from=builder /builder/periphery/target/release/periphery /usr/local/bin/periphery
EXPOSE 9001
EXPOSE 8000
CMD "periphery"

View File

@@ -67,13 +67,17 @@ impl StatsClient {
for disk in self.sys.disks() {
let disk_total = disk.total_space() as f64 / BYTES_PER_GB;
let disk_free = disk.available_space() as f64 / BYTES_PER_GB;
let mount = disk.mount_point().to_owned();
let mount_str = mount.to_str().unwrap();
if mount_str == "/" || mount_str.contains("external") {
total_gb += disk_total;
free_gb += disk_free;
}
disks.push(SingleDiskUsage {
mount: disk.mount_point().to_owned(),
mount,
used_gb: disk_total - disk_free,
total_gb: disk_total,
});
total_gb += disk_total;
free_gb += disk_free;
}
let used_gb = total_gb - free_gb;
self.sys

View File

@@ -12,7 +12,7 @@ services:
environment:
- CONFIG_PATH=/config/config.toml
volumes:
- "/Users/max/monitor/core:/config"
- "~/.monitor/core.config.toml:/config/config.toml"
depends_on:
- mongo
@@ -24,15 +24,16 @@ services:
args:
DEPS_INSTALLER: install_full_periphery_deps
ports:
- "9001:9001"
- "8000:8000"
networks:
- monitor-network
environment:
- CONFIG_PATH=/config/config.toml
volumes:
- "/Users/max/monitor/periphery:/config"
- "/Users/max/monitor/repos-full:/repos"
- "~/.monitor/periphery.config.toml:/config/config.toml"
- "~/.monitor/repos-full:/repos"
- "/var/run/docker.sock:/var/run/docker.sock"
- "/external:/external"
periphery-slim:
image: periphery-slim
@@ -42,20 +43,20 @@ services:
args:
DEPS_INSTALLER: install_slim_periphery_deps
ports:
- "9002:9001"
- "8001:8000"
networks:
- monitor-network
environment:
- CONFIG_PATH=/config/config.toml
volumes:
- "/Users/max/monitor/periphery:/config"
- "/Users/max/monitor/repos-slim:/repos"
- "~/.monitor/periphery.config.toml:/config/config.toml"
- "~/.monitor/repos-slim:/repos"
- "/var/run/docker.sock:/var/run/docker.sock"
mongo:
image: mongo
ports:
- "27019:27017"
- "27017:27017"
networks:
- monitor-network

View File

@@ -17,7 +17,7 @@ async fn main() -> anyhow::Result<()> {
let start_ts = unix_timestamp_ms();
// let (server, deployment, build) = create_test_setup(&monitor, "test").await?;
let (server, deployment, build) = create_test_setup(&monitor, "test").await?;
let server_stats = get_server_stats(&monitor).await?;
println!("server stats:\n{server_stats:#?}\n");

View File

@@ -16,7 +16,7 @@ pub async fn create_test_setup(
monitor
.create_server(
&format!("{group_name}_server"),
"http://periphery-full:9001",
"http://periphery-full:8000",
)
.await
.context("failed at create server")?