surveil/surveil/api/datamodel/status/live_service.py
aviau cfc49075d3 Service status API now uses live_shinken
Change-Id: I8a0b986e3ee3bc926b8daa9ea818bc7a2f7f679e
2015-05-12 10:30:51 -04:00

58 lines
1.9 KiB
Python

# Copyright 2014 - Savoir-Faire Linux inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import wsme
import wsme.types as wtypes
from surveil.api.datamodel import types
class LiveService(types.Base):
host_name = wsme.wsattr(wtypes.text, mandatory=False)
"""The host for the service"""
service_description = wsme.wsattr(wtypes.text, mandatory=False)
"""The name of the service"""
description = wsme.wsattr(wtypes.text, mandatory=False)
"""The description of the sevice"""
state = wsme.wsattr(wtypes.text, mandatory=False)
"""The current state of the service"""
acknowledged = wsme.wsattr(bool, mandatory=False)
"""Wether or not the problem, if any, has been acknowledged"""
last_check = wsme.wsattr(int, mandatory=False)
"""The last time the service was checked"""
last_state_change = wsme.wsattr(int, mandatory=False)
"""The last time the state has changed"""
plugin_output = wsme.wsattr(wtypes.text, mandatory=False)
"""Plugin output of the last check"""
@classmethod
def sample(cls):
return cls(
host_name='Webserver',
service_description='Apache',
description='Serves Stuff',
state='OK',
last_check=1429220785,
last_state_change=1429220785,
plugin_output='HTTP OK - GOT NICE RESPONSE',
acknowledged=True,
)