From 628f1baa56e09f1bc149e10177eeeb3058ed256e Mon Sep 17 00:00:00 2001 From: aviau Date: Fri, 24 Jul 2015 11:26:16 -0400 Subject: [PATCH] Change 'passive_checks_enabled' to Int Change-Id: I4ee334e8ff922411a90b60578e016a43378290e9 --- Dockerfile | 2 +- surveil/api/datamodel/config/host.py | 2 ++ surveil/api/storage/mongodb/config/host.py | 1 + surveil/cmd/init.py | 8 ++++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9f6978c..7e12e44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,5 +54,5 @@ EXPOSE 5311 CMD cd /opt/surveil && \ ./setup.sh && \ - ((sleep 40 && surveil-init --influxdb --packs --mongodb) &) && \ + ((sleep 50 && surveil-init --influxdb --packs --mongodb) &) && \ surveil-api diff --git a/surveil/api/datamodel/config/host.py b/surveil/api/datamodel/config/host.py index 71b2d69..57fee63 100644 --- a/surveil/api/datamodel/config/host.py +++ b/surveil/api/datamodel/config/host.py @@ -53,6 +53,8 @@ class Host(types.Base): retry_interval = wsme.wsattr(int, mandatory=False) + passive_checks_enabled = wsme.wsattr(wtypes.text, mandatory=False) + # TODO(aviau): Custom fields starting without '_' should raise an error. custom_fields = wsme.wsattr( wtypes.DictType(wtypes.text, wtypes.text), diff --git a/surveil/api/storage/mongodb/config/host.py b/surveil/api/storage/mongodb/config/host.py index d9ce2c9..53aa50d 100644 --- a/surveil/api/storage/mongodb/config/host.py +++ b/surveil/api/storage/mongodb/config/host.py @@ -34,3 +34,4 @@ class Host(mongoengine.Document): check_interval = mongoengine.IntField() retry_interval = mongoengine.IntField() custom_fields = mongoengine.DictField() + passive_checks_enabled = mongoengine.StringField() diff --git a/surveil/cmd/init.py b/surveil/cmd/init.py index a15e6b8..14cc34e 100644 --- a/surveil/cmd/init.py +++ b/surveil/cmd/init.py @@ -133,6 +133,14 @@ def main(): service_description="check-ws-arbiter" ) + # Passive checks host + cli_surveil.config.hosts.create( + host_name='passive_check_host', + use=['generic-host'], + address='127.0.0.1', + passive_checks_enabled='1' + ) + # Linux-keystone template cli_surveil.config.hosts.create( host_name='test_keystone',