MSV FM

[email protected]: ~ $
Path : /lib/fm-agent/library/
File Upload :
Current < : //lib/fm-agent/library/anomaly.py

from agent_util import total_seconds
from datetime import datetime, timedelta
import logging
import sys


class Anomaly(object):
    def __init__(self, acceptable_duration, schedules_number_of_checks):
        self.log = logging.getLogger(self.__class__.__name__)
        self.log.info('New anomaly detected')

        now = datetime.now()
        self.time_first_detected = now
        self.time_last_detected = now
        self.acceptable_duration = timedelta(seconds=acceptable_duration)
        self.reported_as_exceeded_duration = False
        self.reported_as_cleared = False
        self.schedules_number_of_checks = schedules_number_of_checks

    def __repr__(self):
        return '<%s, %s first detected: %s, last detected: %s, duration: %s>' % (
            self.__class__.__name__,
            self.reported_as_exceeded_duration and "PUSHED" or "WAITING",
            self.time_first_detected,
            self.time_last_detected,
            self.acceptable_duration,
        )

    # The logging library interferes with cPickle, so we must remove the logger
    # instance then reset it when we serialize/unserialize.
    def __getstate__(self):
        state = dict(self.__dict__)
        del state['log']
        return state

    def __setstate__(self, state):
        self.__dict__.update(state)
        self.log = logging.getLogger(self.__class__.__name__)

    def exceeds_duration(self):
        time_since_first_detection = (datetime.now() -
                                      self.time_first_detected)
        self.log.debug('Anomaly began %s and has lasted %s seconds',
                       self.time_first_detected,
                       total_seconds(time_since_first_detection))

        return time_since_first_detection >= self.acceptable_duration

    def has_cleared(self, current_check_number):
        time_since_last_detection = datetime.now() - self.time_last_detected
        self.log.debug('Anomaly was last detected at %s, %s seconds ago',
                       self.time_last_detected,
                       total_seconds(time_since_last_detection))

        return (time_since_last_detection > self.acceptable_duration and
                self.schedules_number_of_checks < current_check_number)
Bethany
Bethany
0%

THE FINEST HOTEL NEAR LAKE KIVU

The Perfect Base For You

Required fields are followed by *





EC1A68011

About Us

Delicious Interior With The Pinch Of Everything

Bethany Investment group is Presbyterian church in Rwanda(EPR) company that manage Hotel and Guest house in Karongi (Bethany Hotel), ISANO branch in GIKONDO(Kigali), Kiyovu branch(Kigali), AMIZERO branch(Nyagatare-East) and Gisenyi Branch(Rubavu).

Accomodation

Get a Comfortable Room
Feel The Comfort

Get a comfortable room and feel our hotel’s comfort. Bethany Hotel features a variety of fully furnished rooms with extra space, Executive rooms, Deluxe rooms with a beautiful lake view and garden space, Deluxe rooms, comfort rooms, family rooms and standard rooms at your service.

Standard Single

Services

We Provide Top Class Facility
Especially For You

Beach BBQ Party

Kick back on the beach& and enjoy our berbecue from our masterchef

Breakfast

Kick back at our hotels& enjoy our breakfast from our masterchef

Conference Hall

Kick back at our hotels& enjoy our conference halls from all bethany branches

Enjoy with your partner

Honeymoon Package

80%

Get In Touch

Don’t Miss Any Update

    +

    Search your Room

    Required fields are followed by *