mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-22 15:11:16 +01:00
add prometheus monitoring to config
This commit is contained in:
parent
add1b69809
commit
fbb8a25320
@ -53,7 +53,8 @@ type Pruning struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Global struct {
|
type Global struct {
|
||||||
Logging []LoggingOutletEnum `yaml:"logging"`
|
Logging []LoggingOutletEnum `yaml:"logging"`
|
||||||
|
Monitoring []MonitoringEnum `yaml:"monitoring"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConnectEnum struct {
|
type ConnectEnum struct {
|
||||||
@ -138,6 +139,15 @@ type TCPLoggingOutletTLS struct {
|
|||||||
Key string `yaml:"key"`
|
Key string `yaml:"key"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MonitoringEnum struct {
|
||||||
|
Ret interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type PrometheusMonitoring struct {
|
||||||
|
Type string `yaml:"type"`
|
||||||
|
Listen string `yaml:"listen"`
|
||||||
|
}
|
||||||
|
|
||||||
func enumUnmarshal(u func(interface{}, bool) error, types map[string]interface{}) (interface{}, error) {
|
func enumUnmarshal(u func(interface{}, bool) error, types map[string]interface{}) (interface{}, error) {
|
||||||
var in struct {
|
var in struct {
|
||||||
Type string
|
Type string
|
||||||
@ -201,6 +211,13 @@ func (t *LoggingOutletEnum) UnmarshalYAML(u func(interface{}, bool) error) (err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *MonitoringEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error) {
|
||||||
|
t.Ret, err = enumUnmarshal(u, map[string]interface{}{
|
||||||
|
"prometheus": &PrometheusMonitoring{},
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var ConfigFileDefaultLocations = []string{
|
var ConfigFileDefaultLocations = []string{
|
||||||
"/etc/zrepl/zrepl.yml",
|
"/etc/zrepl/zrepl.yml",
|
||||||
"/usr/local/etc/zrepl/zrepl.yml",
|
"/usr/local/etc/zrepl/zrepl.yml",
|
||||||
|
@ -28,3 +28,6 @@ global:
|
|||||||
time: true
|
time: true
|
||||||
level: "warn"
|
level: "warn"
|
||||||
format: "human"
|
format: "human"
|
||||||
|
monitoring:
|
||||||
|
- type: "prometheus"
|
||||||
|
listen: ":9091"
|
Loading…
Reference in New Issue
Block a user