mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-13 17:14:23 -08:00
Add AIX filesystem collector
This commit is contained in:
parent
537917bcfa
commit
48338494de
66
collector/filesystem_aix.go
Normal file
66
collector/filesystem_aix.go
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
// Copyright 2024 The Prometheus Authors
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
//go:build !nofilesystem
|
||||||
|
// +build !nofilesystem
|
||||||
|
|
||||||
|
package collector
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-kit/log/level"
|
||||||
|
"github.com/power-devops/perfstat"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defMountPointsExcluded = "^/(dev|aha)($|/)"
|
||||||
|
defFSTypesExcluded = "^procfs$"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Expose filesystem fullness.
|
||||||
|
func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) {
|
||||||
|
fsStat, err := perfstat.FileSystemStat()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, stat := range fsStat {
|
||||||
|
if c.excludedMountPointsPattern.MatchString(stat.MountPoint) {
|
||||||
|
level.Debug(c.logger).Log("msg", "Ignoring mount point", "mountpoint", stat.MountPoint)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fstype := stat.TypeString()
|
||||||
|
if c.excludedFSTypesPattern.MatchString(fstype) {
|
||||||
|
level.Debug(c.logger).Log("msg", "Ignoring fs type", "type", fstype)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ro := 0.0
|
||||||
|
if stat.Flags&perfstat.VFS_READONLY != 0 {
|
||||||
|
ro = 1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
stats = append(stats, filesystemStats{
|
||||||
|
labels: filesystemLabels{
|
||||||
|
device: stat.Device,
|
||||||
|
mountPoint: stat.MountPoint,
|
||||||
|
fsType: fstype,
|
||||||
|
},
|
||||||
|
size: float64(stat.TotalBlocks / 512.0),
|
||||||
|
free: float64(stat.FreeBlocks / 512.0),
|
||||||
|
avail: float64(stat.FreeBlocks / 512.0), // AIX doesn't distinguish between free and available blocks.
|
||||||
|
files: float64(stat.TotalInodes),
|
||||||
|
filesFree: float64(stat.FreeInodes),
|
||||||
|
ro: ro,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return stats, nil
|
||||||
|
}
|
|
@ -11,9 +11,9 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
//go:build !nofilesystem && (linux || freebsd || openbsd || darwin || dragonfly)
|
//go:build !nofilesystem && (linux || freebsd || openbsd || darwin || dragonfly || aix)
|
||||||
// +build !nofilesystem
|
// +build !nofilesystem
|
||||||
// +build linux freebsd openbsd darwin dragonfly
|
// +build linux freebsd openbsd darwin dragonfly aix
|
||||||
|
|
||||||
package collector
|
package collector
|
||||||
|
|
||||||
|
|
3
go.sum
3
go.sum
|
@ -69,6 +69,8 @@ github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaL
|
||||||
github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
|
github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
||||||
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||||
github.com/prometheus-community/go-runit v0.1.0 h1:uTWEj/Fn2RoLdfg/etSqwzgYNOYPrARx1BHUN052tGA=
|
github.com/prometheus-community/go-runit v0.1.0 h1:uTWEj/Fn2RoLdfg/etSqwzgYNOYPrARx1BHUN052tGA=
|
||||||
github.com/prometheus-community/go-runit v0.1.0/go.mod h1:AvJ9Jo3gAFu2lbM4+qfjdpq30FfiLDJZKbQ015u08IQ=
|
github.com/prometheus-community/go-runit v0.1.0/go.mod h1:AvJ9Jo3gAFu2lbM4+qfjdpq30FfiLDJZKbQ015u08IQ=
|
||||||
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
|
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
|
||||||
|
@ -108,6 +110,7 @@ golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
|
||||||
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
|
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20211031064116-611d5d643895/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20211031064116-611d5d643895/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||||
|
|
Loading…
Reference in a new issue