djangofloor.views.monitoring

Display some system info

A class-based monitoring view, allowing to display some info.

Also define several widgets (MonitoringCheck) that compose this view. You should install the psutil module to add server info (like the CPU usage).

class djangofloor.views.monitoring.AuthenticationCheck[source]

Presents all activated authentication methods

get_context(request)[source]
template = 'djangofloor/django/monitoring/authentication.html'
class djangofloor.views.monitoring.CeleryStats[source]
get_context(request)[source]
template = 'djangofloor/django/monitoring/celery_stats.html'
class djangofloor.views.monitoring.LogAndExceptionCheck[source]
get_context(request)[source]
template = 'djangofloor/django/monitoring/errors.html'
class djangofloor.views.monitoring.LogLastLines[source]
get_context(request)[source]
static get_log_filenames()[source]

Return the list of filenames used in all logging.FileHandler.

template = 'djangofloor/django/monitoring/log_last_lines.html'
class djangofloor.views.monitoring.MonitoringCheck[source]

Base widget of the monitoring view.

check_commandline()[source]
frequency = None

update frequency (currently unused).

get_context(request)[source]

provide the context required to render the widget

render(request)[source]

render the widget as HTML

template = None

name of the template used by this widget

class djangofloor.views.monitoring.Packages[source]

Check a list of given packages given by settings.DF_CHECKED_REQUIREMENTS. Each element is a requirement as listed by pip freeze.

get_context(request)[source]

provide the installed distributions to the template

static get_installed_distributions(raw_installed_distributions, raw_requirements)[source]

return a list of lists, each sublist having 6 elements:

  • the name of the package,
  • the installed version (or None if not installed),
  • the state (“danger”/”warning”/”success”) as a CSS class,
  • the icon (“remove”/”ok”/”warning-sign”)
  • list of specs as strings [‘>= 1’, ‘< 1.8.1’]
  • list of parse_requirements(r) for the package
template = 'djangofloor/django/monitoring/packages.html'

base template

class djangofloor.views.monitoring.RequestCheck[source]
check_commandline()[source]
common_headers = {'HTTP_UPGRADE': 'Ask the server to upgrade to another protocol.', 'HTTP_IF_RANGE': 'If the entity is unchanged, send me the part(s) that I am missing or send me the entity.', 'HTTP_CONNECTION': 'Control options for the current connection and list of hop-by-hop request fields.', 'HTTP_MAX_FORWARDS': 'Limit the number of times the message can be forwarded through proxies or gateways.', 'HTTP_ACCEPT_ENCODING': 'List of acceptable encodings. See HTTP compression.', 'HTTP_IF_UNMODIFIED_SINCE': 'Only send the response if the entity has not been modified since a specific time.', 'HTTP_HOST': 'The domain name of the server (for virtual hosting), and the TCP port number.', 'HTTP_ACCEPT': 'Media type(s) that is(/are) acceptable for the response.', 'HTTP_PRAGMA': 'Implementation-specific fields that may have various effects.', 'HTTP_FROM': 'The email address of the user making the request.', 'HTTP_ORIGIN': 'Initiates a request for cross-origin resource sharing.', 'HTTP_DATE': 'The date and time that the message was originated', 'HTTP_CACHE_CONTROL': 'Used to specify directives that must be obeyed by caching mechanisms.', 'HTTP_RANGE': 'Request only part of an entity.', 'HTTP_X_FORWARDED_FOR': 'A de facto standard for identifying the originating IP address.', 'HTTP_WARNING': 'A general warning about possible problems with the entity body.', 'HTTP_REFERER': 'This is the address of the previous web page.', 'HTTP_IF_MATCH': 'Only perform the action if the client supplied entity matches the same entity on the server.', 'HTTP_TE': 'The transfer encodings the user agent is willing to accept.', 'HTTP_FORWARDED': 'Disclose original information of a client connecting to a web server through an HTTP proxy.', 'HTTP_X_CORRELATION_ID': 'Correlates HTTP requests between a client and server.', 'HTTP_USER_AGENT': 'The user agent string of the user agent.', 'HTTP_PROXY_AUTHORIZATION': 'Authorization credentials for connecting to a proxy.', 'HTTP_COOKIE': 'An HTTP cookie previously sent by the server with Set-Cookie (below).', 'HTTP_AUTHORIZATION': 'Authentication credentials for HTTP authentication.', 'HTTP_ACCEPT_CHARSET': 'Character sets that are acceptable.', 'HTTP_CONTENT_MD5': 'A Base64-encoded binary MD5 sum of the content of the request body.', 'HTTP_X_FORWARDED_HOST': 'A de facto standard for identifying the original host.', 'HTTP_X_REQUEST_ID': 'Correlates HTTP requests between a client and server.', 'HTTP_X_CSRF_TOKEN': 'Used to prevent cross-site request forgery.', 'HTTP_FRONT_END_HTTPS': 'Non-standard header field used by Microsoft applications', 'HTTP_VIA': 'Informs the server of proxies through which the request was sent.', 'HTTP_X_REQUESTED_WITH': 'Mainly used to identify Ajax requests.', 'HTTP_X_FORWARDED_PROTO': 'A de facto standard for identifying the originating protocol', 'HTTP_ACCEPT_DATETIME': 'Acceptable version in time.', 'HTTP_PROXY_CONNECTION': 'Implemented as a misunderstanding of the HTTP specifications.', 'HTTP_CONTENT_TYPE': 'The Media type of the body of the request (used with POST and PUT requests).', 'HTTP_EXPECT': 'Indicates that particular server behaviors are required by the client.', 'HTTP_ACCEPT_LANGUAGE': 'List of acceptable human languages for response.', 'HTTP_IF_MODIFIED_SINCE': 'Allows a 304 Not Modified to be returned if content is unchanged.', 'HTTP_IF_NONE_MATCH': 'Allows a 304 Not Modified to be returned if content is unchanged, see HTTP ETag.', 'HTTP_DNT': 'Requests a web application to disable their tracking of a user.', 'HTTP_CONTENT_LENGTH': 'The length of the request body in octets (8-bit bytes).'}
get_context(request)[source]
template = 'djangofloor/django/monitoring/request_check.html'
class djangofloor.views.monitoring.System[source]
static analyse_pid_file(processes, data)[source]
check_commandline()[source]
static check_pid(pid: str)[source]
excluded_mountpoints = {'/dev'}
get_context(request)[source]
static get_expected_processes()[source]
static read_pid_file(filename)[source]
template = 'djangofloor/django/monitoring/system.html'
djangofloor.views.monitoring.generate_log(request)[source]
djangofloor.views.monitoring.get_installed_distributions()[source]

Return a list of installed Distribution objects. Simplified version of the version provided by pip.

djangofloor.views.monitoring.raise_exception(request)[source]
djangofloor.views.monitoring.system_state(request)[source]