mentat.module.reporter module¶
This Mentat module is a script providing periodical event reports to target abuse groups.
This script is implemented using the pyzenkit.zenscript
framework and
so it provides all of its core features. See the documentation for more in-depth
details.
It is further based on mentat.script.fetcher
module, which provides
database fetching and message post-processing capabilities.
Usage examples¶
# Display help message and exit.
mentat-reporter.py --help
# Run in debug mode (enable output of debugging information to terminal).
mentat-reporter.py --debug
# Run with insanely increased logging level.
mentat-reporter.py --log-level debug
# Run in TEST DATA mode and MAIL TEST mode, force all reports to go to
# 'admin@domain.org'. In test data mode only events tagged with 'Test'
# category will be processed (useful for debugging). In mail test mode
# all generated reports will be redirected to configured admin email (root
# by default) instead of original contact, which is again useful for
# debugging or testing.
mentat-reporter.py --mail-test-mode --test-data --mail-to admin@domain.org
# Force reporter to use different email report template and localization.
mentat-reporter.py --template-id another --locale cs
Available script commands¶
report
(default)Generate report containing overall Mentat system performance statistics within configured time interval thresholds.
Brief overview of reporting algorithm¶
Reporting algorithm follows these steps:
For all abuse groups found in database:
For all event severities (
low
,medium
,high
,critical
):Fetch reporting configuration settings.
Fetch events with given severity, that appeared in database in given time window and belonging to that particular group.
Filter events with configured reporting filters.
Threshold already reported events.
Fetch relapsed events.
Generate summary and/or extra reports and store them to database.
Send reports via email to target abuse contacts.
-
class
mentat.module.reporter.
MentatReporterScript
[source]¶ Bases:
mentat.script.fetcher.FetcherScript
Implementation of Mentat module (script) providing periodical statistical overview for message processing performance analysis.
-
CONFIG_EVENT_CLASSES_DIR
= 'event_classes_dir'¶
-
CONFIG_FORCE_LOCALE
= 'force_locale'¶
-
CONFIG_FORCE_MODE
= 'force_mode'¶
-
CONFIG_FORCE_TEMPLATE
= 'force_template'¶
-
CONFIG_FORCE_TIMEZONE
= 'force_timezone'¶
-
CONFIG_REPORTS_DIR
= 'reports_dir'¶
-
CONFIG_TEMPLATES_DIR
= 'templates_dir'¶
-
CONFIG_TEMPLATE_VARS
= 'template_vars'¶
-
CONFIG_TEST_DATA
= 'test_data'¶
-
CORECFG_REPORTER
= '__core__reporter'¶
-