All paths relative to $OMD_ROOT:


(place eventhandler scripts here)


(see OMDconfiguration)


(see OMDconfiguration)


(edit starturl)

# URL to show as welcome page (in the 'main' frame).
# You can use relative URL or absolute URLs like 'http://server/url'
# Default is ''
start_url = ''


(add email commands to top of file)

# 'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$

# 'notify-service-by-email' command definition
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$


(edit redirect at top)

#RedirectMatch ^/nagios$  /nagios/omd/
#RedirectMatch ^/nagios/$ /nagios/omd/
RedirectMatch ^/nagios$  /nagios/check_mk/
RedirectMatch ^/nagios/$ /nagios/check_mk/


(custom edit, e.g. to provide LDAP auth)


Add this check so that you can use Check_MK to inventory the VMs hosted by the KVM hypervisor.

Contents of ~/share/check_mk/checks/qemu:

# inventory
def inventory_qemu(checkname, info):
    inventory = []
    for line in info:
        if line[2] == "running":  # only VM's running while inventory are monitored !
            vm = line[1] # we want to capture hostname, not vm id here
            inventory.append( (vm, None) )
    return inventory

# check
def check_qemu(name, param, info):
    for line in info:
        perfdata = []
        if line[1] == name:
            item = line[0]
            status = line[2]
            ram = line[3]
            infotext = "%s  (id: %s, ram: %s MB)" % (status, item, ram)
            if status == "running":
                perfdata.append( ( "CPU%", int(round(float(line[4]))) ) )
                perfdata.append( ( "RAM%", int(round(float(line[5]))) ) )
                return (0, "OK - status is " + infotext, perfdata)
                return (2, "CRITICAL - status is " + infotext, perfdata)
    return (3, "UNKNOWN - VM %s not found in agent output" % item) 

# declare the check to Check_MK
check_info['qemu'] = \
        (check_qemu, "VM %s", 1, inventory_qemu)

Worker Nodes: /usr/lib/check_mk_agent/plugins/mk_qemu

Make sure you've installed 'mk_qemu' on each of your worker nodes (along with the check_mk_agent):

if which virsh >/dev/null; then
	echo '<<<qemu>>>'
	virsh list | grep -v 'State' | grep -v '^--' | grep -v '^$' | while read L
		ID=$(echo $L | awk '{print $1}')
		NAME=$(echo $L | awk '{print $2}')
		STATE=$(echo $L | awk '{print $3}')
		MEM=$(virsh dominfo $NAME | grep 'Used memory' | awk '{print $3}')
		let MEM=MEM/1024
		PID=$(ps aux | grep kvm | grep $NAME | awk '{print $2}')
		if [ $PID -gt 0 ]; then
			DATA=$(top -p $PID -n 1 -b | tail -n 2 | head -n 1 | awk -- '{print $9" "$10}')
		echo $ID" "$NAME" "$STATE" "$MEM" "$DATA


(so omd user can run euca commands)


(source eucarc file using absolute path to file)

append to ~/.profile:

. ${OMD_ROOT}/.euca/eucarc


*Fix Group-Write Permissions

cd ~/tmp
chmod -R g+w .

* The 'apache' user is a member of the group with same name as $OMD_SITE. If you don't do this, then the webserver can't write to $OMD_ROOT/tmp, meaning that many, many things will break -- including the ability to create a PHP session -- meaning the whole site fails to work.