https://github.com/maxim2266/rstat
Library "rstat" provides basic functionality for periodical health check of IoT devices running Linux.
https://github.com/maxim2266/rstat
golang iot linux monitoring monitoring-tool raspberry-pi ssh
Last synced: about 2 months ago
JSON representation
Library "rstat" provides basic functionality for periodical health check of IoT devices running Linux.
- Host: GitHub
- URL: https://github.com/maxim2266/rstat
- Owner: maxim2266
- License: bsd-3-clause
- Created: 2017-08-22T17:52:31.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-07-22T21:46:12.000Z (almost 5 years ago)
- Last Synced: 2024-12-30T09:42:17.472Z (over 1 year ago)
- Topics: golang, iot, linux, monitoring, monitoring-tool, raspberry-pi, ssh
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rstat
[](https://godoc.org/github.com/maxim2266/rstat)
[](https://goreportcard.com/report/github.com/maxim2266/rstat)
Library `rstat` provides basic functionality for periodical health check of IoT devices running Linux.
It has an API for invoking `ps` command on a remote device via `ssh`, returning a process tree with the
requested metrics for each process.
#### Usage example:
```Go
// compose ssh command with the given ip, user, password and timeout in seconds
ssh := rstat.SSHCommand("192.168.0.16", "pi", "raspberry", 5)
// request process tree with 3 metrics per process
root, err := rstat.ProcTree(ssh, "%cpu", "%mem", "cmd")
if err != nil {
return err
}
// iterate the process tree
root.ForEach(func(node *rstat.ProcNode) {
// just for example, print the metrics
fmt.Printf("%d %s %s %s %q\n", node.Pid, node.ParentPid, node.Stats["%CPU"], node.Stats["%MEM"], node.Stats["CMD"])
})
```
### Project status
The project is in a alpha state. Tested on Linux Mint 18.2. Go version 1.8.
##### Platform: Linux
##### License: BSD