mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add available resource stats
fix https://github.com/chrislusf/seaweedfs/issues/1555
This commit is contained in:
parent
5179e559f7
commit
575d7952a1
|
@ -101,6 +101,14 @@ var (
|
|||
Help: "Actual disk size used by volumes.",
|
||||
}, []string{"collection", "type"})
|
||||
|
||||
VolumeServerResourceGauge = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: "SeaweedFS",
|
||||
Subsystem: "volumeServer",
|
||||
Name: "resource",
|
||||
Help: "Resource usage",
|
||||
}, []string{"name", "type"})
|
||||
|
||||
S3RequestCounter = prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: "SeaweedFS",
|
||||
|
@ -132,6 +140,7 @@ func init() {
|
|||
Gather.MustRegister(VolumeServerMaxVolumeCounter)
|
||||
Gather.MustRegister(VolumeServerReadOnlyVolumeGauge)
|
||||
Gather.MustRegister(VolumeServerDiskSizeGauge)
|
||||
Gather.MustRegister(VolumeServerResourceGauge)
|
||||
|
||||
Gather.MustRegister(S3RequestCounter)
|
||||
Gather.MustRegister(S3RequestHistogram)
|
||||
|
|
|
@ -305,6 +305,9 @@ func (l *DiskLocation) CheckDiskSpace() {
|
|||
for {
|
||||
if dir, e := filepath.Abs(l.Directory); e == nil {
|
||||
s := stats.NewDiskStatus(dir)
|
||||
stats.VolumeServerResourceGauge.WithLabelValues(l.Directory, "all").Set(float64(s.All))
|
||||
stats.VolumeServerResourceGauge.WithLabelValues(l.Directory, "used").Set(float64(s.Used))
|
||||
stats.VolumeServerResourceGauge.WithLabelValues(l.Directory, "free").Set(float64(s.Free))
|
||||
if (s.PercentFree < l.MinFreeSpacePercent) != l.isDiskSpaceLow {
|
||||
l.isDiskSpaceLow = !l.isDiskSpaceLow
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue