Skip to content

Commit

Permalink
Merge pull request #28 from navidys/develop
Browse files Browse the repository at this point in the history
added /proc/<pid>/net/snmp
  • Loading branch information
navidys authored Aug 25, 2024
2 parents 8700450 + ec9e6ed commit 68c7bb0
Show file tree
Hide file tree
Showing 7 changed files with 1,079 additions and 308 deletions.
1 change: 1 addition & 0 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Supported Features
* ns
* net/
* netstat
* snmp

*`/proc/buddyinfo`

Expand Down
14 changes: 14 additions & 0 deletions examples/process_net_snmp.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use procsys::process;

fn main() {
let sys_proc = process::collect(2).expect("system proc 2");
let sys_proc_netsnmp = sys_proc.net_snmp().expect("system proc 2 net snmp");

match serde_json::to_string_pretty(&sys_proc_netsnmp) {
Ok(output) => println!("{}", output),
Err(err) => {
log::error!("{}", err);
std::process::exit(1);
}
}
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod process;
pub mod process_cgroup;
pub mod process_io;
pub mod process_limits;
pub mod process_net_snmp;
pub mod process_netstat;
pub mod process_ns;
pub mod swaps;
Expand Down
4 changes: 2 additions & 2 deletions src/process_cgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
utils,
};

/// ProcessCgroup models one line from /proc/[pid]/cgroup
/// ProcessCgroup models one line from /proc/\[pid\]/cgroup
#[derive(Debug, Serialize, Clone, Default)]
pub struct ProcessCgroup {
pub hierarchy_id: usize,
Expand All @@ -21,7 +21,7 @@ impl ProcessCgroup {
}

impl Process {
/// cgroup reads from /proc/<pid>/cgroup and returns cgroup information of the process
/// cgroup reads from /proc/\<pid\>/cgroup and returns cgroup information of the process
pub fn cgroup(&self) -> CollectResult<Vec<ProcessCgroup>> {
let mut proc_cgroups = Vec::new();
let proc_cgroup_path_str = format!("{:?}", self.path());
Expand Down
Loading

0 comments on commit 68c7bb0

Please sign in to comment.