Although there is a plugin that possibly can fulfill our demand - lmsensorsbeat - but I would not stop there.
So if you want to over-engineer this approach, then keep reading.
Making your own beat
We will be developing this thing in Go
apt install golang golang-glide
Then start following the official tutorial from Elastic. I know, it's really written like they don't want you to develop your own plugins, they want you to pray for existence of in the marketplace.
cd metricbeat
make create-metricset MODULE=lmsensors METRICSET=lmsensors
# mage createMetricset
# Module name: lmsensorsbeat
# Metricset name: sensors
Edit module/lmsensors/lmsensors.go
package lmsensors
import (
"sync"
"github.com/elastic/beats/v7/metricbeat/internal/sysinit"
"github.com/elastic/beats/v7/metricbeat/mb"
)
func init() {
// Register the ModuleFactory function for this module.
if err := mb.Registry.AddModule(ModuleName, NewModule); err != nil {
panic(err)
}
}
func NewModule(base mb.BaseModule) (mb.Module, error) {
var config Config
if err := base.UnpackConfig(&config); err != nil {
return nil, err
}
return &base, nil
}
// ModuleName is the name of this module.
const ModuleName = "lmsensors"
mkdir -p ../x-pack/lmsensors/module
make update BEAT_NAME=lmsensors NO_COLLECT=true
Add external dependencies (gosensors) to the beats project
go get github.com/eskibars/gosensors
Run it as
./metricbeat
-c metricbeat.yml
--path.home .
--path.config .
--path.data .
--path.logs .