forked from TrueCloudLab/frostfs-node
[#552] Add sdnotify package
To avoid using third-party dependencies. Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
9b2dce5763
commit
eca7ac9f0d
4 changed files with 62 additions and 17 deletions
|
@ -10,8 +10,8 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/control"
|
||||
controlSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/control/server"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/sdnotify"
|
||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||
sysdnotify "github.com/iguanesolutions/go-systemd/v5/notify"
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
@ -109,14 +109,13 @@ func (c *cfg) HealthStatus() control.HealthStatus {
|
|||
return control.HealthStatus(c.healthStatus.Load())
|
||||
}
|
||||
|
||||
func (c *cfg) notifySystemd(st control.HealthStatus) string {
|
||||
func (c *cfg) notifySystemd(st control.HealthStatus) {
|
||||
status := fmt.Sprintf("%v, %v", st.Number(), st)
|
||||
err := sysdnotify.Status(status)
|
||||
err := sdnotify.Status(status)
|
||||
if err == nil {
|
||||
c.log.Info(fmt.Sprintf("reported STATUS=\"%v\" to systemd", status))
|
||||
}
|
||||
if err != nil {
|
||||
c.log.Error(logs.FailedToReportStatusToSystemd, zap.String("error", err.Error()))
|
||||
}
|
||||
return fmt.Sprintf("%v, %v", st, control.HealthStatus_name[int32(st)])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue