App::MadEye::Plugin::Agent::SSLExpireDate - monitoring SSL expire date


App-MadEye documentation Contained in the App-MadEye distribution.

Index


Code Index:

NAME

Top

App::MadEye::Plugin::Agent::SSLExpireDate - monitoring SSL expire date

SCHEMA

Top

    type: map
    mapping:
        duration:
            type: str
            required: yes
        type:
            type: str
            required: yes
        target:
            type: seq
            required: yes
            sequence:
                - type: str

AUTHORS

Top

Tokuhiro Matsuno

SEE ALSO

Top

Net::SSL::ExpireDate, App::MadEye


App-MadEye documentation Contained in the App-MadEye distribution.

package App::MadEye::Plugin::Agent::SSLExpireDate;
use strict;
use warnings;
use App::MadEye::Plugin::Agent::Base;
use Net::SSL::ExpireDate;

sub is_dead {
    my ($self, $target) = @_;

    my $conf     = $self->config->{config};
    my $type     = $conf->{type} or die "missing type";
    my $duration = $conf->{duration} or die "missing duration";

    my $ed = Net::SSL::ExpireDate->new( $type, $target );

    if ($ed->is_expired($duration)) {
        return "$target will expire at " . $ed->expire_date->ymd;
    } else {
        return; # ok.
    }
}

1;
__END__