linotp.controllers.monitoring module

monitoring controller - interfaces to monitor LinOTP

class linotp.controllers.monitoring.MonitoringController(name, install_name='', **kwargs)

Bases: BaseController

monitoring

activeUsers()

GET, POST /monitoring/activeUsers

Deprecated since version 3.2: Requests using HTTP POST method (because it is only reading data). This endpoint will only be available via HTTP GET method in the future.

for each realm, display the resolvers and the number of users which have at least one assigned active token per resolver the ‘total’ gives the number of all users, which are in an allowed realm and own an active token users are conted per resolver (not per realm), so if resolver is in multiple realms and one user ons tokens in 2 realms, the user will be counted only once

Parameters:

realms – (optional) takes realms, only information on these realms will be displayed

Returns:

a json result with a boolean status and request result

Raises:

Exception – if an error occurs an exception is serialized and returned

after_request_funcs: t.Dict[ft.AppOrBlueprintKey, t.List[ft.AfterRequestCallable]]

A data structure of functions to call at the end of each request, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests.

To register a function, use the after_request() decorator.

This data structure is internal. It should not be modified directly and its format may change at any time.

before_request_funcs: t.Dict[ft.AppOrBlueprintKey, t.List[ft.BeforeRequestCallable]]

A data structure of functions to call at the beginning of each request, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests.

To register a function, use the before_request() decorator.

This data structure is internal. It should not be modified directly and its format may change at any time.

config()

GET, POST /monitoring/config

Deprecated since version 3.2: Requests using HTTP POST method (because it is only reading data). This endpoint will only be available via HTTP GET method in the future.

check if Config- Database exists

touches DB and checks if date of last read is new

Returns:

a json result with: { “head”: [], “value”: {“sync”: “True”} }

Raises:

Exception – if an error occurs an exception is serialized and returned

deferred_functions: t.List[DeferredSetupFunction]
error_handler_spec: t.Dict[ft.AppOrBlueprintKey, t.Dict[t.Optional[int], t.Dict[t.Type[Exception], ft.ErrorHandlerCallable]]]

A data structure of registered error handlers, in the format {scope: {code: {class: handler}}}. The scope key is the name of a blueprint the handlers are active for, or None for all requests. The code key is the HTTP status code for HTTPException, or None for other exceptions. The innermost dictionary maps exception classes to handler functions.

To register an error handler, use the errorhandler() decorator.

This data structure is internal. It should not be modified directly and its format may change at any time.

license()

GET, POST /monitoring/license

Deprecated since version 3.2: Requests using HTTP POST method (because it is only reading data). This endpoint will only be available via HTTP GET method in the future.

license return the support status, which is community support by default or the support subscription info, which could be the old license

Returns:

json result with license info

Raises:

Exception – if an error occurs an exception is serialized and returned

name: str
storageEncryption()

GET, POST /monitoring/storageEncryption

Deprecated since version 3.2: Requests using HTTP POST method (because it is only reading data). This endpoint will only be available via HTTP GET method in the future.

check if hsm/enckey encrypts value before storing it to config db

Returns:

a json result with true if a new value gets encryptet before beeing stored in db

Raises:

Exception – if an error occurs an exception is serialized and returned

teardown_request_funcs: t.Dict[ft.AppOrBlueprintKey, t.List[ft.TeardownCallable]]

A data structure of functions to call at the end of each request even if an exception is raised, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests.

To register a function, use the teardown_request() decorator.

This data structure is internal. It should not be modified directly and its format may change at any time.

template_context_processors: t.Dict[ft.AppOrBlueprintKey, t.List[ft.TemplateContextProcessorCallable]]

A data structure of functions to call to pass extra context values when rendering templates, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests.

To register a function, use the context_processor() decorator.

This data structure is internal. It should not be modified directly and its format may change at any time.

tokens()

GET, POST /monitoring/tokens

Deprecated since version 3.2: Requests using HTTP POST method (because it is only reading data). This endpoint will only be available via HTTP GET method in the future.

Displays the number of tokens (with status) per realm (one token might be in multiple realms). The Summary gives the sum of all tokens in all given realms and might be smaller than the summ of all tokens as tokens which have two realms are only counted once!

Parameters:

status – (optional) takes assigned or unassigned, give the number of tokens with this characteristic

;param realms: (optional) takes realms, only the number of tokens in

these realms will be displayed

Returns:

a json result with: { “head”: [], “data”: [ [row1], [row2] .. ] }

Raises:

Exception – if an error occurs an exception is serialized and returned

url_default_functions: t.Dict[ft.AppOrBlueprintKey, t.List[ft.URLDefaultCallable]]

A data structure of functions to call to modify the keyword arguments when generating URLs, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests.

To register a function, use the url_defaults() decorator.

This data structure is internal. It should not be modified directly and its format may change at any time.

url_value_preprocessors: t.Dict[ft.AppOrBlueprintKey, t.List[ft.URLValuePreprocessorCallable]]

A data structure of functions to call to modify the keyword arguments passed to the view function, in the format {scope: [functions]}. The scope key is the name of a blueprint the functions are active for, or None for all requests.

To register a function, use the url_value_preprocessor() decorator.

This data structure is internal. It should not be modified directly and its format may change at any time.

userinfo()

GET, POST /monitoring/userinfo

Deprecated since version 3.2: Requests using HTTP POST method (because it is only reading data). This endpoint will only be available via HTTP GET method in the future.

for each realm, display the resolvers and the number of users per resolver

Parameters:

realms – (optional) takes a realm, only information on this realm will be displayed

Returns:

a json result with: { “head”: [], “data”: [ [row1], [row2] .. ] }

view_functions: t.Dict[str, t.Callable]

A dictionary mapping endpoint names to view functions.

To register a view function, use the route() decorator.

This data structure is internal. It should not be modified directly and its format may change at any time.