Book Image

OpenNebula 3 Cloud Computing

Book Image

OpenNebula 3 Cloud Computing

Overview of this book

OpenNebula is one of the most advanced and highly-scalable open source cloud computing toolkits. If you ever wanted to understand what Cloud Computing is and how to realize it, or if you need a handy way to manage your messy infrastructure in a simple and coherent manner, this is your way. OpenNebula 3 Cloud Computing guides you along the building and maintenance of your cloud infrastructure, providing real-world examples, step-by-step configuration and other critical information. The book keeps you a step ahead in dealing with the demanding nature of cloud computing and virtual infrastructure management using one of the most advanced cloud computing toolkitsñ OpenNebula. The book takes you from a basic knowledge of OpenNebula to expert understanding of the most advanced features.The book starts with a basic planning of hardware resources and presents the unique benefits of the supported hypervisors; you will go in deep with day-to-day management of virtual instances, infrastructure monitoring and integration with Public Clouds like Amazon EC2.With this book you will be able to get started with fast and cheap configuration recipes, but also go deeper for a correct integration with your existing infrastructure.You will deal with well-know virtualization technologies like Xen and VMware, but also with the promising KVM technology integrated in the Linux kernel. After the basic infrastructure set-up, you will learn how to create and manage virtual instance via both command-line and web interfaces, and how to monitor your existing resources.At the end, the book acquaints you with integrating your local infrastructure with external Cloud resources but also publishing your resources to others via common API interfaces.
Table of Contents (17 chapters)
OpenNebula 3 Cloud Computing
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
OpenNebula and Why it Matters?
Index

A custom hook: e-mail notification for each failure


The simplest hook use case could be to send an e-mail notification whenever a host or VM fails, without too much fuss:

VM_HOOK = [
  name         = "on_failure_email",
  on              = "FAILED",
  command  = "mail_notify.sh",
  arguments = "VM $VMID [email protected]" ]
HOST_HOOK = [
  name      = "error_email",
  on        = "ERROR",
  command   = "mail_notify.sh",
  arguments = "HOST $HID [email protected]",
  remote    = "no" ]

Place the script in /var/lib/one/remotes/hooks or $ONE_LOCATION/var/remotes/hooks with:

#!/bin/bash
TYPE=$1
ID=$2
MAIL=$3
echo "You have been warned!" | mail -s "ON: $TYPE with ID $ID has failed!" $MAIL

Do not forget to make it executable with chmod +x mail_notify.sh.

Now, you will easily get an e-mail notification every time a host or a VM switches to FAILED status.

Tip

Sending e-mail from the frontend

To send e-mail from the frontend, you need to have a configured MTA, such as Postfix or SSMTP. There are many things...