Module Import alias Import alias ImportFrom alias TryExcept body Import alias identifier handlers ExceptHandler type NameLoad body Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Num Num Num Num Num Num Num Num Num Num Str Str Str Str Str Str Str Str Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults Dict body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return SubscriptLoad AttributeLoad NameLoad attr Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body If UnaryOpNot NameLoad body Assign NameStore AttributeLoad NameLoad attr orelse Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body Raise AttributeLoad NameLoad attr Str If Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str For TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body Expr Call NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str Expr Call NameLoad NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad keyword Call NameLoad Expr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign NameStore AttributeLoad AttributeLoad AttributeLoad AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr attr attr attr If UnaryOpNot NameLoad body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call AttributeLoad NameLoad attr Str Str NameLoad Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpMod Str AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad Num Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Return NameLoad decorator_list ClassDef bases NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam NameParam defaults body TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list decorator_list Assign NameStore Call NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad Assign NameStore Dict Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Expr Call AttributeLoad NameLoad attr NameLoad TryExcept body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad FunctionDef arguments args defaults body Import alias alias Expr Call AttributeLoad NameLoad attr NameLoad decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A re N/A os Queue Queue N/A N/A N/A cPickle pickle N/A N/A N/A ImportError N/A N/A pickle zope.interface implements twisted.persisted sob twisted.persisted.sob Persistent pymon exceptions pymon utils pymon.config cfg pymon.interfaces IState pymon.utils.logger log pymon.utils.registry Registry pymon.workflow.base Workflow pymon.workflow.service ServiceState stateWorkflow N/A initialCheckData N/A org node service type service count count ok count warn count error count failed count unknown count maintenance count disabled current status previous status current status name previous status name desc data last check last ok last warn last error last failed 0 0 0 0 0 0 0 0 -1 -1 InitialCheckData N/A dict N/A N/A 
    The data structure for the data that monitors will set.
     __init__ N/A N/A self N/A N/A N/A N/A N/A self update initialCheckData N/A N/A BaseState N/A Persistent N/A N/A 
    # create a state and add some test data
    >>> s = BaseState()
    >>> s.data = {'test data': 'Here it is!'}
    >>> print s.data
    {'test data': 'Here it is!'}

    # try to restore it
    >>> s.restore()
    Traceback (most recent call last):
    exceptions.StateRestoreError: It appears that state was never saved; cannot restore

    # try to save without a filename
    >>> s.save()
    Traceback (most recent call last):
    exceptions.StateSaveError: You have not yet saved this instance and so must provide a filename.

    # save it
    >>> saveFile = 'tmppckl_pkl'
    >>> s.save(saveFile)

    # change the state data and print it
    >>> s.data = {'test data': 'this is going away... soon...'}
    >>> print s.data
    {'test data': 'this is going away... soon...'}

    # restore old state data and make sure that the last changes
    # made to the state are now overwritten with the original
    # state data
    >>> t = BaseState()
    >>> t.setFilename(saveFile)
    >>> t.restore()
    >>> print t.data
    {'test data': 'Here it is!'}

    # lets update the data, save it, and make sure it restores
    >>> t.data.update({'new data': 'doh!'})
    >>> t.data['new data']
    'doh!'
    >>> t.save()
    >>> t.data = {}
    >>> t.restore()
    >>> t.data['new data']
    'doh!'
    >>> t.data['test data']
    'Here it is!'

    # lets cleanup that file
    #>>> os.unlink(s.filename)
    #>>> os.path.exists(s.filename)
    #False
     __init__ N/A N/A self data N/A N/A N/A N/A N/A N/A Persistent __init__ self self N/A N/A self data data N/A N/A self filename None N/A __getstate__ N/A N/A self N/A N/A N/A N/A self __dict__ N/A set N/A N/A self key value N/A N/A N/A N/A N/A self data N/A key value N/A N/A N/A self __dict__ N/A key value N/A get N/A N/A self key N/A N/A N/A N/A N/A self data N/A key N/A setFilename N/A N/A self filename N/A N/A N/A N/A self filename filename N/A getFilename N/A N/A self N/A N/A N/A N/A self filename N/A save N/A N/A self filename N/A None N/A N/A N/A filename N/A N/A filename N/A self filename N/A N/A N/A self filename filename N/A restore N/A N/A self N/A N/A N/A N/A N/A self filename N/A N/A N/A exceptions StateRestoreError It appears that state was never saved; cannot restore N/A N/A N/A N/A os path exists N/A self filename N/A N/A s N/A N/A sob load N/A self filename pickle N/A N/A key val N/A N/A N/A s __dict__ items N/A N/A N/A setattr self key val N/A items N/A N/A self N/A N/A N/A N/A N/A N/A self data items N/A N/A MonitorState N/A BaseState N/A N/A 
    This is a state machine and adapter. It adapts a monitor instance to a
    state object. The state for a given monitor is retrieved by callint the
    interface:
        state = IState(monitorInstance)
    The associated monitor is accessed via the monitor attribute:
        cfg = state.monitor.cfg

    Monitors need to have their own state data files, named according to
    a convention. MonitorState provides a method to do this:

    >>> m = MonitorState('http status://adytum.us')
    >>> m.data.get('current status')
    -1
    >>> m.data.get('org')
    ''
    >>> m.save()
    >>> m.restore()
    >>> m.data.get('current status')
    -1
    >>> m.set('current status', 3)
    >>> m.data.get('current status')
    3
    >>> m.save()
    >>> m.restore()
    >>> m.data.get('current status')
    3
     N/A N/A implements IState __init__ N/A N/A self monitor N/A N/A N/A N/A self monitor monitor N/A N/A N/A BaseState __init__ self data N/A InitialCheckData N/A N/A N/A self setFilename N/A N/A self workflow N/A ServiceState stateWorkflow N/A setFilename N/A N/A self filename N/A None N/A N/A backupDir N/A N/A N/A N/A N/A N/A self monitor cfg app admin backups state_dir N/A N/A filename N/A N/A filename N/A N/A self monitor uid N/A N/A self filename N/A N/A N/A os path join backupDir N/A N/A re sub [^0-9A-Za-z_] _ filename N/A N/A N/A self data filename N/A self filename N/A N/A N/A log debug N/A Backup file named '%s'. N/A self filename N/A N/A setNonChangingState N/A N/A state stateNum uid N/A N/A N/A stateName N/A N/A cfg getStateNameFromNumber stateNum N/A type N/A N/A utils getFriendlyTypeFromURI uid N/A host N/A N/A utils getHostFromURI uid N/A org N/A N/A N/A cfg getCheckConfigFromURI uid org N/A N/A N/A state set current status stateNum N/A N/A N/A state set current status name stateName N/A N/A N/A state set N/A count  stateName 1 N/A N/A N/A state set node host N/A N/A N/A state set service type N/A org N/A N/A N/A N/A state set org org N/A state N/A History N/A Queue object N/A N/A 
    >>> h = History(3)
    >>> h.add('test 1')
    >>> h.queue
    deque(['test 1'])
    >>> h.add('test 2')
    >>> h.queue
    deque(['test 1', 'test 2'])
    >>> h.add('test 3')
    >>> h.queue
    deque(['test 1', 'test 2', 'test 3'])
    >>> h.last
    Traceback (most recent call last):
    AttributeError: 'History' object has no attribute 'last'

    >>> h.add('test 4')
    >>> h.queue
    deque(['test 2', 'test 3', 'test 4'])
    >>> h.last
    'test 1'
    >>> h.add('test 5')
    >>> h.getLastRemoved()
    'test 2'
     setattr N/A N/A self aName aValue N/A N/A N/A N/A N/A self __setattr__ aName aValue N/A getattr N/A N/A self aName N/A N/A N/A N/A N/A self __getattribute__ aName N/A setLastRemoved N/A N/A self aItem N/A N/A N/A N/A N/A self setattr last aItem N/A getLastRemoved N/A N/A self N/A N/A N/A N/A N/A self getattr last N/A add N/A N/A self aItem N/A N/A N/A N/A N/A N/A N/A self put_nowait aItem N/A N/A N/A N/A N/A N/A self removeItem N/A N/A N/A self add aItem N/A removeItem N/A N/A self N/A N/A N/A N/A N/A self setLastRemoved N/A N/A self get N/A N/A N/A globalRegistry N/A Registry N/A state N/A BaseState N/A history N/A History N/A factories N/A N/A app_state N/A N/A N/A os path join N/A N/A N/A cfg admin backups state_dir N/A N/A N/A cfg admin backups application_state N/A N/A N/A state setFilename app_state N/A N/A N/A N/A N/A state restore N/A N/A N/A log info Restoring previous application state... N/A N/A N/A IOError N/A N/A N/A N/A state save N/A N/A N/A globalRegistry add state state N/A N/A N/A globalRegistry add history history N/A N/A N/A globalRegistry add factories factories _test N/A N/A N/A N/A N/A doctest application N/A N/A N/A doctest testmod application N/A N/A N/A __name__ __main__ N/A N/A N/A _test