| 1 | package Monitoring::Sneck::Checks::linux_ras; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 32 | ▶ | use 5.014; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 32 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 32 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 32 | ▶ | use parent 'Monitoring::Sneck::Checks::base'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | Monitoring::Sneck::Checks::linux_ras - checks for errors rasdaemon has logged | ||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | =head1 VERSION | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | Version 0.0.1 | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | =cut | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 32 | our $VERSION = '0.0.1'; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | # ras-mc-ctl, found through PATH. Set by tests. | ||||||||||||||||||||
| 21 | 32 | our $RAS_MC_CTL = 'ras-mc-ctl'; | |||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | =head1 SYNOPSIS | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | rasdaemon|perl:linux_ras | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | =head1 DESCRIPTION | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | Runs ras-mc-ctl db --summary, found through PATH, for the hardware | ||||||||||||||||||||
| 30 | errors rasdaemon has logged, such as memory, PCIe, and machine check | ||||||||||||||||||||
| 31 | errors. Any line that is not blank or starting with "No " is a error, | ||||||||||||||||||||
| 32 | which is CRITICAL, the lines following the status line. ras-mc-ctl | ||||||||||||||||||||
| 33 | exiting non-zero is UNKNOWN. | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | =head1 METHODS | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | =head2 check | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | Does the check. | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | =cut | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 9 | ▶ | sub check { | ||||||||||||||||||
|
Subroutine
check: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 44 | 9 | my ($self) = @_; | |||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 9 | my ( $exit, $output ) = $self->run_command( $RAS_MC_CTL, 'db', '--summary' ); | |||||||||||||||||||
| 47 | 6 | ▶ | return $self->finish( $self->UNKNOWN, 'ras-mc-ctl exited ' . $exit . ', ' . ( $output =~ s/\s+\z//r ) ) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | if $exit != 0; | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 5 | ▶ | my @errors = grep { /\S/ && !/\ANo / } split( /\n/, $output ); | ||||||||||||||||||
|
Condition100%3/3
/\S/u && !/\ANo /u
MC/DC100%2/2
/\S/u && !/\ANo /u
/\S/u
!/\ANo /u
Truth table100%3/3
A && not(B)
A= /\S/uB= !/\ANo /u
| |||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 5 | ▶ | return $self->finish( $self->CRITICAL, 'rasdaemon has logged errors', @errors ) if @errors; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | 3 | return $self->finish( $self->OK, 'no errors logged by rasdaemon' ); | |||||||||||||||||||
| 55 | } ## end sub check | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 32 | 1; | |||||||||||||||||||