0.1.8 add process start time

This commit is contained in:
mbecker20
2023-01-12 05:07:13 +00:00
parent 809be61e9c
commit 3f478fefdf
10 changed files with 42 additions and 39 deletions

46
Cargo.lock generated
View File

@@ -392,7 +392,7 @@ dependencies = [
[[package]]
name = "core"
version = "0.1.5"
version = "0.1.8"
dependencies = [
"anyhow",
"async_timing_util",
@@ -408,8 +408,8 @@ dependencies = [
"hex",
"hmac",
"jwt",
"monitor_helpers 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_helpers 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mungos",
"periphery_client",
"serde",
@@ -644,10 +644,10 @@ checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb"
[[package]]
name = "db_client"
version = "0.1.4"
version = "0.1.8"
dependencies = [
"anyhow",
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mungos",
]
@@ -1488,11 +1488,11 @@ dependencies = [
[[package]]
name = "monitor_client"
version = "0.1.5"
version = "0.1.8"
dependencies = [
"anyhow",
"futures-util",
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest",
"serde",
"serde_derive",
@@ -1504,7 +1504,7 @@ dependencies = [
[[package]]
name = "monitor_helpers"
version = "0.1.6"
version = "0.1.8"
dependencies = [
"anyhow",
"async_timing_util",
@@ -1512,7 +1512,7 @@ dependencies = [
"bollard",
"futures",
"futures-util",
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand",
"run_command",
"serde",
@@ -1523,9 +1523,9 @@ dependencies = [
[[package]]
name = "monitor_helpers"
version = "0.1.6"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978656d0bdc785700d9330ffe4ee2a51c1df03c6104de442ac9256b19e4913c3"
checksum = "571e3598c45b0c6190a43a6e7049f49529ff33c67dd79f3b12ba748c7c846e7d"
dependencies = [
"anyhow",
"async_timing_util",
@@ -1533,7 +1533,7 @@ dependencies = [
"bollard",
"futures",
"futures-util",
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand",
"run_command",
"serde",
@@ -1544,7 +1544,7 @@ dependencies = [
[[package]]
name = "monitor_periphery"
version = "0.1.6"
version = "0.1.8"
dependencies = [
"anyhow",
"async_timing_util",
@@ -1555,8 +1555,8 @@ dependencies = [
"dotenv",
"envy",
"futures-util",
"monitor_helpers 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_helpers 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"run_command",
"serde",
"serde_derive",
@@ -1570,7 +1570,7 @@ dependencies = [
[[package]]
name = "monitor_types"
version = "0.1.6"
version = "0.1.8"
dependencies = [
"anyhow",
"bollard",
@@ -1587,9 +1587,9 @@ dependencies = [
[[package]]
name = "monitor_types"
version = "0.1.6"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8dd4e96a045558096645f2d7f99c4b8d0ddab3591f315f5f7f8238fcdd819d"
checksum = "c99ca4b55b152f913e5597496f30dff0eec3b86ae31db7ea3c5e199ae1a056a9"
dependencies = [
"anyhow",
"bollard",
@@ -1811,9 +1811,9 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.9.5"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba"
checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf"
dependencies = [
"cfg-if",
"libc",
@@ -1839,12 +1839,12 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "periphery_client"
version = "0.1.4"
version = "0.1.8"
dependencies = [
"anyhow",
"futures-util",
"monitor_helpers 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_helpers 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"monitor_types 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest",
"serde",
"serde_json",

View File

@@ -1,6 +1,6 @@
[package]
name = "core"
version = "0.1.5"
version = "0.1.8"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -8,8 +8,8 @@ edition = "2021"
[dependencies]
# helpers = { package = "monitor_helpers", path = "../lib/helpers" }
# types = { package = "monitor_types", path = "../lib/types" }
helpers = { package = "monitor_helpers", version = "0.1.6" }
types = { package = "monitor_types", version = "0.1.6" }
helpers = { package = "monitor_helpers", version = "0.1.8" }
types = { package = "monitor_types", version = "0.1.8" }
db = { package = "db_client", path = "../lib/db_client" }
periphery = { package = "periphery_client", path = "../lib/periphery_client" }
axum_oauth2 = { path = "../lib/axum_oauth2" }

View File

@@ -1,12 +1,12 @@
[package]
name = "db_client"
version = "0.1.4"
version = "0.1.8"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
types = { package = "monitor_types", version = "0.1.6" }
types = { package = "monitor_types", version = "0.1.8" }
# types = { package = "monitor_types", path = "../types" }
mungos = "0.3.0"
anyhow = "1.0"

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_helpers"
version = "0.1.6"
version = "0.1.8"
edition = "2021"
authors = ["MoghTech"]
description = "helpers used as dependency for mogh tech monitor"
@@ -10,7 +10,7 @@ license = "GPL-3.0-or-later"
[dependencies]
# types = { package = "monitor_types", path = "../types" }
types = { package = "monitor_types", version = "0.1.6" }
types = { package = "monitor_types", version = "0.1.8" }
async_timing_util = "0.1.12"
bollard = "0.13"
anyhow = "1.0"

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_client"
version = "0.1.5"
version = "0.1.8"
edition = "2021"
authors = ["MoghTech"]
description = "a client to interact with the monitor system"
@@ -9,7 +9,7 @@ license = "GPL-3.0-or-later"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
monitor_types = "0.1.6"
monitor_types = "0.1.8"
# monitor_types = { path = "../types" }
reqwest = { version = "0.11", features = ["json"] }
tokio-tungstenite = { version = "0.18", features=["native-tls"] }

View File

@@ -1,13 +1,13 @@
[package]
name = "periphery_client"
version = "0.1.4"
version = "0.1.8"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
helpers = { package = "monitor_helpers", version = "0.1.6" }
types = { package = "monitor_types", version = "0.1.6" }
helpers = { package = "monitor_helpers", version = "0.1.8" }
types = { package = "monitor_types", version = "0.1.8" }
# types = { package = "monitor_types", path = "../types" }
# helpers = { package = "monitor_helpers", path = "../helpers" }
tokio-tungstenite = { version = "0.18", features=["native-tls"] }

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_types"
version = "0.1.6"
version = "0.1.8"
edition = "2021"
authors = ["MoghTech"]
description = "types for the mogh tech monitor"

View File

@@ -242,6 +242,8 @@ pub struct SystemProcess {
#[serde(default, skip_serializing_if = "String::is_empty")]
pub exe: String,
pub cmd: Vec<String>,
#[serde(default)]
pub start_time: f64,
pub cpu_perc: f32,
pub mem_mb: f64,
pub disk_read_kb: f64,

View File

@@ -1,6 +1,6 @@
[package]
name = "monitor_periphery"
version = "0.1.6"
version = "0.1.8"
edition = "2021"
authors = ["MoghTech"]
description = "monitor periphery binary | run monitor periphery as system daemon"
@@ -15,8 +15,8 @@ path = "src/main.rs"
[dependencies]
# helpers = { package = "monitor_helpers", path = "../lib/helpers" }
# types = { package = "monitor_types", path = "../lib/types" }
helpers = { package = "monitor_helpers", version = "0.1.6" }
types = { package = "monitor_types", version = "0.1.6" }
helpers = { package = "monitor_helpers", version = "0.1.8" }
types = { package = "monitor_types", version = "0.1.8" }
run_command = { version = "0.0.5", features = ["async_tokio"] }
async_timing_util = "0.1.12"
tokio = { version = "1.24", features = ["full"] }

View File

@@ -346,6 +346,7 @@ impl StatsClient {
name: p.name().to_string(),
exe: p.exe().to_str().unwrap_or("").to_string(),
cmd: p.cmd().to_vec(),
start_time: (p.start_time() * 1000) as f64,
cpu_perc: p.cpu_usage(),
mem_mb: p.memory() as f64 / BYTES_PER_MB,
disk_read_kb: disk_usage.read_bytes as f64 / BYTES_PER_KB,