15. Anatomy of a Module
Each module inherits (@ISA = ("Module_Template");) from
_Modules/Module_Template.
15.1. Module_Template.pm
- sub template
-
Called by each module constructor (e.g., Mon_Processes::new):
- ensures pointers to base-modules configuration, application output
streams and the date-time stamp have all been passed through;
- sets the default OUTPUT_MODES, currently to "Local", implemented
by _Mods_Out/Out_Local (this value is often overridden to "NONE"
in modules which collect no data of their own, i.e., provide data
for application stream only);
- sets the default configuration for the monitoring module's own
output streams — Local Logs — should they exist, which
can be overridden in the module constructor;
- grabs the output streams configuration from ModsConfig --- this takes
priority over both the config in the module's construction (new) and
that within the template;
- copies the config to std_log_echo;
- Simple read methods: sub stream_config
last_data_write_time and name
-
- Simple write methods: sub set_last_data_write_time
-
- sub init_output_modes
-
Initialise our own (not application) output streams, e.g., open files.
- maintain_logs
-
Maintain our own (not application) output streams, e.g., rotate files.
- sub data
-
Get data from the operating system, usually with the help of something
from LocalConfig.
- sub tick, warnings_scan and sub trouble_scan
-
Default methods for sending output to the application output streams —
these are usually overridden: such methods often grab data via
LocalConfig and scan it for things of interest, before sending
messages to the appropriate application streams.
15.2. Typical Module
- sub new
-
- Sets default configuration for its own output streams (which override
those set in Module_Template::template, but are overridden by
those set in ModsConfig — the latter being grabbed in
the call (below) to Module_Template::template.
- Possibly overwide the default setting for our own output streams
(default is set in Module_Template::template), e.g.
$self->{STREAMS} = "NONE" if we are a monitoring-only module
(have no output streams of our own) and then initialise these
output streams (init_output_streams).
- sub data
-
Possibly override method inherited from Module_Template for
grabbing some data from the operating-system (probably with help
from LocalConfig).
- sub tick, warnings_scan and trouble_scan
-
Possibly override methods from Module_Template for grabbing data
from the OS, (for warnings and trouble) scanning for things of interest,
and sending messages to the application output streams.
About this document:
Produced from the SGML: /home/isd/public_html/_unix_sys_mon/_reml_grp/index.reml
On: 15/3/2006 at 11:33:6
Options: reml2 -i noindex -l long -o html -p multiple