Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. //Vaquero IPMI stuff
  2.  
  3. package main
  4.  
  5. import (
  6. "fmt"
  7.  
  8. "github.com/vmware/goipmi"
  9. )
  10.  
  11. func main() {
  12. fmt.Println("Hello World")
  13. // make connection - obviously use different info here
  14. conn := &ipmi.Connection{Path: "www.google.com", Hostname: "myhost", Port: 8080, Username: "megan", Password: "pw", Interface: "lan"}
  15.  
  16. //construct client
  17. nt, err := ipmi.NewClient(conn)
  18. if err != nil {
  19. fmt.Printf("Error creating new client: ", err)
  20. return
  21. }
  22. _ = nt.Open()
  23.  
  24. status := &ipmi.ChassisStatusResponse{}
  25. fmt.Println("System power on?: ", status.IsSystemPowerOn())
  26.  
  27. // type ChassisStatusResponse struct {
  28. // CompletionCode
  29. // PowerState uint8
  30. // LastPowerEvent uint8
  31. // State uint8
  32. // FrontControlPanel uint8
  33. // }
  34.  
  35. //POWER CONTROL x10000000 wow
  36. err = nt.Control(ipmi.ControlPowerUp)
  37. if err != nil {
  38. fmt.Printf("\nError powering up machine :%s \n", err.Error())
  39. return
  40. }
  41.  
  42. err = nt.Control(ipmi.ControlPowerDown)
  43. if err != nil {
  44. fmt.Printf("\nError powering down machine:\n ", err)
  45. return
  46. }
  47.  
  48. //csr := &ChassisStatusResponse{}
  49. //fmt.Printf(csr.PowerState)
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement