You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

04-virtualisation 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/bin/bash
  2. . /usr/lib/eole/diagnose.sh
  3. eKO() {
  4. EchoRouge "Erreur"
  5. }
  6. eOK() {
  7. EchoVert "Ok"
  8. }
  9. one()
  10. {
  11. su oneadmin -s /bin/sh -c "$@"
  12. }
  13. TestServiceStatus() {
  14. printf ". %${len_pf}s => " "$1"
  15. service $2 status >/dev/null 2>&1
  16. if [ $? -eq 0 ] ; then
  17. eOK
  18. else
  19. eKO
  20. fi
  21. }
  22. eOneStatus() {
  23. [ "$1" = "STOPPED" -o "$1" = "UNKNOWN" ] && EchoRouge "$1" && return
  24. [ "$1" = "off" ] && EchoRouge "$1" && return
  25. [ "$1" = "ACTIVE" -o "$1" = "on" ] && EchoVert "$1" && return
  26. EchoOrange "$1"
  27. }
  28. EchoGras "*** Virtualisation"
  29. if [ "$(CreoleGet 'activer_openvswitch')" != "oui" ]; then
  30. printf ". %${len_pf}s => " "Virutalisation"
  31. EchoOrange "Non actif"
  32. fi
  33. TestServiceStatus "libvirt" libvirt-bin
  34. TestServiceStatus "OpenNebula" opennebula
  35. TestService "XMLRPC" "localhost:2633"
  36. TestService "Sunstone" $(CreoleGet "ip_sunstone"):$(CreoleGet "port_sunstone")
  37. TestService "Proxy VNC" $(CreoleGet "ip_sunstone"):$(CreoleGet "vnc_proxy_port_sunstone")
  38. if [ "$(CreoleGet 'activer_oneflow' 'non')" == 'oui' ]; then
  39. TestService "OneFlow" $(CreoleGet "ip_oneflow"):$(CreoleGet "port_oneflow")
  40. fi
  41. TestServiceStatus "OpenVswitch" openvswitch-switch
  42. echo ""
  43. if [[ $(CreoleGet activer_onesinglenode 2>&1) == 'oui' ]]
  44. then
  45. EchoGras "*** Noeuds du cluster Hâpy"
  46. NODES=$(one 'onehost list -l ID,NAME,STAT' | awk '!/ID.*NAME.*STAT/ {print $1 ":" $2 ":" $3}')
  47. for elm in ${NODES}
  48. do
  49. node=(${elm//:/ })
  50. id=${node[0]}
  51. name=${node[1]}
  52. state=${node[2]}
  53. printf ". %${len_pf}s => " "$name"
  54. eOneStatus "${state}"
  55. done
  56. echo
  57. fi
  58. EchoGras "*** Machines Virtuelles"
  59. # Les machines virtuelles se terminant par -TEST ne sont pas vérifiées
  60. VMs=$( one 'onevm list -l ID,NAME,STAT' | tail -n +2 | grep -ve '\-TEST ' | awk '{print $1}' )
  61. if [[ -z ${VMs} ]]
  62. then
  63. printf ". %${len_pf}s " "Aucune machine virtuelle instanciée"
  64. echo ""
  65. else
  66. for VM in $VMs ; do
  67. NAME=$( one "onevm show $VM" | grep '^NAME' | cut -d: -f2 )
  68. STAT=$(one "onevm show $VM" | grep '^STATE' | cut -d: -f2 | tr -d ' ' )
  69. printf ". %${len_pf}s => " "$NAME"
  70. eOneStatus "$STAT"
  71. done
  72. fi
  73. echo ""