{"id":23099583,"url":"https://github.com/hiwepy/sigar-native","last_synced_at":"2025-04-03T20:26:20.651Z","repository":{"id":57720030,"uuid":"94894824","full_name":"hiwepy/sigar-native","owner":"hiwepy","description":"基于sigar实现的类库和Sigar对象工厂","archived":false,"fork":false,"pushed_at":"2019-12-30T14:37:07.000Z","size":3753,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T15:54:44.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hiwepy.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}},"created_at":"2017-06-20T13:34:22.000Z","updated_at":"2019-12-30T14:37:09.000Z","dependencies_parsed_at":"2022-09-26T21:41:12.923Z","dependency_job_id":null,"html_url":"https://github.com/hiwepy/sigar-native","commit_stats":null,"previous_names":["vindell/sigar-native"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiwepy%2Fsigar-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiwepy%2Fsigar-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiwepy%2Fsigar-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiwepy%2Fsigar-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiwepy","download_url":"https://codeload.github.com/hiwepy/sigar-native/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247072798,"owners_count":20878947,"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":[],"created_at":"2024-12-16T23:19:44.252Z","updated_at":"2025-04-03T20:26:20.620Z","avatar_url":"https://github.com/hiwepy.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\nSigar（全称System Information Gatherer And Reporter，即系统信息收集报表器），它提供了一个开源的跨平台的收集计算机硬件和操作系统信息的API（该API底层接口用C语言编写）.\r\n\r\n### Kamon Sigar Loader\r\n\r\nProvides convenient self-contained [Sigar](https://github.com/hyperic/sigar) \r\nclasses with native library deployment and provisioning mechanism with JDK-only dependencies\r\nfor the following common use cases:\r\n* Java Agent: automatic extract/load at JVM start time\r\n* Programmatically: embedded library extraction\r\n* Framework Contract: OSGI bundle activation\r\n\r\n#### To load as JVM java agent:\r\n```\r\n#\r\n# Extract to default location: ${user.dir}/native\r\njava -javaagent:/path/to/sigar-loader.jar ...\r\n\r\n#\r\n# Extract to provided library extract location.\r\njava -javaagent:/path/to/sigar-loader.jar=kamon.sigar.folder=/path/to/library/extract/folder ...\r\n```\r\nSigar loader agent can also be provided via\r\n[JVM attach API](https://docs.oracle.com/javase/7/docs/jdk/api/attach/spec/com/sun/tools/attach/VirtualMachine.html)\r\n\r\n#### To load programmatically from your code:\r\n```\r\n// Required imports.\r\n\t\timport java.io.File;\r\n\t\timport org.hyperic.sigar.Sigar;\r\n\t\timport kamon.sigar.SigarProvisioner;\r\n\r\n// Extract to default location: ${user.dir}/native \r\n\t\tSigarProvisioner.provision();\r\n\t\tfinal Sigar sigar = new Sigar();\r\n\r\n// Extract to user provided library extract location.\r\n\t\tfinal File location = new File(\"target/native\");\r\n\t\tSigarProvisioner.provision(location);\r\n\t\tfinal Sigar sigar = new Sigar();\r\n```\r\n\r\n#### To load during OSGI bundle activation:\r\n```\r\nkaraf@root()\u003e bundle:install mvn:io.kamon/sigar-loader/1.6.5-rev001\r\n```\r\n\r\n#### Default extract location\r\n\r\nDefault library extract location used by\r\n* ```java -javaagent:/path/to/sigar-loader.jar``` and\r\n* ```SigarProvisioner.provision()```\r\n\r\nwill be selected in the following priority order:\r\n 1. environment variable ```KAMON_SIGAR_FOLDER```\r\n 2. system property ```kamon.sigar.folder```\r\n 3. hard coded ```${user.dir}/native```\r\n\r\n#### Extract location in OSGI\r\n\r\nBundle activator will use framework persistent bundle storage location.\r\n\r\n#### Repeated provision attempts\r\n\r\nSigar loader ensures that native library is loaded exactly once.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiwepy%2Fsigar-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiwepy%2Fsigar-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiwepy%2Fsigar-native/lists"}