{"id":21586053,"url":"https://github.com/magiclen/m-prober","last_synced_at":"2025-04-10T20:15:06.784Z","repository":{"id":34851795,"uuid":"184539021","full_name":"magiclen/m-prober","owner":"magiclen","description":"This program aims to collect Linux system information including hostname, kernel version, uptime, RTC time, load average, CPU, memory, network interfaces, block devices and processes. 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.","archived":false,"fork":false,"pushed_at":"2024-02-21T02:50:29.000Z","size":4611,"stargazers_count":40,"open_issues_count":1,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T17:55:18.288Z","etag":null,"topics":["cli","linux","mprober","probe","rust","webapplication"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magiclen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-02T07:29:01.000Z","updated_at":"2025-03-04T20:32:54.000Z","dependencies_parsed_at":"2023-11-26T04:19:21.818Z","dependency_job_id":"7a77603f-c394-4cf5-9848-b99a98a19865","html_url":"https://github.com/magiclen/m-prober","commit_stats":{"total_commits":158,"total_committers":1,"mean_commits":158.0,"dds":0.0,"last_synced_commit":"c6f8a90c9437072b3353a9b0365bc2e8ada2b186"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fm-prober","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fm-prober/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fm-prober/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magiclen%2Fm-prober/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magiclen","download_url":"https://codeload.github.com/magiclen/m-prober/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288614,"owners_count":21078907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","linux","mprober","probe","rust","webapplication"],"created_at":"2024-11-24T15:12:30.341Z","updated_at":"2025-04-10T20:15:06.764Z","avatar_url":"https://github.com/magiclen.png","language":"Rust","readme":"M Prober\n====================\n\n[![CI](https://github.com/magiclen/m-prober/actions/workflows/ci.yml/badge.svg)](https://github.com/magiclen/m-prober/actions/workflows/ci.yml)\n\nThis program aims to collect Linux system information including hostname, kernel version, uptime, RTC time, load average, CPU, memory, network interfaces, block devices and processes. 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.\n\n## Help\n\n```\nEXAMPLES:\nmprober hostname                      # Show the hostname\nmprober kernel                        # Show the kernel version\nmprober uptime                        # Show the uptime\nmprober uptime -m                     # Show the uptime and refresh every second\nmprober uptime -p                     # Show the uptime without colors\nmprober uptime -l                     # Show the uptime with darker colors (fitting in with light themes)\nmprober uptime -s                     # Show the uptime in seconds\nmprober time                          # Show the RTC (UTC) date and time\nmprober time -m                       # Show the RTC (UTC) date and time and refresh every second\nmprober time -p                       # Show the RTC (UTC) date and time without colors\nmprober time -l                       # Show the RTC (UTC) date and time with darker colors (fitting in with light themes)\nmprober cpu                           # Show load average and current CPU stats on average\nmprober cpu -m 1000                   # Show load average and CPU stats on average and refresh every 1000 milliseconds\nmprober cpu -p                        # Show load average and current CPU stats on average without colors\nmprober cpu -l                        # Show load average and current CPU stats on average with darker colors (fitting in with light themes)\nmprober cpu -s                        # Show load average and current stats of CPU cores separately\nmprober cpu -i                        # Only show CPU information\nmprober memory                        # Show current memory stats\nmprober memory -m 1000                # Show memory stats and refresh every 1000 milliseconds\nmprober memory -p                     # Show current memory stats without colors\nmprober memory -l                     # Show current memory stats with darker colors (fitting in with light themes)\nmprober memory -u kb                  # Show current memory stats in KB\nmprober network                       # Show current network stats\nmprober network -m 1000               # Show network stats and refresh every 1000 milliseconds\nmprober network -p                    # Show current network stats without colors\nmprober network -l                    # Show current network stats with darker colors (fitting in with light themes)\nmprober network -u kb                 # Show current network stats in KB\nmprober volume                        # Show current volume stats\nmprober volume -m 1000                # Show current volume stats and refresh every 1000 milliseconds\nmprober volume -p                     # Show current volume stats without colors\nmprober volume -l                     # Show current volume stats without colors\nmprober volume -u kb                  # Show current volume stats in KB\nmprober volume -i                     # Only show volume information without I/O rates\nmprober volume --mounts               # Show current volume stats including mount points\nmprober process                       # Show a snapshot of the current processes\nmprober process -m 1000               # Show a snapshot of the current processes and refresh every 1000 milliseconds\nmprober process -p                    # Show a snapshot of the current processes without colors\nmprober process -l                    # Show a snapshot of the current processes with darker colors (fitting in with light themes)\nmprober process -i                    # Show a snapshot of the current processes but not including CPU usage\nmprober process -u kb                 # Show a snapshot of the current processes. Information about memory size is in KB\nmprober process --truncate 10         # Show a snapshot of the current processes with a specific truncation length to truncate user, group, program's names\nmprober process --top 10              # Show a snapshot of current top-10 (ordered by CPU and memory usage) processes\nmprober process -t                    # Show a snapshot of the current processes with the start time of each process\nmprober process --pid-filter 3456     # Show a snapshot of the current processes which are related to a specific PID\nmprober process --user-filter user1   # Show a snapshot of the current processes which are related to a specific user\nmprober process --group-filter gp1    # Show a snapshot of the current processes which are related to a specific group\nmprober process --tty-filter tty      # Show a snapshot of the current processes which are related to specific tty names matched by a regex\nmprober process --program-filter ab   # Show a snapshot of the current processes which are related to specific program names or commands matched by a regex\nmprober web                           # Start a HTTP service on port 8000 to monitor this computer. The default time interval is 3 seconds\nmprober web -m 2                      # Start a HTTP service on port 8000 to monitor this computer. The time interval is set to 2 seconds\nmprober web -p 7777                   # Start a HTTP service on port 7777 to monitor this computer\nmprober web --addr 127.0.0.1          # Start a HTTP service on 127.0.0.1:8000 to monitor this computer\nmprober web -a auth_key               # Start a HTTP service on port 8000 to monitor this computer. APIs need to be invoked with an auth key\nmprober web --only-api                # Start a HTTP service on port 8000 to serve only HTTP APIs\nmprober benchmark                     # Run benchmarks\nmprober benchmark --disable-cpu       # Run benchmarks except for benchmarking CPU\nmprober benchmark --enable-memory     # Benchmark the memory\n\nUsage: mprober \u003cCOMMAND\u003e\n\nCommands:\n  hostname   Show the hostname\n  kernel     Show the kernel version\n  uptime     Show the uptime\n  time       Show the RTC (UTC) date and time\n  cpu        Show CPU stats\n  memory     Show memory stats\n  network    Show network stats\n  volume     Show volume stats\n  process    Show process stats\n  web        Start a HTTP service to monitor this computer\n  benchmark  Run benchmarks to measure the performance of this environment\n  help       Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help\n  -V, --version  Print version\n```\n\n## Requirements\n\n* Linux Kernel Version: 3.10+\n\n## Usage\n\n### Installation / Uninstallation\n\nFrom [crates.io](https://crates.io/crates/mprober),\n\n```bash\ncargo install mprober\n\n# cargo uninstall mprober\n```\n\nFrom [GitHub](https://github.com/magiclen/m-prober) (x86 and x86_64),\n\n```bash\n(curl -s https://api.github.com/repos/magiclen/m-prober/releases/latest | sed -r -n 's/.*\"browser_download_url\": *\"(.*\\/mprober_'$(uname -m)')\".*/\\1/p' | wget -i -) \u0026\u0026 sudo mv mprober_$(uname -m) /usr/local/bin/mprober \u0026\u0026 sudo chmod +x /usr/local/bin/mprober\n\n# sudo rm /usr/local/bin/mprober\n```\n\n### CLI\n\n##### Get Hostname\n\n```bash\nmprober hostname\n```\n\nIn addition to `hostname`, `h`, `host`, `name`, and `servername` are also acceptable.\n\n![hostname.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/hostname.png)\n\n##### Get Kernel Version\n\n```bash\nmprober kernel\n```\n\nIn addition to `kernel`, `k`, `l`, and `linux` are also acceptable.\n\n![kernel.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/kernel.png)\n\n##### Get System Uptime\n\n```bash\nmprober uptime\n```\n\nIn addition to `uptime`, `u`, `up`, `utime`, and `ut` are also acceptable.\n\n![uptime.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/uptime.png)\n\n##### Get RTC Time\n\n```bash\nmprober time\n```\n\nIn addition to `time`, `t`, `systime`, `stime`, `st`, `utc`, `utctime`, `rtc`, `rtctime`, and `date` are also acceptable.\n\n![time.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/time.png)\n\n##### Show CPU Stats\n\n```bash\nmprober cpu\n```\n\nIn addition to `cpu`, `c`, `cpus`, `core`, `cores`, `load`, `processor`, and `processors` are also acceptable.\n\n![cpu.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/cpu.png)\n\n##### Show Memory Stats\n\n```bash\nmprober memory\n```\n\nIn addition to `memory`, `m`, `mem`, `f`,`free`, `memories`, `swap`, `ram`, `dram`, `ddr`, `cache`, `buffer`, `buffers`, `buf`, and `buff` are also acceptable.\n\n![memory.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/memory.png)\n\n##### Show Network Stats\n\n```bash\nmprober network\n```\n\nIn addition to `network`, `n`, `net`, `networks`,`bandwidth`, and `traffic` are also acceptable.\n\n![network.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/network.png)\n\n##### Show Volume Stats\n\n```bash\nmprober volume\n```\n\nIn addition to `volume`, `v`, `storage`, `volumes`, `d`, `disk`, `disks`, `blk`, `block`, `blocks`, `mount`, `mounts`, `ssd`, and `hdd` are also acceptable.\n\n![volume.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/volume.png)\n\n#### Color Mode\n\nEnvironment variables, `MPROBER_LIGHT` and `MPROBER_FORCE_PLAIN` can be used to control the output colors.\n\n![colors.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/colors.png)\n\n#### Benchmark\n\nTo benchmark the performance of CPU, memory and volumes,\n\n```bash\nmprober benchmark\n```\n\nIn addition to `benchmark`, `b`, `bench`, and `performance` are also acceptable.\n\nAdding the `--disable-xxx` or `--enable-xxx` flags can control what benchmarks you want to run.\n\n![web.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/benchmark.png)\n\n### Web (HTTP)\n\n#### Launching the Server\n\n```bash\nmprober web\n```\n\nIn addition to `web`, `w`, `server`, and `http` are also acceptable.\n\nOnce you start the server, you can open [`http://0.0.0.0:8000`](http://0.0.0.0:8000) via a web browser such as Firefox or Chrome.\n\n![web.png](https://raw.githubusercontent.com/magiclen/m-prober/master/doc-images/web.png)\n\nTo change the listening port, use the `-p \u003cport\u003e` option. To change the detecting time interval, use the `-m \u003cSECONDS\u003e` option, where the `\u003cSECONDS\u003e` is ranged from `1` to `15`.\n\n#### HTTP APIs\n\n##### *GET* `/api/hostname`\n\n```json\n{\n    \"code\": 0,\n    \"data\": \"magiclen-linux\"\n}\n```\n\n##### *GET* `/api/kernel`\n\n```json\n{\n    \"code\": 0,\n    \"data\": \"4.15.0-48-generic\"\n}\n```\n\n##### *GET* `/api/uptime`\n\n```json\n{\n    \"code\": 0,\n    \"data\": 31694\n}\n```\n\nThe unit of data is **seconds**.\n\n##### *GET* `/api/time`\n\n```json\n{\n    \"code\": 0,\n    \"data\": {\n        \"date\": \"2019-05-03\",\n        \"time\": \"12:43:14\"\n    }\n}\n```\n\nIt's RTC time.\n\n##### *GET* `/api/cpu`\n\n```json\n{\n    \"code\": 0,\n    \"data\": {\n        \"cpus\": [\n            {\n                \"cores\": 4,\n                \"mhz\": [\n                    2571.96,\n                    2688.208,\n                    2604.095,\n                    2700.238,\n                    2700.034,\n                    2699.908,\n                    2700.329,\n                    2699.986\n                ],\n                \"model_name\": \"Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz\",\n                \"threads\": 8\n            }\n        ],\n        \"load_average\": {\n            \"fifteen\": 1.02,\n            \"five\": 0.83,\n            \"one\": 0.61\n        }\n    }\n}\n```\n\n##### *GET* `/api/cpu-detect`\n\n```json\n{\n    \"code\": 0,\n    \"data\": {\n        \"cpus\": [\n            {\n                \"cores\": 4,\n                \"mhz\": [\n                    1808.254,\n                    1787.732,\n                    1430.044,\n                    1845.768,\n                    1751.993,\n                    1751.121,\n                    1769.048,\n                    1663.091\n                ],\n                \"model_name\": \"Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz\",\n                \"threads\": 8\n            }\n        ],\n        \"cpus_stat\": [\n            0.08386009270965024,\n            0.09152542372881356,\n            0.10472972972972971,\n            0.11295681063122924,\n            0.06418918918918919,\n            0.09364548494983276,\n            0.06397306397306397,\n            0.053691275167785234,\n            0.0821917808219178\n        ],\n        \"load_average\": {\n            \"fifteen\": 1.02,\n            \"five\": 0.84,\n            \"one\": 0.74\n        }\n    }\n}\n```\n\nThe 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.\n\n##### *GET* `/api/memory`\n\n```json\n{\n    \"code\": 0,\n    \"data\": {\n        \"memory\": {\n            \"available\": 22659469312,\n            \"buffers\": 10412032,\n            \"cache\": 19094446080,\n            \"free\": 4154060800,\n            \"shared\": 119246848,\n            \"total\": 33633140736,\n            \"used\": 10374221824\n        },\n        \"swap\": {\n            \"cache\": 385024,\n            \"free\": 4082888704,\n            \"total\": 4094685184,\n            \"used\": 11411456\n        }\n    }\n}\n```\n\nThe unit of numbers is **bytes**.\n\n##### *GET* `/api/network-detect`\n\n```json\n{\n    \"code\": 0,\n    \"data\": [\n        {\n            \"download_rate\": 0.0,\n            \"download_total\": 55713769,\n            \"interface\": \"lo\",\n            \"upload_rate\": 0.0,\n            \"upload_total\": 55713769\n        },\n        {\n            \"download_rate\": 702.0,\n            \"download_total\": 7461474545,\n            \"interface\": \"enp0s20f0u4\",\n            \"upload_rate\": 1280.6666666666667,\n            \"upload_total\": 331829069\n        }\n    ]\n}\n```\n\nThe unit of totals is **bytes**. The unit of rates is **bytes/second**.\n\n##### *GET* `/api/volume`\n\n```json\n{\n    \"code\": 0,\n    \"data\": [\n        {\n            \"device\": \"sda2\",\n            \"mount_points\": [\n                \"/\",\n                \"/var/lib/docker/btrfs\"\n            ],\n            \"read_total\": 7612149760,\n            \"size\": 249809600512,\n            \"used\": 70506823680,\n            \"write_total\": 12919939072\n        },\n        {\n            \"device\": \"sdb1\",\n            \"mount_points\": [\n                \"/storage\"\n            ],\n            \"read_total\": 7080878080,\n            \"size\": 239938535424,\n            \"used\": 218200993792,\n            \"write_total\": 21799934464\n        },\n        {\n            \"device\": \"sdc2\",\n            \"mount_points\": [\n                \"/home\"\n            ],\n            \"read_total\": 27511930880,\n            \"size\": 496011051008,\n            \"used\": 370128474112,\n            \"write_total\": 56615944192\n        }\n    ]\n}\n```\n\nThe unit of totals is **bytes**.\n\n##### *GET* `/api/volume-detect`\n\n```json\n{\n    \"code\": 0,\n    \"data\": [\n        {\n            \"device\": \"sda2\",\n            \"mount_points\": [\n                \"/\",\n                \"/var/lib/docker/btrfs\"\n            ],\n            \"read_rate\": 0.0,\n            \"read_total\": 7612149760,\n            \"size\": 249809600512,\n            \"used\": 70506823680,\n            \"write_rate\": 0.0,\n            \"write_total\": 12928978944\n        },\n        {\n            \"device\": \"sdb1\",\n            \"mount_points\": [\n                \"/storage\"\n            ],\n            \"read_rate\": 0.0,\n            \"read_total\": 7080878080,\n            \"size\": 239938535424,\n            \"used\": 218200993792,\n            \"write_rate\": 0.0,\n            \"write_total\": 21799934464\n        },\n        {\n            \"device\": \"sdc2\",\n            \"mount_points\": [\n                \"/home\"\n            ],\n            \"read_rate\": 0.0,\n            \"read_total\": 27511934976,\n            \"size\": 496011051008,\n            \"used\": 370131861504,\n            \"write_rate\": 4965717.333333333,\n            \"write_total\": 56771334144\n        }\n    ]\n}\n```\n\nThe unit of totals is **bytes**. The unit of rates is **bytes/second**.\n\n##### *GET* `/api/all`\n\n```json\n{\n    \"code\": 0,\n    \"data\": {\n        \"cpus\": [\n            {\n                \"cores\": 4,\n                \"mhz\": [\n                    1200.121,\n                    1200.272,\n                    1200.12,\n                    1200.055,\n                    1200.098,\n                    1200.034,\n                    1200.014,\n                    1200.124\n                ],\n                \"model_name\": \"Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz\",\n                \"threads\": 8\n            }\n        ],\n        \"cpus_stat\": [\n            0.04951741502308015,\n            0.043333333333333335,\n            0.030405405405405407,\n            0.05743243243243243,\n            0.056666666666666664,\n            0.04983388704318937,\n            0.05387205387205387,\n            0.05405405405405406,\n            0.05067567567567568\n        ],\n        \"hostname\": \"magiclen-linux\",\n        \"kernel\": \"4.15.0-48-generic\",\n        \"load_average\": {\n            \"fifteen\": 0.8,\n            \"five\": 0.53,\n            \"one\": 0.28\n        },\n        \"memory\": {\n            \"available\": 22578839552,\n            \"buffers\": 10412032,\n            \"cache\": 19104878592,\n            \"free\": 4062957568,\n            \"shared\": 119230464,\n            \"total\": 33633140736,\n            \"used\": 10454892544\n        },\n        \"network\": [\n            {\n                \"download_rate\": 0.0,\n                \"download_total\": 55798721,\n                \"interface\": \"lo\",\n                \"upload_rate\": 0.0,\n                \"upload_total\": 55798721\n            },\n            {\n                \"download_rate\": 9.333333333333334,\n                \"download_total\": 7463048290,\n                \"interface\": \"enp0s20f0u4\",\n                \"upload_rate\": 28.666666666666668,\n                \"upload_total\": 333465932\n            }\n        ],\n        \"rtc_time\": {\n            \"date\": \"2019-05-03\",\n            \"time\": \"12:54:34\"\n        },\n        \"swap\": {\n            \"cache\": 385024,\n            \"free\": 4082888704,\n            \"total\": 4094685184,\n            \"used\": 11411456\n        },\n        \"uptime\": 32437,\n        \"volumes\": [\n            {\n                \"device\": \"sda2\",\n                \"mount_points\": [\n                    \"/\",\n                    \"/var/lib/docker/btrfs\"\n                ],\n                \"read_rate\": 0.0,\n                \"read_total\": 7612149760,\n                \"size\": 249809600512,\n                \"used\": 70506831872,\n                \"write_rate\": 0.0,\n                \"write_total\": 12939075584\n            },\n            {\n                \"device\": \"sdb1\",\n                \"mount_points\": [\n                    \"/storage\"\n                ],\n                \"read_rate\": 0.0,\n                \"read_total\": 7080878080,\n                \"size\": 239938535424,\n                \"used\": 218200993792,\n                \"write_rate\": 0.0,\n                \"write_total\": 21799934464\n            },\n            {\n                \"device\": \"sdc2\",\n                \"mount_points\": [\n                    \"/home\"\n                ],\n                \"read_rate\": 0.0,\n                \"read_total\": 27521441792,\n                \"size\": 496011051008,\n                \"used\": 370118373376,\n                \"write_rate\": 744106.6666666666,\n                \"write_total\": 56883159040\n            }\n        ]\n    }\n}\n```\n\n##### Authorization\n\nIf you need to 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.\n \nWhen starting the HTTP server from CLI, you can add a `-a \u003cAUTH_KEY\u003e` option. Then, every API needs to be invoked by a request which contains a `Authorization` header to send the `AUTH_KEY`.\n\nAlso, you may want to disable the web page. Just add a `--only-api` flag.\n\n## TODO\n\n1. Process snapshot (HTTP, documentation)\n1. Database Detection\n1. Benchmark (networks)\n\n## License\n\n[MIT](LICENSE)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fm-prober","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagiclen%2Fm-prober","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagiclen%2Fm-prober/lists"}