Alarms

class uwsgiconf.options.alarms.Alarms(*args, **kwargs)

Alarms.

This subsystem allows the developer/sysadmin to “announce” special conditions of an app via various channels.

class alarm_types

Alarm types available for .register_alarm().

command

alias of uwsgiconf.options.alarm_types.AlarmCommand

curl

alias of uwsgiconf.options.alarm_types.AlarmCurl

log

alias of uwsgiconf.options.alarm_types.AlarmLog

mule

alias of uwsgiconf.options.alarm_types.AlarmMule

signal

alias of uwsgiconf.options.alarm_types.AlarmSignal

xmpp

alias of uwsgiconf.options.alarm_types.AlarmXmpp

set_basic_params(msg_size=None, cheap=None, anti_loop_timeout=None)
Parameters:
  • msg_size (int) – Set the max size of an alarm message in bytes. Default: 8192.
  • cheap (bool) – Use main alarm thread rather than create dedicated threads for curl-based alarms
  • anti_loop_timeout (int) – Tune the anti-loop alarm system. Default: 3 seconds.
print_alarms()

Print out enabled alarms.

register_alarm(alarm)

Register (create) an alarm.

Parameters:alarm (AlarmType|list[AlarmType]) – Alarm.
alarm_on_log(alarm, matcher, skip=False)

Raise (or skip) the specified alarm when a log line matches the specified regexp.

Parameters:
  • alarm (AlarmType|list[AlarmType]) – Alarm.
  • matcher (str|unicode) – Regular expression to match log line.
  • skip (bool) –
alarm_on_fd_ready(alarm, fd, message, byte_count=None)

Triggers the alarm when the specified file descriptor is ready for read.

This is really useful for integration with the Linux eventfd() facility. Pretty low-level and the basis of most of the alarm plugins.

Parameters:
  • alarm (AlarmType|list[AlarmType]) – Alarm.
  • fd (str|unicode) – File descriptor.
  • message (str|unicode) – Message to send.
  • byte_count (int) –

    Files to read. Default: 1 byte.

    Note

    For eventfd set 8.

alarm_on_queue_full(alarm)

Raise the specified alarm when the socket backlog queue is full.

Parameters:alarm (AlarmType|list[AlarmType]) – Alarm.
alarm_on_segfault(alarm)

Raise the specified alarm when the segmentation fault handler is executed.

Sends a backtrace.

Parameters:alarm (AlarmType|list[AlarmType]) – Alarm.