Contents
run()
Main function, called by actual script in bin/, wraps all work done by script with the sole exception of reading and validating command line arguments.
These tasks (reading and validating arguments) are in this module, but they are called from OmniPITR::Program::new()
Name of called method should be self explanatory, and if you need further information - simply check doc for the method you have questions about.
read_logs()
Wraps all work related to finding actual log files, reading and parsing them, and extracting information to "state".
parse_line()
Given line from logs, parses it to atoms, and stores important information to state.
clean_old_state()
Calls ->clean_state() on all parser objects (that were used in current iteration).
This is to remove from state old data, that is of no use currently.
get_list_of_log_files()
Scans given log paths, and collects list of files that are log files.
List of all log files is stored in $self->{'log_files'}, being arrayref.
extract_epoch()
Given line from logs, it returns epoch value of leading timestamp.
If the line cannot be parsed, or the value is not sensible time - undef is returned.
Returned epoch can (and usually will) contain fractional part - subsecond data with precision of up to microsecond (0.000001s).
state()
Helper function, accessor, to state hash.
Has 1, or two arguments. In case of one argument - returns value, from state, for given key.
If it has two arguments, then - if 2nd argument is undef - it removes the key from state, and returns.
If the 2nd argument is defined, it sets value for given key to given value, and returns it.
load_state()
Handler reading of state file.
It is important to note that it uses locking, so it will not conflict with state writing from another run of omnipitr-monitor.
save_state()
Saves state in safe way (with proper locking).
read_args()
Function which handles reading of base arguments ( i.e. without options specific to checks ).
validate_args()
Does all necessary validation of given command line arguments.
load_dynamic_object()
Loads class which name is based on arguments.
If loading will succeed, creates new object of this class and returns it.
If it fails - ends program with logged message.