1 Star 0 Fork 0

sqos/beats

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
data.go 887 Bytes
Copy Edit Raw Blame History
package cluster_disk
import (
"encoding/json"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/logp"
)
type StatsCluster struct {
TotalUsedBytes int64 `json:"total_used_bytes"`
TotalBytes int64 `json:"total_bytes"`
TotalAvailBytes int64 `json:"total_avail_bytes"`
}
type Output struct {
StatsCluster StatsCluster `json:"stats"`
}
type DfRequest struct {
Status string `json:"status"`
Output Output `json:"output"`
}
func eventMapping(content []byte) common.MapStr {
var d DfRequest
err := json.Unmarshal(content, &d)
if err != nil {
logp.Err("Error: ", err)
}
return common.MapStr{
"used": common.MapStr{
"bytes": d.Output.StatsCluster.TotalUsedBytes,
},
"total": common.MapStr{
"bytes": d.Output.StatsCluster.TotalBytes,
},
"available": common.MapStr{
"bytes": d.Output.StatsCluster.TotalAvailBytes,
},
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sqos/beats.git
git@gitee.com:sqos/beats.git
sqos
beats
beats
v5.6.2

Search