Added some test and logging on the path to execute monitord
This commit is contained in:
parent
012c8a83cb
commit
0f6213cd14
20
main.go
20
main.go
@ -4,13 +4,14 @@ import (
|
||||
"fmt"
|
||||
"oc-schedulerd/conf"
|
||||
"oc-schedulerd/daemons"
|
||||
"os"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
oclib.InitDaemon("oc-schedulerd")
|
||||
l := oclib.GetLogger()
|
||||
o := oclib.GetConfLoader()
|
||||
|
||||
c := oclib.SetConfig(
|
||||
@ -20,6 +21,7 @@ func main() {
|
||||
o.GetStringDefault("LOKI_URL", ""),
|
||||
o.GetStringDefault("LOG_LEVEL", "info"),
|
||||
)
|
||||
|
||||
conf.GetConfig().DBName = c.MongoDatabase
|
||||
conf.GetConfig().MongoUrl = c.MongoUrl
|
||||
conf.GetConfig().NatsUrl = c.NATSUrl
|
||||
@ -32,6 +34,22 @@ func main() {
|
||||
conf.GetConfig().KubeCert = o.GetStringDefault("KUBE_CERT", "")
|
||||
conf.GetConfig().KubeData = o.GetStringDefault("KUBE_DATA", "")
|
||||
|
||||
// Test if oc-monitor binary is reachable
|
||||
// For local executions
|
||||
if _, err := os.Stat("../oc-monitord/oc-monitord"); err == nil {
|
||||
conf.GetConfig().MonitorPath = "../oc-monitord/oc-monitord"
|
||||
}
|
||||
// For container executions
|
||||
if _, err := os.Stat("/usr/bin/oc-monitord"); conf.GetConfig().MonitorPath == "" && err == nil {
|
||||
conf.GetConfig().MonitorPath = "/usr/bin/oc-monitord"
|
||||
}
|
||||
|
||||
if conf.GetConfig().MonitorPath == "" {
|
||||
l.Fatal().Msg("Could not find oc-monitord binary")
|
||||
}
|
||||
|
||||
l.Info().Msg("oc-monitord binary at " + conf.GetConfig().MonitorPath )
|
||||
|
||||
sch_mngr := daemons.ScheduleManager{Logger: oclib.GetLogger()}
|
||||
exe_mngr := daemons.ExecutionManager{}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user