Commit Graph

2127 Commits

Author SHA1 Message Date
nathannaveen 3a2c8dd4f8 chore: Set permissions for GitHub actions
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
2022-05-05 01:31:24 +00:00
arstercz f6dc96c30e follow the psutil principles, do nothing if can not find root device 2022-05-01 02:33:09 +00:00
shirou 24a1ae54b4
Merge pull request #1292 from shirou/feature/add_release_action
add a GitHub action to auto release
2022-05-01 10:57:14 +09:00
shirou ea6bed829b add a GitHub action to auto release 2022-04-29 16:34:53 +00:00
arstercz d52b97cd25 fix disk readlink error which system boot by nfs mount 2022-04-27 04:46:02 +00:00
dependabot[bot] 3876a3cd53
Bump github.com/google/go-cmp from 0.5.7 to 0.5.8
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.7 to 0.5.8.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.5.7...v0.5.8)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-27 01:27:17 +00:00
shirou c9a292ae52
Merge pull request #1286 from geowiwi/master
host: add support for OpenBSD/armv7
2022-04-16 11:45:55 +09:00
Martin Reindl 1d89235f34 host: add support for OpenBSD/armv7 2022-04-15 21:11:36 +02:00
shirou f43b0f7601
Merge pull request #1285 from shirou/dependabot/github_actions/actions/setup-go-3
Bump actions/setup-go from 2 to 3
2022-04-15 00:52:19 +09:00
dependabot[bot] b5592414b5
Bump actions/setup-go from 2 to 3
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 01:27:53 +00:00
shirou cf6309316c
Merge pull request #1272 from jdstrand/jdstrand/add-env-force-workaround
[disk][linux] add HOST_PROC_MOUNTINFO
2022-04-01 17:03:19 +09:00
Jamie Strandboge 9e6e627ec8 [disk][linux] add HOST_PROC_MOUNTINFO, closes #1271
The changes to gopsutil for reading /proc/1/mountinfo affected
applications running under restricted environments that disallows access
to /proc/1/mountinfo. #1159 was filed for android but other restricted
environments are also affected (eg, snaps)). The fix for #1159 addressed
the application behavior to work under confinement for non-android as
well. However, depending on the system, the attempt to read
/proc/1/mountinfo could cause a sandbox denial in the logs which can be
quite noisy if using gopsutil as part of a monitoring solution that
polls often.

This introduces HOST_PROC_MOUNTINFO to force reading from the parent dir
of the specified path instead of first trying /proc/1. When unset,
retain the current behavior with fallback. This allows people, for
example, to set HOST_PROC_MOUNTINFO=/proc/self/mountinfo when gopsutil
is running under these restricted environments.

This change updates the private readMountFile() to use a root path
instead of a root subpath, and adjusts PartitionsWithContext() to set
the root path to /proc/1 initially and falling back to /proc/self. When
HOST_PROC_MOUNTINFO is not empty, set the root path to the parent
directory of HOST_PROC_MOUNTINFO.
2022-03-29 08:20:28 -05:00
shirou 78577a7bcd
Merge pull request #1280 from geowiwi/master
Fix telegraf 1.22.0 build on OpenBSD/arm64
2022-03-28 20:23:13 +09:00
martin 414ada919c Fix telegraf 1.22.0 build on OpenBSD/arm64:
../../../go/pkg/mod/github.com/shirou/gopsutil/v3@v3.22.2/cpu/cpu_openbsd.go:63:14: undefined: cpuTimes
2022-03-24 17:55:48 +01:00
shirou a270a18f77
Merge pull request #1279 from shirou/dependabot/github_actions/actions/cache-3
Bump actions/cache from 2 to 3
2022-03-23 21:42:02 +09:00
dependabot[bot] b68e0acc74
Bump actions/cache from 2 to 3
Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-22 01:17:37 +00:00
shirou 3f83e0997a
Merge pull request #1274 from shirou/dependabot/go_modules/github.com/stretchr/testify-1.7.1
Bump github.com/stretchr/testify from 1.7.0 to 1.7.1
2022-03-21 10:22:14 +09:00
shirou 05994600f1
Merge pull request #1278 from shirou/feature/remove_windows_2016_from_tests
remove Windows 2016 from tests.
2022-03-21 10:21:56 +09:00
shirou 8717edb669 remove Windows 2016 from tests.
see https://github.com/actions/virtual-environments/issues/5238
2022-03-21 01:14:36 +00:00
shirou 9b14e64cb8
Merge pull request #1276 from scop/feat/more-linux-fss
[disk][linux] recognize more file systems
2022-03-21 10:13:04 +09:00
shirou 8530231e52
Merge pull request #1277 from scop/chore/gofumpt
[net] gofumpt with 0.3.0 / golangci-lint 1.45.0
2022-03-21 10:12:38 +09:00
Ville Skyttä 7befb75528 [net] gofumpt with 0.3.0 / golangci-lint 1.45.0 2022-03-19 22:43:20 +02:00
Ville Skyttä 5095c3f51e [disk][linux] recognize more file systems 2022-03-19 22:34:13 +02:00
quanweiZhou ddaf2d7623 [mem][linux] added additional meminfo fields
support HugePages_Rsvd, HugePages_Surp

Signed-off-by: quanweiZhou <quanweiZhou@linux.alibaba.com>
2022-03-19 15:19:10 +08:00
dependabot[bot] a1f5f64e63
Bump github.com/stretchr/testify from 1.7.0 to 1.7.1
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-16 01:25:07 +00:00
shirou 4b988f3ccd
Merge pull request #1270 from shirou/feature/disk_add_fallback_to_self_mountinfo
[disk][linux] add fallback to /proc/self
2022-03-08 20:21:37 +09:00
shirou 49037dd0d8 [disk][linux] add fallback to /proc/self 2022-03-05 03:15:26 +00:00
shirou 7de7d48ef6
Merge pull request #1267 from easyops-cn/master
fix(process): fix OpenFilesWithContext panic problem
2022-03-05 11:22:21 +09:00
shirou f3b7c002d7
Merge pull request #1268 from scop/refactor/remove-unnecessary-lookpaths
refactor: remove unnecessary exec.LookPath calls
2022-03-05 11:20:24 +09:00
Ville Skyttä f7e1f36418 refactor: remove unnecessary exec.LookPath calls
Executing the command does the lookup if needed and returns the same
error when not found, no need to do it separately.
2022-03-04 18:56:33 +02:00
paul 3cd259698f fix(process): fix OpenFilesWithContext panic problem 2022-03-04 16:14:22 +08:00
shirou 03f9f55571
Merge pull request #1262 from shirou/dependabot/go_modules/github.com/tklauser/go-sysconf-0.3.10
Bump github.com/tklauser/go-sysconf from 0.3.9 to 0.3.10
2022-03-02 18:00:38 +09:00
Lomanic c0f6ce3804
Merge pull request #1264 from shirou/dependabot/github_actions/actions/labeler-4
Bump actions/labeler from 3.0.2 to 4
2022-03-02 08:50:37 +01:00
Lomanic 12228e722d
Merge pull request #1263 from shirou/dependabot/github_actions/actions/checkout-3
Bump actions/checkout from 2 to 3
2022-03-02 08:40:13 +01:00
dependabot[bot] ff016751b6
Bump actions/labeler from 3.0.2 to 4
Bumps [actions/labeler](https://github.com/actions/labeler) from 3.0.2 to 4.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](https://github.com/actions/labeler/compare/v3.0.2...v4)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 01:20:39 +00:00
dependabot[bot] aa9aca7d12
Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 01:20:36 +00:00
dependabot[bot] 54552004cc
Bump github.com/tklauser/go-sysconf from 0.3.9 to 0.3.10
Bumps [github.com/tklauser/go-sysconf](https://github.com/tklauser/go-sysconf) from 0.3.9 to 0.3.10.
- [Release notes](https://github.com/tklauser/go-sysconf/releases)
- [Commits](https://github.com/tklauser/go-sysconf/compare/v0.3.9...v0.3.10)

---
updated-dependencies:
- dependency-name: github.com/tklauser/go-sysconf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-01 01:46:21 +00:00
shirou d33b2dfda5
Merge pull request #1244 from omar-polo/master
fix cpu_openbsd.go once and for all
2022-02-25 23:25:27 +09:00
shirou 2fa880a4ad
Merge pull request #1256 from scop/feat/solaris-disk-serialnumber
[disk][solaris] implement SerialNumberWithContext
2022-02-25 22:26:39 +09:00
shirou 38e1debe71
Update disk/disk_solaris.go 2022-02-25 21:57:01 +09:00
shirou 9f4dfe70a1
Merge pull request #1258 from shirou/dependabot/github_actions/golangci/golangci-lint-action-3
Bump golangci/golangci-lint-action from 2 to 3
2022-02-25 12:03:31 +09:00
dependabot[bot] a22a057761
Bump golangci/golangci-lint-action from 2 to 3
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 2 to 3.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-25 01:18:01 +00:00
Omar Polo 73f9c8dfd5 avoid cgo for cpu_openbsd
Even thought OpenBSD often breaks the ABI compatibility and doesn't make
*any* promise of "stability", this project aims to be "pure go" so avoid
doing inter-op at the cost of artificially reducing the number of
supported architectures down to amd64 and i386.

To add support for another architecture (e.g. arm), add another file
cpu_openbsd_${arch}.go like done for 386 and amd64.  The fields are
declared as `long' in C, so pick the appropriate size when declaring the
struct.
2022-02-24 15:05:18 +01:00
shirou b47e88a0c4
Merge pull request #1254 from scop/fix/freebsd-iocounters-disk-serial
[disk][freebsd] include serial number in IOCounters
2022-02-24 20:56:35 +09:00
shirou 9a667f1188
Merge pull request #1210 from mmorel-35/master
enable contextcheck linter
2022-02-24 20:44:35 +09:00
Ville Skyttä 227df04773 [disk][solaris] implement SerialNumberWithContext 2022-02-23 00:06:36 +02:00
Ville Skyttä ae0364e211 [disk][freebsd] include serial number in IOCounters 2022-02-22 23:48:14 +02:00
shirou f6cc3564ce
Merge pull request #1251 from rishabh-arya95/master
Add support for reading smaps_rollup
2022-02-20 14:33:47 +09:00
Rishabh Arya 0bf4299250 Add support for reading smaps_rollup 2022-02-17 20:12:19 +00:00
shirou cf565e04b8
Merge pull request #1242 from scop/feat/solaris-sensors
[host][solaris] implement SensorsTemperaturesWithContext
2022-02-12 17:37:00 +09:00