geonode.monitoring.utils

Attributes

GS_FORMAT

log

Classes

MonitoringHandler

Handler instances dispatch logging events to specific destinations.

RequestToMonitoringThread

A class that represents a thread of control.

GeoServerMonitorClient

TypeChecks

Functions

align_period_end(end, interval)

align_period_start(start, interval)

generate_periods(since, interval[, end, align])

Generator of periods: tuple of [start, end).

dump(obj[, additional_fields])

extend_datetime_input_formats(formats)

Add new DateTime input formats

collect_metric(**options)

run_check(service, collector[, since, until, ...])

Module Contents

geonode.monitoring.utils.GS_FORMAT = '%Y-%m-%dT%H:%M:%S'[source]
geonode.monitoring.utils.log[source]
class geonode.monitoring.utils.MonitoringHandler(service, *args, **kwargs)[source]

Bases: logging.Handler

Handler instances dispatch logging events to specific destinations.

The base handler class. Acts as a placeholder which defines the Handler interface. Handlers can optionally use Formatter instances to format records as desired. By default, no formatter is specified; in this case, the ‘raw’ message as determined by record.message is logged.

service[source]
emit(record)[source]

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

class geonode.monitoring.utils.RequestToMonitoringThread(service, *args, **kwargs)[source]

Bases: threading.Thread

A class that represents a thread of control.

This class can be safely subclassed in a limited fashion. There are two ways to specify the activity: by passing a callable object to the constructor, or by overriding the run() method in a subclass.

q[source]
service[source]
add(req, resp)[source]
run()[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

class geonode.monitoring.utils.GeoServerMonitorClient(base_url)[source]
REPORT_FORMATS = ('html', 'xml', 'json')[source]
base_url[source]
get_href(link, format=None)[source]
get_requests(format=None, since=None, until=None)[source]

Returns list of requests from monitoring

get_request(href, format=format)[source]
_from_xml(val)[source]
_from_html(val)[source]
to_json(data, from_format)[source]
geonode.monitoring.utils.align_period_end(end, interval)[source]
geonode.monitoring.utils.align_period_start(start, interval)[source]
geonode.monitoring.utils.generate_periods(since, interval, end=None, align=True)[source]

Generator of periods: tuple of [start, end). since parameter will be aligned to closest interval before since.

class geonode.monitoring.utils.TypeChecks[source]
AUDIT_TYPE_JSON = 'json'[source]
AUDIT_TYPE_XML = 'xml'[source]
AUDIT_FORMATS[source]
classmethod audit_format(val)[source]
static host_type(val)[source]
static resource_type(val)[source]
static resource_type_type(val)[source]
static metric_name_type(val)[source]
static service_type(val)[source]
static service_type_type(val)[source]
static label_type(val)[source]
static user_type(val)[source]
static event_type_type(val)[source]
static ows_service_type(val)[source]
geonode.monitoring.utils.dump(obj, additional_fields=tuple())[source]
geonode.monitoring.utils.extend_datetime_input_formats(formats)[source]

Add new DateTime input formats :param formats: input formats yoy want to add (tuple or list) :return: extended input formats

geonode.monitoring.utils.collect_metric(**options)[source]
geonode.monitoring.utils.run_check(service, collector, since=None, until=None, force_check=None, format=None)[source]