Skip to content

Commit

Permalink
call vtops
Browse files Browse the repository at this point in the history
  • Loading branch information
pbibra committed Sep 5, 2024
1 parent c356cdb commit 5ccf8bb
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions go/cmd/vtorc/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ limitations under the License.
package cli

import (
"io"
"os/exec"
"time"

"github.com/spf13/cobra"

"vitess.io/vitess/go/acl"
Expand Down Expand Up @@ -68,6 +72,34 @@ func run(cmd *cobra.Command, args []string) {

// Log final config values to debug if something goes wrong.
config.LogConfigValues()

log.Info("sleeping for 30s...\n")
time.Sleep(30 * time.Second)
vtopsCmd := exec.Command("/vt/v19/bin/vtops", "problems", "--hostname", "vtctld-dev-iad-wc2-rcqw", "--raise", "--tablet", "tablet-iad-dev-loadtest-00-80-nf2k", "--problem", "orc-dead-tablet")
// out, err := vtopsCmd.CombinedOutput()
// if err != nil {
// log.Errorf("Error executing vtops command for vtorc: %+v", err)
// } else {
// log.Infof("Executed vtops command successfully: %s", string(out))
// }

stderrPipe, _ := vtopsCmd.StderrPipe()
stdoutPipe, _ := vtopsCmd.StdoutPipe()

if err := vtopsCmd.Start(); err != nil {
log.Errorf("Error starting vtops command: %+v", err)
}

stderr, _ := io.ReadAll(stderrPipe)
stdout, _ := io.ReadAll(stdoutPipe)

if err := vtopsCmd.Wait(); err != nil {
log.Errorf("vtops Command failed with error: %+v", err)
}

log.Infof("vtops Stdout: %s", string(stdout))
log.Errorf("vtops Stderr: %s", string(stderr))

server.StartVTOrcDiscovery()

server.RegisterVTOrcAPIEndpoints()
Expand Down

0 comments on commit 5ccf8bb

Please sign in to comment.