make ceilometer work if you don't enable ceilometer-api

when doing ceilometer in a multihost devstack, you don't want
ceilometer-api running on the computes. Under -o errexit this
became fatal.

Change-Id: Ie43c8724ba467b810f5a3b075dea45d66dde8648
diff --git a/lib/ceilometer b/lib/ceilometer
index d20d628..0be4184 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -206,9 +206,12 @@
     screen_it ceilometer-collector "cd ; ceilometer-collector --config-file $CEILOMETER_CONF"
     screen_it ceilometer-api "cd ; ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
 
-    echo "Waiting for ceilometer-api to start..."
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! curl --noproxy '*' -s http://localhost:8777/v2/ >/dev/null; do sleep 1; done"; then
-        die $LINENO "ceilometer-api did not start"
+    # only die on API if it was actually intended to be turned on
+    if service_enabled ceilometer-api; then
+        echo "Waiting for ceilometer-api to start..."
+        if ! timeout $SERVICE_TIMEOUT sh -c "while ! curl --noproxy '*' -s http://localhost:8777/v2/ >/dev/null; do sleep 1; done"; then
+            die $LINENO "ceilometer-api did not start"
+        fi
     fi
 
     screen_it ceilometer-alarm-notifier "cd ; ceilometer-alarm-notifier --config-file $CEILOMETER_CONF"