Initial version of command which will cap system
This commit is contained in:
parent
7d57957524
commit
fbc05a42df
1 changed files with 27 additions and 0 deletions
27
pcp/ssh/raplcap.go
Normal file
27
pcp/ssh/raplcap.go
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package ssh
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golang.org/x/crypto/ssh"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
sshConfig := &ssh.ClientConfig{
|
||||||
|
User: "rapl",
|
||||||
|
Auth: []ssh.AuthMethod{
|
||||||
|
ssh.Password("pankajlikesdanceswithwolves#!@#"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
connection, err := ssh.Dial("tcp", "host:port", sshConfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Failed to dial: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
session, err := connection.NewSession()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("Failed to create session: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = session.Run("sudo /misc/shared_data/rdelval1/RAPL_PKG_Throttle.py 100")
|
||||||
|
}
|
Reference in a new issue