(WS12-01) Cloud/Hyperic

Aus Verteilte Systeme - Wiki
Wechseln zu: Navigation, Suche

Hyperic

Vorbereitung

Herunterladen des Servers

wget http://sourceforge.net/projects/hyperic-hq/files/Hyperic%204.6.6/Hyperic%204.6.6-GA/hyperic-hq-installer-4.6.6-x86-64-linux.tar.gz/download -O hyperic-hq-installer-4.6.6-x86-64-linux.tar.gz

Herunterladen der Agents

wget http://sourceforge.net/projects/hyperic-hq/files/Hyperic%204.6.6/Hyperic%204.6.6-GA/hyperic-hq-agent-4.6.6-x86-linux.tar/download -O hyperic-hq-agent-4.6.6-x86-linux.tar

wget http://sourceforge.net/projects/hyperic-hq/files/Hyperic%204.6.6/Hyperic%204.6.6-GA/hyperic-hq-agent-4.6.6-x86-64-linux.tar/download -O hyperic-hq-agent-4.6.6-x86-64-linux.tar

wget http://sourceforge.net/projects/hyperic-hq/files/Hyperic%204.6.6/Hyperic%204.6.6-GA/hyperic-hq-agent-4.6.6-win32.zip/download -O hyperic-hq-agent-4.6.6-win32.zip

Anlegen des Hyperic-Benutzers und -Verzeichnisses

sudo mkdir /opt/hyperic
sudo useradd hyperic -d /opt/hyperic
sudo chown hyperic:hyperic /opt/hyperic

Hyperic-Server installieren

Datenbank anlegen

sudo -u postgres createuser -PSDR hyperic
sudo -u postgres createdb hyperic -O hyperic

Entpacken des Servers

sudo tar xzvf hyperic-hq-installer-4.6.6-x86-64-linux.tar.gz -C /opt/hyperic && sudo chown hyperic:hyperic -R /opt/hyperic/hyperic-hq-installer-4.6.6

Starten des Setups

sudo -u hyperic /opt/hyperic/hyperic-hq-installer-4.6.6/setup.sh

Parameter:

  • Choose which software to install 1: Hyperic HQ Server
  • HQ server installation path /opt/hyperic
  • SMTP server information openstack0.vs.cs.hs-rm.de
  • Enter the email address that HQ will use as the sender for email messages hqadmin@openstack0.vs.cs.hs-rm.de
  • Enter the DB hostname openstack0.vs.cs.hs-rm.de
  • Enter the DB por_ 5432
  • Enter the DB name hyperic
  • Override the JDBC connection URL for the PostgreSQL database jdbc:postgresql://openstack0.vs.cs.hs-rm.de:5432/hyperic?protocolVersion=2
  • Enter the username to use to connect to the database hyperic
  • Enter the password to use to connect to the database hyperic
  • Would you like to use an auto generated encryption key to encrypt the database password? 1: Yes
  • What should the username be for the initial admin user? hqadmin
  • What should the password be for the initial admin user? hqadmin
  • What should the email address be for the initial admin user? hqadmin@openstack0.vs.cs.hs-rm.de

Anmerkung: Es muss die mitgelieferte PostgreSQL-Datenbank (8.2) verwendet werden, da es mit Version 9.x zu Fehlern im Betrieb kommt.

Symbolischen Link anlegen

sudo ln -s /opt/hyperic/server-4.6.6 /opt/hyperic/server

Init.d-Skript anlegen

sudo vi /etc/init.d/hyperic-server && sudo chmod 755 /etc/init.d/hyperic-server

Inhalt von /etc/init.d/hyperic-server:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          hyperic server
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts Hyperic server
# Description:       Starts Hyperic server
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Hyperic Server"
NAME=hyperic-server
DAEMON=/opt/hyperic/server/bin/hq-server.sh
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        start-stop-daemon --start --quiet --pidfile $PIDFILE --user hyperic --exec $DAEMON -- \
                start
        RETVAL="$?"
        return "$RETVAL"
}

#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --start --quiet --pidfile $PIDFILE --user hyperic --exec $DAEMON -- \
                stop
        RETVAL="$?"
        rm -f $PIDFILE
        return "$RETVAL"
}

case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  status)
       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
       ;;
  restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
        exit 3
        ;;
esac

:

Skript automatisch starten/beenden

sudo update-rc.d hyperic-server defaults

URL

http://openstack0.vs.cs.hs-rm.de:7080/

Hyperic-Agent installieren

Entpacken des Agents

sudo tar xvf hyperic-hq-agent-4.6.6-x86-64-linux.tar -C /opt/hyperic/ && sudo chown hyperic:hyperic -R /opt/hyperic/hyperic-hq-agent-4.6.6

Symbolischen Link anlegen

sudo ln -s /opt/hyperic/hyperic-hq-agent-4.6.6 /opt/hyperic/agent

Konfiguration

sudo -u hyperic /opt/hyperic/agent/bin/hq-agent.sh start

Parameter:

  • What is the HQ server IP address? 10.18.48.192
  • Should Agent communications to HQ always be secure? no
  • What is the HQ server port? 7080
  • What is your HQ login? hqadmin
  • What is your HQ password? hqadmin
  • What IP should HQ use to contact the agent? 127.0.1.1
  • What port should HQ use to contact the agent? 2144

Init.d-Skript anlegen

sudo vi /etc/init.d/hyperic-agent && sudo chmod 755 /etc/init.d/hyperic-agent

Inhalt von /etc/init.d/hyperic-agent:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          hyperic agent
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts Hyperic agent
# Description:       Starts Hyperic agent
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Hyperic Agent"
NAME=hyperic-agent
DAEMON=/opt/hyperic/agent/bin/hq-agent.sh
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        start-stop-daemon --start --quiet --pidfile $PIDFILE --user hyperic --exec $DAEMON -- \
                start
        RETVAL="$?"
        return "$RETVAL"
}

#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --start --quiet --pidfile $PIDFILE --user hyperic --exec $DAEMON -- \
                stop
        RETVAL="$?"
        rm -f $PIDFILE
        return "$RETVAL"
}

case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  status)
       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
       ;;
  restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
        exit 3
        ;;
esac

:

Skript automatisch starten/beenden

sudo update-rc.d hyperic-agent defaults

Hyperic-Agent in einer als Image vorgesehenen VM installieren

Hyperic-Agent wie oben beschrieben installieren.

Stoppen des Agents

sudo -u hyperic /opt/hyperic/agent/bin/hq-agent.sh stop

Modifizieren der Einstellungen

In der Datei /opt/hyperic/agent/conf/agent.properties folgende Zeilen einkommentieren und konfigurieren:

agent.setup.camIP=192.168.100.1
agent.setup.camPort=7080
agent.setup.camSSLPort=7443
agent.setup.camSecure=no
agent.setup.camLogin=hqadmin
agent.setup.camPword=ENC(szXF8sK0FdVcGFzGivT3Gg==)
agent.setup.agentIP=*default*
agent.setup.agentPort=*default*
agent.setup.resetupTokens=no
agent.setup.acceptUnverifiedCertificate=yes

Löschen des data-Verzeichnisses

rm -fr /opt/hyperic/agent/data