//Vaquero IPMI stuff
package main
import ( "fmt"
"github.com/vmware/goipmi"
)
func main() { fmt.Println("Hello World") // make connection - obviously use different info here conn := &ipmi.Connection{Path: "www.google.com", Hostname: "myhost", Port: 8080, Username: "megan", Password: "pw", Interface: "lan"}
//construct client
nt, err := ipmi.NewClient(conn)
if err != nil {
fmt.Printf("Error creating new client: ", err)
return
}
_ = nt.Open()
status := &ipmi.ChassisStatusResponse{}
fmt.Println("System power on?: ", status.IsSystemPowerOn())
// type ChassisStatusResponse struct {
// CompletionCode
// PowerState uint8
// LastPowerEvent uint8
// State uint8
// FrontControlPanel uint8
// }
//POWER CONTROL x10000000 wow
err = nt.Control(ipmi.ControlPowerUp)
if err != nil {
fmt.Printf("\nError powering up machine :%s \n", err.Error())
return
}
err = nt.Control(ipmi.ControlPowerDown)
if err != nil {
fmt.Printf("\nError powering down machine:\n ", err)
return
}
//csr := &ChassisStatusResponse{}
//fmt.Printf(csr.PowerState)
}