added logging to see if monitord is running well
This commit is contained in:
parent
494ba2f361
commit
d94f9603e8
@ -1,10 +1,12 @@
|
|||||||
package daemons
|
package daemons
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"oc-schedulerd/conf"
|
"oc-schedulerd/conf"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
||||||
|
oclib "cloud.o-forge.io/core/oc-lib"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,6 +25,9 @@ func (lm *LocalMonitor) LaunchLocalMonitor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (lm *LocalMonitor) execKube() {
|
func (lm *LocalMonitor) execKube() {
|
||||||
|
|
||||||
|
l := oclib.GetLogger()
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
"-e", lm.ExecutionID, "-p", lm.PeerID, "-u", conf.GetConfig().LokiUrl, "-m", conf.GetConfig().MongoUrl,
|
"-e", lm.ExecutionID, "-p", lm.PeerID, "-u", conf.GetConfig().LokiUrl, "-m", conf.GetConfig().MongoUrl,
|
||||||
"-d", conf.GetConfig().DBName,
|
"-d", conf.GetConfig().DBName,
|
||||||
@ -35,10 +40,24 @@ func (lm *LocalMonitor) execKube() {
|
|||||||
if lm.Duration > 0 {
|
if lm.Duration > 0 {
|
||||||
args = append(args, "-t", fmt.Sprintf("%d", lm.Duration))
|
args = append(args, "-t", fmt.Sprintf("%d", lm.Duration))
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(conf.GetConfig().MonitorPath, args...)
|
cmd := exec.Command(conf.GetConfig().MonitorPath, args...)
|
||||||
fmt.Printf("Command : %v\n", cmd)
|
fmt.Printf("Command : %v\n", cmd)
|
||||||
err := cmd.Start()
|
|
||||||
|
stdoutMonitord, err := cmd.StdoutPipe();
|
||||||
|
if err != nil {
|
||||||
|
l.Error().Msg("Could not retrieve stdoutpipe for execution of oc-monitord" + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = cmd.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
lm.Logger.Error().Msg("Could not start oc-monitor for " + lm.ExecutionID + " : " + err.Error())
|
lm.Logger.Error().Msg("Could not start oc-monitor for " + lm.ExecutionID + " : " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scanner := bufio.NewScanner(stdoutMonitord)
|
||||||
|
for scanner.Scan() {
|
||||||
|
output := scanner.Text()
|
||||||
|
l.Debug().Msg(output)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user