-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathaddon.go
More file actions
59 lines (47 loc) · 1.68 KB
/
addon.go
File metadata and controls
59 lines (47 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package apcupsd
import (
"fmt"
"github.com/rocket-pool/smartnode/shared/types/addons"
cfgtypes "github.com/rocket-pool/smartnode/shared/types/config"
)
const (
ContainerID_Apcupsd cfgtypes.ContainerID = "apcupsd"
ContainerID_ApcupsdExporter cfgtypes.ContainerID = "apcupsd_exporter"
ApcupsdContainerName string = "addon_apcupsd"
ApcupsdNetworkComposeTemplateName string = "addon_apcupsd.network"
ApcupsdContainerComposeTemplateName string = "addon_apcupsd.container"
ApcupsdConfigTemplateName string = "addon_apcupsd_config"
ApcupsdConfigName string = "addon_apcupsd.conf"
)
type Apcupsd struct {
cfg *ApcupsdConfig `yaml:"config,omitempty"`
}
func NewApcupsd() addons.SmartnodeAddon {
return &Apcupsd{
cfg: NewConfig(),
}
}
func (apcupsd *Apcupsd) GetName() string {
return "APCUPS Monitor"
}
func (apcupsd *Apcupsd) GetDescription() string {
return "This addon adds UPS monitoring to your node so you can monitor the status of your APCUPSD compatible UPS within grafana \n\nMade with love by killjoy.eth."
}
func (apcupsd *Apcupsd) GetConfig() cfgtypes.Config {
return apcupsd.cfg
}
func (apcupsd *Apcupsd) GetContainerName() string {
return fmt.Sprint(ContainerID_Apcupsd)
}
func (apcupsd *Apcupsd) GetEnabledParameter() *cfgtypes.Parameter {
return &apcupsd.cfg.Enabled
}
func (apcupsd *Apcupsd) GetContainerTag() string {
return containerTag
}
func (apcupsd *Apcupsd) UpdateEnvVars(envVars map[string]string) error {
if apcupsd.cfg.Enabled.Value == true {
cfgtypes.AddParametersToEnvVars(apcupsd.cfg.GetParameters(), envVars)
}
return nil
}