mentat.module.precache module¶
This Mentat module is a script providing pre-caching functions and features. Use case for this module is precaching distinct values of selected database table column values. These can be then used for example for generating value selection widgets for user interface.
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-precache.py --help
# Run in debug mode (enable output of debugging information to terminal).
mentat-precache.py --debug
# Run with increased logging level.
mentat-precache.py --log-level debug
Available script commands¶
precache
(default)Perform pre-caching of selected database table column values. These values can be then used for various use cases like generating value selection widgets for user interface etc.
status
Display status of cache files within cache directory.
Custom configuration¶
Custom command line options¶
--allow-empty
Allow storing empty item sets as valid result (flag).
Type:
boolean
, default:False
--cache-dir dir-name
Filesystem path to cache directory.
Type:
string
, default:/var/mentat/cache
Custom config file options¶
itemsets
List of requested itemsets to be precached. It must be in a form of
list
constaininglist
of twostrings
, index 0 is a name of the itemset, index 1 is a name of event table column.Example configuration:
"itemsets": [ ["itemset-stat-categories", "category"], ["itemset-stat-sourcetypes", "source_type"], ["itemset-stat-targettypes", "target_type"], ["itemset-stat-detectors", "node_name"], ["itemset-stat-detectortypes", "node_type"], ["itemset-stat-protocols", "protocol"], ["itemset-stat-groups", "resolvedabuses"], ["itemset-stat-classes", "eventclass"], ["itemset-stat-severities", "eventseverity"], ["itemset-stat-inspectionerrors", "inspectionerrors"] ],
Type:
list of list of strings
, default:[]
-
class
mentat.module.precache.
MentatPrecacheScript
[source]¶ Bases:
mentat.script.fetcher.FetcherScript
Implementation of Mentat module (script) providing pre-caching functions and features.
-
CONFIG_ALLOW_EMPTY
= 'allow_empty'¶
-
CONFIG_CACHE_DIR
= 'cache_dir'¶
-
CONFIG_ITEMSETS
= 'itemsets'¶
-
cbk_command_precache
()[source]¶ Implementation of the precache command (default).
Perform pre-caching of selected database table column values. These values can be then used for various use cases like generating value selection widgets for user interface etc.
-