Browse files

First attempt at OMD setup

  • Loading branch information...
1 parent fdac3c2 commit 5a96db6d04871df8a4d4a19b2aae1062c3c3bc74 @jwarlander committed Nov 29, 2013
Showing with 49 additions and 0 deletions.
  1. +28 −0 Dockerfile
  2. +21 −0 watchdog.sh
View
28 Dockerfile
@@ -0,0 +1,28 @@
+# Open Monitoring Distribution
+#
+## VERSION 1.0
+FROM ubuntu
+MAINTAINER Johan Warlander, jwarlander@redbridge.se
+
+# Make sure package repository is up to date
+RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
+RUN apt-get update
+RUN apt-get upgrade -y
+
+# Install OMD
+RUN gpg --keyserver keys.gnupg.net --recv-keys F8C1CA08A57B9ED7
+RUN gpg --armor --export F8C1CA08A57B9ED7 | apt-key add -
+RUN echo "deb http://labs.consol.de/repo/stable/ubuntu precise main" >> /etc/apt/sources.list
+RUN apt-get update
+RUN apt-get install -y libpython2.7 omd
+
+# Set up a default site
+RUN omd create default
+RUN omd config default set TMPFS off
+
+# Add watchdog script
+ADD watchdog.sh /opt/omd/watchdog.sh
+
+# Set up runtime options
+EXPOSE 80
+ENTRYPOINT ["/opt/omd/watchdog.sh"]
View
21 watchdog.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+SLEEP_TIME=60
+MAX_TRIES=5
+
+tries=0
+echo "** Starting OMD **"
+omd start
+while /bin/true; do
+ sleep $SLEEP_TIME
+ omd status | grep -q "stopped" && {
+ if [ $tries -gt $MAX_TRIES ]; then
+ echo "** ERROR: Stopped service found; aborting (after $tries tries) **"
+ exit 1
+ fi
+ tries=$(( tries + 1 ))
+ echo "** ERROR: Stopped service found; trying to start again **"
+ omd start
+ }
+done
+

0 comments on commit 5a96db6

Please sign in to comment.