Commit Graph

2100 Commits

Author SHA1 Message Date
shirou ff544cb3e7
Merge pull request #1310 from cipherboy/fix-int8-to-byte
Fix []int8 to []byte in disk/disk_openbsd.go due to x/sys/unix type change
2022-06-07 22:09:19 +09:00
shirou acd1fc00f5
Merge pull request #1313 from shirou/feature/fix_virtual_memory_stat_string
[mem]: fix test
2022-06-07 22:02:16 +09:00
shirou 23f85def9b [mem]: fix test 2022-06-07 12:48:50 +00:00
shirou 5722370c72
Merge pull request #1275 from quanweiZhou/add-meminfo-fields
[mem][linux] added additional meminfo fields
2022-06-07 21:00:08 +09:00
shirou ce948d52cd
Merge pull request #1306 from shirou/feature/change_goversion_dynamic
feat(actions): go-version will be latest two version automatically on CI
2022-06-07 20:50:36 +09:00
shirou e978987d21
Merge pull request #1302 from chbuescher/master
get IOCounters for aix with perfstat
2022-06-07 20:50:22 +09:00
chbuescher 7dd96685cb
Merge branch 'shirou:master' into master 2022-06-07 08:51:58 +02:00
Alexander Scheel 4ad218b552 Update go.mod to clarify newer sys/unix dependency
Updated via:

$ go get -u golang.org/x/sys && go mod tidy

We now require upstream commit bc2c85a on OpenBSD due to type changes.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2022-06-06 14:10:54 -04:00
Alexander Scheel aee8cecfcd Mirror updated x/sys/unix OpenBSD Statfs_t fields
Per change in x/sys/unix, these Statfs_t fields are now converted to
[]byte rather than []int8. Callers with updated x/sys/unix versions will
now see something like:

> Error: ../../../go/pkg/mod/github.com/shirou/gopsutil@v3.21.5+incompatible/disk/disk_openbsd.go:59:53: cannot use stat.F_mntfromname[:] (type []byte) as type []int8 in argument to common.IntToString
> Error: ../../../go/pkg/mod/github.com/shirou/gopsutil@v3.21.5+incompatible/disk/disk_openbsd.go:60:51: cannot use stat.F_mntonname[:] (type []byte) as type []int8 in argument to common.IntToString
> Error: ../../../go/pkg/mod/github.com/shirou/gopsutil@v3.21.5+incompatible/disk/disk_openbsd.go:61:52: cannot use stat.F_fstypename[:] (type []byte) as type []int8 in argument to common.IntToString
> Error: ../../../go/pkg/mod/github.com/shirou/gopsutil@v3.21.5+incompatible/disk/disk_openbsd.go:149:45: cannot use stat.F_fstypename[:] (type []byte) as type []int8 in argument to common.IntToString

It is probably prudent to update to the newer struct definitions as a
result.

See also: https://groups.google.com/g/golang-codereviews/c/bPBR9-4hV6E
See also: https://go-review.googlesource.com/c/sys/+/407195/2
See also: bc2c85ada1

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
2022-06-06 14:05:41 -04:00
xca1075 d4f012c565 fix aix nocgo compile 2022-06-03 17:43:52 +02:00
xca1075 d177019851 fix go build flags for aix/cpu 2022-06-03 17:09:11 +02:00
xca1075 e24e72062b aix: split code, that uses perfstat, to _cgo and _nocgo files 2022-06-03 17:01:36 +02:00
shirou a91ea95c78 feat(actions): go-version will be latest two version automatically on CI 2022-05-29 12:05:57 +00:00
shirou c4a0f4689f
Merge pull request #1305 from shirou/feature/fix_lint_net_linux_test
[net][linux]: fix lint
2022-05-21 18:39:23 +09:00
shirou 0074fab5f5 [net][linux]: fix lint 2022-05-21 09:31:25 +00:00
shirou a7539106da
Merge pull request #1301 from Lomanic/issue1298
[process][windows] Use WaitForSingleObject with a 0 delay in PidExistsWithContext
2022-05-21 18:27:41 +09:00
shirou 09fa2a95e6
Merge pull request #1290 from shirou/dependabot/go_modules/github.com/google/go-cmp-0.5.8
Bump github.com/google/go-cmp from 0.5.7 to 0.5.8
2022-05-21 18:22:16 +09:00
xca1075 ce49e45ed3 get IOCounters for aix with perfstat 2022-05-18 11:14:17 +02:00
Lomanic 7501387fc1 [process][windows] Use WaitForSingleObject with a 0 delay in PidExistsWithContext
Reference https://stackoverflow.com/a/6493793

Fixes #1298
2022-05-16 23:33:53 +02:00
shirou 19771aaf91
Merge pull request #1296 from Lomanic/issue1094
[disk][windows] Set EnableCounterForIoctl reg key to 1 in init() to automatically enable diskperf on Server editions
2022-05-08 14:03:39 +09:00
Lomanic 2318b5e69f [disk][windows] Set EnableCounterForIoctl reg key to 1 in init() to automatically enable diskperf on Server editions
Fixes #1094
2022-05-05 22:33:24 +02:00
shirou def6865402
Merge pull request #1293 from turrisxyz/setup-permissions
chore: Set permissions for GitHub actions
2022-05-05 17:35:40 +09:00
shirou 009ec50f74
Merge pull request #1291 from arstercz/master
[disk][linux] fix readlink error which system boot by nfs mount
2022-05-05 17:24:46 +09:00
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