Monitoring::Availability - Calculate Availability Data from Nagios and Icinga Logfiles.
use Monitoring::Availability; my $ma = Monitoring::Availability->new();
This module calculates the availability for hosts/server from given logfiles. The Logfileformat is Nagios/Icinga only.
Git: http://github.com/sni/Monitoring-Availability
Creates an Monitoring::Availability object. new takes at least the logs parameter. Arguments are in key-value pairs.
Monitoring::Availability
new
report timeperiod. defines a timeperiod for this report. Will use 24x7 if not specified.
Assume the initial host/service state if none is found, default: yes
Assume state retention, default: yes
Assume state during times when the monitoring process is not running, default: yes
Include soft states in the calculation. Only hard states are used otherwise, default: no
Assumed host state if none is found, default: unspecified
valid options are: unspecified, current, up, down and unreachable
Assumed service state if none is found, default: unspecified
valid options are: unspecified, current, ok, warning, unknown and critical
Go back this amount of days to find initial states, default: 4
Include downtimes in calculation, default: yes
Time format for the log output, default: %s
verbose mode
calculate()
Calculate the availability
Timestamp of start
Timestamp of end
String containing the logs
File containing the logs
Directory containing *.log files
Array with logs from a livestatus query
a sample query could be: selectall_arrayref(GET logs...\nColumns: time type options, {Slice => 1})
array with hostnames for which the report should be generated
array with hashes of services for which the report should be generated. The array should look like this:
[{host => 'hostname', service => 'description'}, ...]
if you use the "current" option for initialassumedservicestate or initialassumedhoststate you have to provide the current states with a hash like this:
{ hosts => { 'hostname' => 'ok', ... }, services => { 'hostname' => { 'description' => 'warning', ... } } }
valid values for hosts are: up, down and unreachable
valid values for services are: ok, warning, unknown and critical
get_condensed_logs()
returns an array of hashes with the condensed log used for this report
get_full_logs()
returns an array of hashes with the full log used for this report
Please report any bugs or feature requests to http://github.com/sni/Monitoring-Availability/issues.
You can also look for information at:
Search CPAN
http://search.cpan.org/dist/Monitoring-Availability/
Github
http://github.com/sni/Monitoring-Availability
Sven Nierlein, <nierlein@cpan.org>
Copyright (C) 2010 by Sven Nierlein
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Monitoring::Availability, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Monitoring::Availability
CPAN shell
perl -MCPAN -e shell install Monitoring::Availability
For more information on module installation, please visit the detailed CPAN module installation guide.