M Prober
This program aims to collect Linux system information including hostname, kernel version, uptime, RTC time, load average, CPU, memory, network interfaces and block devices. It can be used not only as a normal CLI tool, but also a web application with a front-end webpage and useful HTTP APIs.
Help
EXAMPLES:
mprober hostname # Show the hostname
mprober kernel # Show the kernel version
mprober uptime # Show the uptime
mprober uptime -m # Show the uptime and refresh every second
mprober uptime -p # Show the uptime without colors
mprober uptime -l # Show the uptime with darker colors (fitting in with light themes)
mprober uptime -s # Show the uptime in seconds
mprober time # Show the RTC (UTC) date and time
mprober time -m # Show the RTC (UTC) date and time and refresh every second
mprober time -p # Show the RTC (UTC) date and time without colors
mprober time -l # Show the RTC (UTC) date and time with darker colors (fitting in with light themes)
mprober cpu # Show load average and current CPU stats on average
mprober cpu -m 1000 # Show load average and CPU stats on average and refresh every 1000 milliseconds
mprober cpu -p # Show load average and current CPU stats on average without colors
mprober cpu -l # Show load average and current CPU stats on average with darker colors (fitting in with light themes)
mprober cpu -s # Show load average and current stats of CPU cores separately
mprober cpu -i # Only show CPU information
mprober memory # Show current memory stats
mprober memory -m 1000 # Show memory stats and refresh every 1000 milliseconds
mprober memory -p # Show current memory stats without colors
mprober memory -l # Show current memory stats with darker colors (fitting in with light themes)
mprober memory -u kb # Show current memory stats in KB
mprober network # Show current network stats
mprober network -m 1000 # Show network stats and refresh every 1000 milliseconds
mprober network -p # Show current network stats without colors
mprober network -l # Show current network stats with darker colors (fitting in with light themes)
mprober network -u kb # Show current network stats in KB
mprober volume # Show current volume stats
mprober volume -m 1000 # Show current volume stats and refresh every 1000 milliseconds
mprober volume -p # Show current volume stats without colors
mprober volume -l # Show current volume stats without colors
mprober volume -u kb # Show current volume stats in KB
mprober volume -i # Only show volume information without I/O rates
mprober volume --mounts # Show current volume stats including mount points
mprober web # Start a HTTP service on port 8000 to monitor this computer. The default time interval is 3 seconds
mprober web -m 2 # Start a HTTP service on port 8000 to monitor this computer. The time interval is set to 2 seconds
mprober web -p 7777 # Start a HTTP service on port 7777 to monitor this computer
mprober web -a auth_key # Start a HTTP service on port 8000 to monitor this computer. APIs need to be invoked with an auth key
mprober web --only-api # Start a HTTP service on port 8000 to serve only HTTP APIs
mprober benchmark # Run benchmarks
mprober benchmark --disable-cpu # Run benchmarks except for benchmarking CPU
mprober benchmark --enable-memory # Benchmark the memory
USAGE:
mprober [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
hostname Shows the hostname
kernel Shows the kernel version
uptime Shows the uptime
time Shows the RTC (UTC) date and time
cpu Shows CPU stats
memory Shows memory stats
network Shows network stats
volume Shows volume stats
web Starts a HTTP service to monitor this computer
benchmark Runs benchmarks to measure the performance of this environment
help Prints this message or the help of the given subcommand(s)
Requirements
- Linux Kernel Version: 3.10+
Usage
Installation / Uninstallation
From crates.io,
# cargo uninstall mprober
From GitHub (x86 and x86_64),
( | | ) && &&
# sudo rm /usr/local/bin/mprober
CLI
Get Hostname
In addition to hostname
, h
, host
, name
, and servername
are also acceptable.
Get Kernel Version
In addition to kernel
, k
, l
, and linux
are also acceptable.
Get System Uptime
In addition to uptime
, u
, up
, utime
, and ut
are also acceptable.
Get RTC Time
In addition to time
, t
, systime
, stime
, st
, utc
, utctime
, rtc
, rtctime
, and date
are also acceptable.
Show CPU Stats
In addition to cpu
, c
, cpus
, core
, cores
, load
, processor
, and processors
are also acceptable.
Show Memory Stats
In addition to memory
, m
, mem
, f
,free
, memories
, swap
, ram
, dram
, ddr
, cache
, buffer
, buffers
, buf
, and buff
are also acceptable.
Show Network Stats
In addition to network
, n
, net
, networks
,bandwidth
, and traffic
are also acceptable.
Show Volume Stats
In addition to volume
, v
, storage
, volumes
, d
, disk
, disks
, blk
, block
, blocks
, mount
, mounts
, ssd
, and hdd
are also acceptable.
Color Mode
Environment variables, MPROBER_LIGHT
and MPROBER_FORCE_PLAIN
can be used to control the output colors.
Web (HTTP)
Launching the Server
In addition to web
, w
, server
, and http
are also acceptable.
Once you start the server, you can open http://0.0.0.0:8000
via a web browser such as Firefox or Chrome.
To change the listening port, use the -p <port>
option. To change the detecting time interval, use the -m <SECONDS>
option, where the <SECONDS>
is ranged from 1
to 15
.
Benchmark
To benchmark the performance of CPU, memory and volumes,
In addition to benchmark
, b
, bench
, and performance
are also acceptable.
Adding the --disable-xxx
or --enable-xxx
flags can control what benchmarks you want to run.
HTTP APIs
GET /api/hostname
GET /api/kernel
GET /api/uptime
The unit of data is seconds.
GET /api/time
It's RTC time.
GET /api/cpu
GET /api/cpu-detect
The first value in the cpus_stat
field is the average usage of each cores. The remaining values are the usage for each logical CPU core.
GET /api/memory
The unit of numbers is bytes.
GET /api/network-detect
The unit of totals is bytes. The unit of rates is bytes/second.
GET /api/volume
The unit of totals is bytes.
GET /api/volume-detect
The unit of totals is bytes. The unit of rates is bytes/second.
GET /api/all
Authorization
If you need expose above HTTP APIs to the Internet. In order to prevent these APIs from being invoked by anyone, you can enable a simple authorization mechanism that is built in this program.
When starting the HTTP server from CLI, you can add a -a <AUTH_KEY>
option. Then, every API needs to be invoked by a request which contains a Authorization
header to send the AUTH_KEY
.
Also, you may want to disable the web page. Just add a --only-api
flag.
TODO
- Process snapshot (like the
ps
command) - Terminal monitor (like the
top
command) - Database Detection
- Benchmark (networks)