2014-11-13 10:06:16 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. /usr/lib/eole/diagnose.sh
|
|
|
|
|
|
|
|
|
|
|
|
eKO() {
|
|
|
|
EchoRouge "Erreur"
|
|
|
|
}
|
|
|
|
|
|
|
|
eOK() {
|
|
|
|
EchoVert "Ok"
|
|
|
|
}
|
|
|
|
|
|
|
|
one()
|
|
|
|
{
|
|
|
|
su oneadmin -s /bin/sh -c "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
TestServiceStatus() {
|
|
|
|
printf ". %${len_pf}s => " "$1"
|
2016-07-22 10:27:36 +02:00
|
|
|
service $2 status >/dev/null 2>&1
|
2014-11-13 10:06:16 +01:00
|
|
|
if [ $? -eq 0 ] ; then
|
|
|
|
eOK
|
|
|
|
else
|
|
|
|
eKO
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
eOneStatus() {
|
|
|
|
[ "$1" = "STOPPED" -o "$1" = "UNKNOWN" ] && EchoRouge "$1" && return
|
2016-09-07 10:53:58 +02:00
|
|
|
[ "$1" = "off" ] && EchoRouge "$1" && return
|
|
|
|
[ "$1" = "ACTIVE" -o "$1" = "on" ] && EchoVert "$1" && return
|
2014-11-13 10:06:16 +01:00
|
|
|
EchoOrange "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EchoGras "*** Virtualisation"
|
|
|
|
|
|
|
|
if [ "$(CreoleGet 'activer_openvswitch')" != "oui" ]; then
|
|
|
|
printf ". %${len_pf}s => " "Virutalisation"
|
|
|
|
EchoOrange "Non actif"
|
|
|
|
fi
|
|
|
|
|
|
|
|
TestServiceStatus "libvirt" libvirt-bin
|
|
|
|
TestServiceStatus "OpenNebula" opennebula
|
|
|
|
TestService "XMLRPC" "localhost:2633"
|
|
|
|
TestService "Sunstone" $(CreoleGet "ip_sunstone"):$(CreoleGet "port_sunstone")
|
|
|
|
TestService "Proxy VNC" $(CreoleGet "ip_sunstone"):$(CreoleGet "vnc_proxy_port_sunstone")
|
2016-05-11 13:52:17 +02:00
|
|
|
if [ "$(CreoleGet 'activer_oneflow' 'non')" == 'oui' ]; then
|
2014-11-13 10:06:16 +01:00
|
|
|
TestService "OneFlow" $(CreoleGet "ip_oneflow"):$(CreoleGet "port_oneflow")
|
|
|
|
fi
|
|
|
|
TestServiceStatus "OpenVswitch" openvswitch-switch
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
if [[ $(CreoleGet activer_onesinglenode 2>&1) == 'oui' ]]
|
|
|
|
then
|
|
|
|
EchoGras "*** Noeuds du cluster Hâpy"
|
|
|
|
|
|
|
|
NODES=$(one 'onehost list -l ID,NAME,STAT' | awk '!/ID.*NAME.*STAT/ {print $1 ":" $2 ":" $3}')
|
|
|
|
for elm in ${NODES}
|
|
|
|
do
|
|
|
|
node=(${elm//:/ })
|
|
|
|
id=${node[0]}
|
|
|
|
name=${node[1]}
|
|
|
|
state=${node[2]}
|
|
|
|
|
|
|
|
printf ". %${len_pf}s => " "$name"
|
|
|
|
eOneStatus "${state}"
|
|
|
|
done
|
2016-09-08 16:49:49 +02:00
|
|
|
echo
|
2014-11-13 10:06:16 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
EchoGras "*** Machines Virtuelles"
|
|
|
|
|
|
|
|
# Les machines virtuelles se terminant par -TEST ne sont pas vérifiées
|
|
|
|
VMs=$( one 'onevm list -l ID,NAME,STAT' | tail -n +2 | grep -ve '\-TEST ' | awk '{print $1}' )
|
|
|
|
if [[ -z ${VMs} ]]
|
|
|
|
then
|
2016-10-19 11:47:52 +02:00
|
|
|
printf ". %${len_pf}s " "Aucune machine virtuelle instanciée"
|
2016-09-07 10:53:58 +02:00
|
|
|
echo ""
|
2014-11-13 10:06:16 +01:00
|
|
|
else
|
|
|
|
for VM in $VMs ; do
|
2019-03-01 11:15:17 +01:00
|
|
|
NAME=$( one "onevm show $VM" | grep '^NAME' | cut -d: -f2 )
|
2014-11-13 10:06:16 +01:00
|
|
|
STAT=$(one "onevm show $VM" | grep '^STATE' | cut -d: -f2 | tr -d ' ' )
|
|
|
|
printf ". %${len_pf}s => " "$NAME"
|
|
|
|
eOneStatus "$STAT"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|