{"id":13413169,"url":"https://github.com/zcalusic/sysinfo","last_synced_at":"2025-12-29T23:34:08.727Z","repository":{"id":42233768,"uuid":"66230957","full_name":"zcalusic/sysinfo","owner":"zcalusic","description":"Sysinfo is a Go library providing Linux OS / kernel / hardware system information.","archived":false,"fork":false,"pushed_at":"2024-09-18T07:10:00.000Z","size":55,"stargazers_count":517,"open_issues_count":13,"forks_count":92,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-09-18T11:45:00.668Z","etag":null,"topics":["golang","sysinfo"],"latest_commit_sha":null,"homepage":"","language":"Go","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/zcalusic.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":"2016-08-22T01:46:45.000Z","updated_at":"2024-09-18T07:10:01.000Z","dependencies_parsed_at":"2024-05-30T16:19:34.777Z","dependency_job_id":"b5f433f9-1c30-4814-a199-431fe298082f","html_url":"https://github.com/zcalusic/sysinfo","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcalusic%2Fsysinfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcalusic%2Fsysinfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcalusic%2Fsysinfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcalusic%2Fsysinfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zcalusic","download_url":"https://codeload.github.com/zcalusic/sysinfo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243635261,"owners_count":20322906,"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":["golang","sysinfo"],"created_at":"2024-07-30T20:01:34.414Z","updated_at":"2025-12-29T23:34:08.698Z","avatar_url":"https://github.com/zcalusic.png","language":"Go","funding_links":[],"categories":["Go","Hardware","Relational Databases","硬件"],"sub_categories":["Search and Analytic Databases","Tutorials","检索及分析资料库","Advanced Console UIs"],"readme":"# Sysinfo\n\n[![Build Status](https://github.com/zcalusic/sysinfo/actions/workflows/go.yml/badge.svg)](https://github.com/zcalusic/sysinfo/actions/workflows/go.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/zcalusic/sysinfo)](https://goreportcard.com/report/github.com/zcalusic/sysinfo)\n[![GoDoc](https://godoc.org/github.com/zcalusic/sysinfo?status.svg)](https://godoc.org/github.com/zcalusic/sysinfo)\n[![License](https://img.shields.io/badge/license-MIT-a31f34.svg?maxAge=2592000)](https://github.com/zcalusic/sysinfo/blob/master/LICENSE)\n[![Powered by](https://img.shields.io/badge/powered_by-Go-5272b4.svg?maxAge=2592000)](https://go.dev/)\n[![Platform](https://img.shields.io/badge/platform-Linux-009bde.svg?maxAge=2592000)](https://www.linuxfoundation.org/)\n\nPackage sysinfo is a Go library providing Linux OS / kernel / hardware system information. It's completely standalone,\nhas no dependencies on the host system and doesn't execute external programs. It collects only \"inventory type\"\ninformation, things that don't change often.\n\n## Code Example\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"os/user\"\n\n\t\"github.com/zcalusic/sysinfo\"\n)\n\nfunc main() {\n\tcurrent, err := user.Current()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tif current.Uid != \"0\" {\n\t\tlog.Fatal(\"requires superuser privilege\")\n\t}\n\n\tvar si sysinfo.SysInfo\n\n\tsi.GetSysInfo()\n\n\tdata, err := json.MarshalIndent(\u0026si, \"\", \"  \")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(string(data))\n}\n```\n\n## Motivation\n\nI couldn't find any self-contained library that would provide set of data/features I needed. So another sysinfo was\nborn.\n\nThe purpose of the library is to collect only inventory info. No metrics like CPU usage or load average will be added.\nThe rule of thumb is, if it's changing during the day, every day, it doesn't belong in the library.\n\nThe library should work well on any modern/supported Linux distribution. There are no plans to add support for older\nunsupported Linux distributions/kernels, to keep the code clean and robust and reduce the maintenance burden.\n\n## Requirements\n\nSysinfo requires:\n\n- Linux kernel 4.2 or later\n- access to /sys \u0026 /proc Linux virtual file systems\n- access to various files in /etc, /var, /run FS hierarchy\n- superuser privileges (to access SMBIOS/DMI table and detect RAM size and properties)\n\nSysinfo doesn't require ANY other external utility on the target system, which is its primary strength, IMHO.\n\nIt depends on Linux internals heavily, so there are no plans to support other operating systems.\n\n## Installation\n\nJust use go get.\n\n```\ngo get github.com/zcalusic/sysinfo\n```\n\nThere's also a very simple utility demonstrating sysinfo library capabilities. Start it (as superuser) to get pretty\nformatted JSON output of all the info that sysinfo library provides. Due to its simplicity, the source code of the\nutility also doubles down as an example of how to use the library.\n\n```\ngo get github.com/zcalusic/sysinfo/cmd/sysinfo\n```\n\n--\n\nBuild demo utility in Docker container:  https://github.com/mattscilipoti/compile_sysinfo\n\n## Sample output\n\n```json\n{\n  \"sysinfo\": {\n    \"version\": \"0.9.1\",\n    \"timestamp\": \"2016-09-24T13:30:28.369498856+02:00\"\n  },\n  \"node\": {\n    \"hostname\": \"web12\",\n    \"machineid\": \"04aa55927ebd390829367c1757b98cac\",\n    \"timezone\": \"Europe/Zagreb\"\n  },\n  \"os\": {\n    \"name\": \"CentOS Linux 7 (Core)\",\n    \"vendor\": \"centos\",\n    \"version\": \"7\",\n    \"release\": \"7.2.1511\",\n    \"architecture\": \"amd64\"\n  },\n  \"kernel\": {\n    \"release\": \"3.10.0-327.13.1.el7.x86_64\",\n    \"version\": \"#1 SMP Thu Mar 31 16:04:38 UTC 2016\",\n    \"architecture\": \"x86_64\"\n  },\n  \"product\": {\n    \"name\": \"RH2288H V3\",\n    \"vendor\": \"Huawei\",\n    \"version\": \"V100R003\",\n    \"serial\": \"2103711GEL10F3430658\"\n  },\n  \"board\": {\n    \"name\": \"BC11HGSA0\",\n    \"vendor\": \"Huawei\",\n    \"version\": \"V100R003\",\n    \"serial\": \"033HXVCNG3107624\"\n  },\n  \"chassis\": {\n    \"type\": 17,\n    \"vendor\": \"Huawei\"\n  },\n  \"bios\": {\n    \"vendor\": \"Insyde Corp.\",\n    \"version\": \"3.16\",\n    \"date\": \"03/16/2016\"\n  },\n  \"cpu\": {\n    \"vendor\": \"GenuineIntel\",\n    \"model\": \"Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz\",\n    \"speed\": 2400,\n    \"cache\": 20480,\n    \"cpus\": 1,\n    \"cores\": 8,\n    \"threads\": 16\n  },\n  \"memory\": {\n    \"type\": \"DRAM\",\n    \"speed\": 2133,\n    \"size\": 65536\n  },\n  \"storage\": [\n    {\n      \"name\": \"sda\",\n      \"driver\": \"sd\",\n      \"vendor\": \"ATA\",\n      \"model\": \"ST9500620NS\",\n      \"serial\": \"9XF2HZ9K\",\n      \"size\": 500\n    }\n  ],\n  \"network\": [\n    {\n      \"name\": \"enp3s0f1\",\n      \"driver\": \"ixgbe\",\n      \"macaddress\": \"84:ad:5a:e3:79:71\",\n      \"port\": \"fibre\",\n      \"speed\": 10000\n    }\n  ]\n}\n```\n\n## Contributors\n\nContributors are welcome, just open a new issue / pull request.\n\n## License\n\n```\nThe MIT License (MIT)\n\nCopyright © 2016 Zlatko Čalušić\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzcalusic%2Fsysinfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzcalusic%2Fsysinfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzcalusic%2Fsysinfo/lists"}