Changed data types from strings to int
Change-Id: I8b5689d4f6cec544aaa431a4a23ff6b1542eccb4
This commit is contained in:
parent
b722bd2b95
commit
df3b11c2de
surveil
api/controllers/v1/datamodel
tests/api/controllers/v1
@ -26,7 +26,7 @@ class CheckResult(types.Base):
|
||||
default=str(int(time.time())))
|
||||
"""The time the check was executed. Defaults to now."""
|
||||
|
||||
return_code = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
return_code = wsme.wsattr(int, mandatory=True)
|
||||
"""The return code of the check."""
|
||||
|
||||
output = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
@ -36,6 +36,6 @@ class CheckResult(types.Base):
|
||||
def sample(cls):
|
||||
return cls(
|
||||
time_stamp="1409087486",
|
||||
return_code="0",
|
||||
return_code=0,
|
||||
output="CPU Usage 98%|c[cpu]=98%;80;95;0;100"
|
||||
)
|
||||
|
@ -25,7 +25,7 @@ class Host(types.Base):
|
||||
address = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
"""The address of the host. Normally, this is an IP address."""
|
||||
|
||||
max_check_attempts = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
max_check_attempts = wsme.wsattr(int, mandatory=True)
|
||||
|
||||
check_period = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
"""The time period during which active checks of this host can be made."""
|
||||
@ -36,7 +36,7 @@ class Host(types.Base):
|
||||
contact_groups = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
"""List of the short names of the contact groups that should be notified"""
|
||||
|
||||
notification_interval = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
notification_interval = wsme.wsattr(int, mandatory=True)
|
||||
|
||||
notification_period = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
|
||||
@ -45,10 +45,10 @@ class Host(types.Base):
|
||||
return cls(
|
||||
host_name="bogus-router",
|
||||
address="192.168.1.254",
|
||||
max_check_attempts="5",
|
||||
max_check_attempts=5,
|
||||
check_period="24x7",
|
||||
contacts="admin,carl",
|
||||
contact_groups="router-admins",
|
||||
notification_interval="30",
|
||||
notification_interval=30,
|
||||
notification_period="24x7",
|
||||
)
|
||||
|
@ -25,15 +25,15 @@ class Service(types.Base):
|
||||
|
||||
check_command = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
|
||||
max_check_attempts = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
max_check_attempts = wsme.wsattr(int, mandatory=True)
|
||||
|
||||
check_interval = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
check_interval = wsme.wsattr(int, mandatory=True)
|
||||
|
||||
retry_interval = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
retry_interval = wsme.wsattr(int, mandatory=True)
|
||||
|
||||
check_period = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
|
||||
notification_interval = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
notification_interval = wsme.wsattr(int, mandatory=True)
|
||||
|
||||
notification_period = wsme.wsattr(wtypes.text, mandatory=True)
|
||||
|
||||
@ -47,11 +47,11 @@ class Service(types.Base):
|
||||
host_name="sample-server",
|
||||
service_description="check-disk-sdb",
|
||||
check_command="check-disk!/dev/sdb1",
|
||||
max_check_attempts="5",
|
||||
check_interval="5",
|
||||
retry_interval="3",
|
||||
max_check_attempts=5,
|
||||
check_interval=5,
|
||||
retry_interval=3,
|
||||
check_period="24x7",
|
||||
notification_interval="30",
|
||||
notification_interval=3,
|
||||
notification_period="24x7",
|
||||
contacts="surveil-ptl,surveil-bob",
|
||||
contact_groups="linux-admins",
|
||||
|
@ -28,21 +28,21 @@ class TestHostController(functionalTest.FunctionalTest):
|
||||
self.hosts = [
|
||||
{
|
||||
"host_name": "bogus-router", "address": "192.168.1.254",
|
||||
"max_check_attempts": "5", "check_period": "24x7",
|
||||
"max_check_attempts": 5, "check_period": "24x7",
|
||||
"contacts": "admin,carl", "contact_groups": "router-admins",
|
||||
"notification_interval": "30", "notification_period": "24x7"
|
||||
"notification_interval": 30, "notification_period": "24x7"
|
||||
},
|
||||
{
|
||||
"host_name": "bogus-router2", "address": "192.168.1.254",
|
||||
"max_check_attempts": "5", "check_period": "24x7",
|
||||
"max_check_attempts": 5, "check_period": "24x7",
|
||||
"contacts": "admin,carl", "contact_groups": "router-admins",
|
||||
"notification_interval": "30", "notification_period": "24x7"
|
||||
"notification_interval": 30, "notification_period": "24x7"
|
||||
},
|
||||
{
|
||||
"host_name": "bogus-router333", "address": "192.168.1.254",
|
||||
"max_check_attempts": "5", "check_period": "24x7",
|
||||
"max_check_attempts": 5, "check_period": "24x7",
|
||||
"contacts": "admin,carl", "contact_groups": "router-admins",
|
||||
"notification_interval": "30", "notification_period": "24x7"
|
||||
"notification_interval": 30, "notification_period": "24x7"
|
||||
},
|
||||
]
|
||||
self.mongoconnection.shinken.hosts.insert(
|
||||
@ -54,11 +54,11 @@ class TestHostController(functionalTest.FunctionalTest):
|
||||
"host_name": "bogus-router",
|
||||
"service_description": "service-example",
|
||||
"check_command": "check-disk!/dev/sdb1",
|
||||
"max_check_attempts": "5",
|
||||
"check_interval": "5",
|
||||
"retry_interval": "3",
|
||||
"max_check_attempts": 5,
|
||||
"check_interval": 5,
|
||||
"retry_interval": 3,
|
||||
"check_period": "24x7",
|
||||
"notification_interval": "30",
|
||||
"notification_interval": 30,
|
||||
"notification_period": "24x7",
|
||||
"contacts": "surveil-ptl,surveil-bob",
|
||||
"contact_groups": "linux-admins"
|
||||
@ -90,11 +90,11 @@ class TestHostController(functionalTest.FunctionalTest):
|
||||
put_host = {
|
||||
u"host_name": u"bogus-router333",
|
||||
u"address": u"newputaddress",
|
||||
u"max_check_attempts": u"222225",
|
||||
u"max_check_attempts": 222225,
|
||||
u"check_period": u"newtimeperiod",
|
||||
u"contacts": u"aaa,bbb",
|
||||
u"contact_groups": u"newgroup",
|
||||
u"notification_interval": u"newnotificationinterval",
|
||||
u"notification_interval": 333,
|
||||
u"notification_period": u"newnotificationperiod"
|
||||
}
|
||||
response = self.app.put_json(
|
||||
@ -123,11 +123,11 @@ class TestHostController(functionalTest.FunctionalTest):
|
||||
new_host = {
|
||||
"host_name": "testpost",
|
||||
"address": "192.168.1.254",
|
||||
"max_check_attempts": "5",
|
||||
"max_check_attempts": 5,
|
||||
"check_period": "24x7",
|
||||
"contacts": "admin,carl",
|
||||
"contact_groups": "router-admins",
|
||||
"notification_interval": "30",
|
||||
"notification_interval": 3,
|
||||
"notification_period": "24x7"
|
||||
}
|
||||
response = self.app.post_json("/v1/hosts", params=new_host)
|
||||
|
@ -28,11 +28,11 @@ class TestServiceController(functionalTest.FunctionalTest):
|
||||
"host_name": "sample-server1",
|
||||
"service_description": "check-",
|
||||
"check_command": "check-disk!/dev/sdb1",
|
||||
"max_check_attempts": "5",
|
||||
"check_interval": "5",
|
||||
"retry_interval": "3",
|
||||
"max_check_attempts": 5,
|
||||
"check_interval": 5,
|
||||
"retry_interval": 3,
|
||||
"check_period": "24x7",
|
||||
"notification_interval": "30",
|
||||
"notification_interval": 30,
|
||||
"notification_period": "24x7",
|
||||
"contacts": "surveil-ptl,surveil-bob",
|
||||
"contact_groups": "linux-admins"
|
||||
@ -41,11 +41,11 @@ class TestServiceController(functionalTest.FunctionalTest):
|
||||
"host_name": "sample-server2",
|
||||
"service_description": "check-disk-sdb",
|
||||
"check_command": "check-disk!/dev/sdb1",
|
||||
"max_check_attempts": "5",
|
||||
"check_interval": "5",
|
||||
"retry_interval": "3",
|
||||
"max_check_attempts": 5,
|
||||
"check_interval": 5,
|
||||
"retry_interval": 3,
|
||||
"check_period": "24x7",
|
||||
"notification_interval": "30",
|
||||
"notification_interval": 30,
|
||||
"notification_period": "24x7",
|
||||
"contacts": "surveil-ptl,surveil-bob",
|
||||
"contact_groups": "linux-admins"
|
||||
@ -54,11 +54,11 @@ class TestServiceController(functionalTest.FunctionalTest):
|
||||
"host_name": "sample-server3",
|
||||
"service_description": "check-disk-sdb",
|
||||
"check_command": "check-disk!/dev/sdb1",
|
||||
"max_check_attempts": "5",
|
||||
"check_interval": "5",
|
||||
"retry_interval": "3",
|
||||
"max_check_attempts": 5,
|
||||
"check_interval": 5,
|
||||
"retry_interval": 3,
|
||||
"check_period": "24x7",
|
||||
"notification_interval": "30",
|
||||
"notification_interval": 30,
|
||||
"notification_period": "24x7",
|
||||
"contacts": "surveil-ptl,surveil-bob",
|
||||
"contact_groups": "linux-admins"
|
||||
@ -82,11 +82,11 @@ class TestServiceController(functionalTest.FunctionalTest):
|
||||
"host_name": "SOMEHOSTNAME",
|
||||
"service_description": "check-new-thing",
|
||||
"check_command": "check-disk!/dev/sdb1",
|
||||
"max_check_attempts": "5",
|
||||
"check_interval": "5",
|
||||
"retry_interval": "3",
|
||||
"max_check_attempts": 5,
|
||||
"check_interval": 5,
|
||||
"retry_interval": 3,
|
||||
"check_period": "24x7",
|
||||
"notification_interval": "30",
|
||||
"notification_interval": 30,
|
||||
"notification_period": "24x7",
|
||||
"contacts": "surveil-ptl,surveil-bob",
|
||||
"contact_groups": "linux-admins"
|
||||
|
Loading…
x
Reference in New Issue
Block a user