Up– a next generation status monitor

class up.status.StatusMonitor

A status monitor. Inherit from this class to create your own.

main(note, mood, verbosity)
sink = None
source = None
class up.source.StatusSource(name)

A base class for a status. All statuses should extend from this class.

prepare()

Abstract method, implementing classes should use this hook to poll the status and update self.status.

timed_prepare()

Call prepare and record the amount of time it takes to finish.

class up.source.StatusTreeSource(name, children=None)

A tree source allows you to organize your statuses. It will allow you to see the combined status of all of the statuses underneath it.

calculate()

Calculates the percentage of the children that are up.

prepare()

Calls timed_prepare on all of its children and sets its status to the percentage of children that are up.

class up.source.ThreadedTreeSource(name, children=None)

Similar to StatusTreeSource, ThreadedTreeSource runs all of the timed_prepare calls in parallel. This is useful for statuses that require network access.

prepare()
class up.source.ThreadedTreeSource(name, children=None)

Similar to StatusTreeSource, ThreadedTreeSource runs all of the timed_prepare calls in parallel. This is useful for statuses that require network access.

prepare()
class up.source.HTTPStatusSource(name, url)

Makes a request to a url and uses the HTTP status code to determine of the server is up.

Redirects are followed before determining the status.If the status code is 2xx the server is considered to be up. Status codes 4xx, 5xx, truncated connections, or otherwise mangled responses are considered down.

You can also use this as a basis for parsed statuses.

prepare()
class up.source.GitHubStatusSource(name='GitHub', url='https://status.github.com/api/status.json')

Using the GitHub status api you can retrieve the current status of GitHub.

GitHub Statuses: Good maps to UP Minor maps to HALF UP Major maps to DOWN

prepare()
class up.sink.StatusSink

A base class for a sink. Sinks are used for outputting the the statuses gathered by sources.

add_annotation(note)

Add an annotation to the output.

process_status(status, deep=0, surname='')

Implementing classes should implement this hook to output an individual status.

Parameters:
  • status – a status object to be output.
  • deep – an int of the number of StatusTreeSource that have been traversed down.
  • surname – The names of all of the parent sources concatenated with a ‘/’.
set_mood(mood)

The mood of any messaging.

set_status(source, deep=0, surname='')
set_verbosity(verbosity)

If the sink outputs to stdout, use this value to control the amount of output.

class up.sink.TreeStatusSink(children)

Output a source to multiple sinks.

add_annotation(note)
set_mood(mood)
set_status(source)
set_verbosity(verbosity)
class up.sink.MongoStatusSink(domain, port)

Output a source to MongoDB. Each status is stored as a separate document.

Up-web requires statuses to be stored with this sink.

DB_NAME = 'up'
add_annotation(note)
process_status(status, deep=0, surname='')
class up.sink.StdOutStatusSink

Output a source to stdout with fancy colors for easy skimming.

add_annotation(note)
messages = {'optimist': ['\x1b[91mHANG IN THERE!\x1b[0m', '\x1b[91mSLIGHTLY UP\x1b[0m', '\x1b[93mHALF UP\x1b[0m', '\x1b[93mMOSTLY UP\x1b[0m', '\x1b[32mUP\x1b[0m'], 'pessimist': ['\x1b[91mGET TO WORK!\x1b[0m', '\x1b[91mMOSTLY DOWN\x1b[0m', '\x1b[93mHALF DOWN\x1b[0m', '\x1b[93mSLIGHTLY DOWN\x1b[0m', '\x1b[32mWHATEVER\x1b[0m'], 'realist': ['\x1b[91mDOWN\x1b[0m', '\x1b[91mMOSTLY DOWN\x1b[0m', '\x1b[93mHALF UP\x1b[0m', '\x1b[93mMOSTLY UP\x1b[0m', '\x1b[32mUP\x1b[0m']}
process_status(status, deep=0, surname='')