Monito...bility(3pm)
β¨ Monitoring::Availability β¨
okay bestie, sit DOWN because we're talking about Monitoring::Availability (that's the 3pm perl module manual, if you were wondering which manual we're in π
). It's giving "I crunch Nagios/Icinga/Shinken logfiles and tell you how available your stuff actually was" and honestly? Iconic. Let's get into it π«Ά
πΈ SYNOPSIS πΈ
use Monitoring::Availability;
my $ma = Monitoring::Availability->new();
that's it. that's the vibe check. you load it, you make an object, you go off π
π¦ DESCRIPTION π¦
so this module calculates the availability for hosts/server from given logfiles. and like, heads up: the Logfileformat is Nagios/Icinga only. no cap. don't come at it with something else, it's not gonna eat that π
π REPOSITORY π
Git: http://github.com/sni/Monitoring-Availability
π CONSTRUCTOR π
β¨ new ( [ARGS] ) β¨
Creates a Monitoring::Availability object. new takes at least the logs parameter β no logs, no party, fr fr. Arguments are in key-value pairs, like a little group chat where every name has its own reply π¬
rpttimeperiodβ report timeperiod. defines a timeperiod for this report. Will use24x7if not specified. so if you don't say anything, it just assumes you're a 24/7 girlie β¨assumeinitialstatesβ Assume the initial host/service state if none is found, default:yesassumestateretentionβ Assume state retention, default:yesassumestatesduringnotrunningβ Assume state during times when the monitoring process is not running, default:yesincludesoftstatesβ Include soft states in the calculation. Only hard states are used otherwise, default:no. so soft states are lowkey excluded unless you say otherwise πinitialassumedhoststateβ Assumed host state if none is found, default:unspecified
valid options are: unspecified, current, up, down and unreachable
initialassumedservicestateβ Assumed service state if none is found, default:unspecified
valid options are: unspecified, current, ok, warning, unknown and critical
backtrackβ Go back this amount of days to find initial states, default:4. it literally time-travels backward to find your states, main character energy π°οΈshowscheduleddowntimeβ Include downtimes in calculation, default:yestimeformatβ Time format for the log output, default:%sverboseβ verbose mode. it talks more. we love a chatty icon π£οΈbreakdownβ Breakdown availability into'months','weeks','days','none'
adds additional 'breakdown' hash to each result with broken down results
π METHODS π
π calculate π
calculate()
Calculate the availability β¨ Here's everything you can hand it:
startβ Timestamp of startendβ Timestamp of endlog_stringβ String containing the logslog_fileβ File containing the logslog_dirβ Directory containing*.logfileslog_livestatusβ Array with logs from a livestatus query
a sample query could be:
selectall_arrayref(GET logs...\nColumns: time type options, {Slice => 1})
log_iteratorβ Iterator object for logentry objects. For example aMongoDB::Cursorobject.hostsβ array with hostnames for which the report should be generatedservicesβ array with hashes of services for which the report should be generated. The array should look like this:
[{host => 'hostname', service => 'description'}, ...]
initial_statesβ if you use the"current"option forinitialassumedservicestateorinitialassumedhoststateyou 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 π
get_condensed_logs()
returns an array of hashes with the condensed log used for this report. condensed, like a little summary, cute and compact π
π get_full_logs π
get_full_logs()
returns an array of hashes with the full log used for this report. the full tea, unfiltered β
π BUGS π
Please report any bugs or feature requests to <http://github.com/sni/Monitoring-Availability/issues>. don't suffer in silence bestie, tell the devs π
π₯ DEBUGING π₯
You may enable the debug mode by setting MONITORING_AVAILABILITY_DEBUG environment variable. This will create a logfile: /tmp/Monitoring-Availability-Debug.log which gets overwritten with every calculation β yes, EVERY time, so don't get attached to what's in there π. You will need the Log4Perl module to create this logfile.
β SEE ALSO β
You can also look for information at:
- Search CPAN
<http://search.cpan.org/dist/Monitoring-Availability/>
- Github
<http://github.com/sni/Monitoring-Availability>
π AUTHOR π
Sven Nierlein, <nierlein@cpan.org> β absolute legend, we stan π
πΈ COPYRIGHT AND LICENSE πΈ
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.
and that's the whole page, bestie!! π«Ά this was perl v5.20.1, dated 2014-10-25, and it slayed then and it slays now. go calculate some availability, you got this πβ¨
π¦ where this page comes from
- ubuntu jammy: libmonitoring-availability-perl 0.46-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms