Skip to content

Latest commit

 

History

History
337 lines (270 loc) · 8.4 KB

README.md

File metadata and controls

337 lines (270 loc) · 8.4 KB

What is aware?

aware is a PHP monitoring system that supports storing PHP errors (events) into different storage backends. The events can be later retrieved from backends that support retrieval.

How does it work?

Roughly: override zend_error_cb, set_error_handler and restore_error_handler with a custom function that takes a copy of the current context, sends error to the configured backends and invokes original error handler(s).

The backend storage is abstracted from away and each backend storage is a separate PHP extension. The backend will receive a zval * containing information about the current error which it usually serializes and stores based on it's own configuration.

Currently it is possible to chain the backends to allow configurations such as store the event to tokyo tyrant and send snmp trap as well.

So the cycle is a about the following:

  1. Aware startup -> override zend_error_cb with interceptor and store a pointer to the original callback

  2. PHP error happens -> engine calls zend_error_cb which brings the error message etc to our callback -> loop through all configured backends and pass the information -> the backend (normally) serializes the event and stores based on it's config -> call the original error callback

What does aware monitor?

At the moment following things: - php errors - slow requests - peak memory usage during request

Available functions:

aware_event_trigger(int error_level, string message)

Trigger an event. The event gets sent into configured storage backends but the internal
error handler is not invoked

aware_event_get(string mod_name, string uuid)

Get event from storage backend module. Supported in 'files' and 'tokyo' backends

aware_event_get_list(string mod_name[, int start, int limit])

Get list of events from storage backend module. Supported in 'files' and 'tokyo' backends

aware_event_delete(string mod_name, string uuid)

Delete event from storage backend module. Supported in 'files' and 'tokyo' backends

aware_storage_module_list()

Returns a list of currently configured storage backend modules

GUI

There is a very simple GUI available in gui/ directory. It needs a lot of work.

Spread backend

This product uses software developed by Spread Concepts LLC for use in the Spread toolkit. For more information about Spread see http://www.spread.org

Storage backends

email

Sends an email containing information about the error

Ini settings

aware_email.to_address String Email recipient address. For example john.doe@example.com

files

Stores the information in files

Ini settings

aware_files.storage_path String Path to store the events to

snmp

Sends an snmp trap

Ini settings

aware_snmp.trap_host String hostname:port of the snmptrapd
aware_snmp.trap_community String snmp community for the trap
aware_snmp.trap_oid String OID for the trap
aware_snmp.name_oid String OID for holding the script name
aware_snmp.error_msg_oid String OID for holding the error message
aware_snmp.uuid_oid String OID for holding the uuid

spread

Sends the event to a spread network

Ini settings

aware_spread.spread_name String port@hostname format of the spread daemon to connect to
aware_spread.group_name String In which group to send the message to
aware_spread.user_name String Username of the sender, must be unique to the machine

stomp

Sends the event to stomp message queue

Ini settings

aware_stomp.server_uri String Uri of the server in tcp://hostname:port format
aware_stomp.queue_name String Name of the queue to send the message to
aware_stomp.username String Username to the queue (optional)
aware_stomp.password String Password to the queue (optional)

tokyo

Stores into tokyo cabinet or tokyo tyrant

Ini settings

aware_tokyo.backend String Can be 'cabinet' or 'tyrant'

Tokyo Tyrant specific ini-settings

aware_tokyo.tyrant_host String Hostname if 'tyrant' is chosen as the backend
aware_tokyo.tyrant_port Integer Port if 'tyrant' is chosen as the backend

Tokyo Cabinet specific ini-settings

aware_tokyo.cabinet_file String Location of the cabinet file if cabinet is chosen
aware_tokyo.cabinet_block Boolean Set to 'on' to use non-blocking locks

zeromq2

Sends events to zeromq2

Ini settings

aware_zeromq2.dsn String Where to connect the publisher socket (Default: tcp://127.0.0.1:5555)
aware_zeromq2.topic String Topic to publish the messages in (Default: aware)

Ini settings

Core settings

aware.enabled boolean Is aware enabled (Default: On)
aware.use_cache boolean Use serialization cache (Default: On)
aware.error_reporting integer Error reporting level (which events are stored)
aware.module_error_reporting string Override error reporting on backend module basis (Format: tokyo=E_ALL,snmp=E_ERROR)
aware.depth integer How many levels to serialize
aware.log_get boolean Whether to include _GET values in the serialized event
aware.log_post boolean Whether to include _POST values in the serialized event
aware.log_session boolean Whether to include _SESSION values in the serialized event
aware.log_cookie boolean Whether to include _COOKIE values in the serialized event
aware.log_env boolean Whether to include _ENV values in the serialized event
aware.log_server boolean Whether to include _SERVER values in the serialized event
aware.log_files boolean Whether to include _FILES values in the serialized event
aware.log_backtrace boolean Whether to include backtrace in the serialized event
aware.enable_event_trigger boolean Whether to log events generated with aware_event_trigger
aware.storage_modules string List of storage backend modules to enabled (CSV)
aware.slow_request_threshold integer Setting > 0 activates slow request monitor (milliseconds)
aware.memory_usage_threshold integer Setting > 0 activates memory usage monitor (bytes)
aware.error_page string Error page filename. This page is displayed in case of a fatal error when display_errors is off