« lib/App/MadEye/Plugin/Agent/SNMP/IPAddress.pm
↑ Summary
lib/App/MadEye/Plugin/Agent/WriteDisk.pm »
| 1 | package App::MadEye::Plugin::Agent::SSLExpireDate; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use App::MadEye::Plugin::Agent::Base; | ||
| 5 | use Net::SSL::ExpireDate; | ||
| 6 | |||
| 7 | sub is_dead { | ||
| 8 | my ($self, $target) = @_; | ||
| 9 | |||
| 10 | my $conf = $self->config->{config}; | ||
| 11 | my $type = $conf->{type} or die "missing type"; | ||
| 12 | my $duration = $conf->{duration} or die "missing duration"; | ||
| 13 | |||
| 14 | my $ed = Net::SSL::ExpireDate->new( $type, $target ); | ||
| 15 | |||
| 16 | if ($ed->is_expired($duration)) { | ||
| 17 | return "$target will expire at " . $ed->expire_date->ymd; | ||
| 18 | } else { | ||
| 19 | return; # ok. | ||
| 20 | } | ||
| 21 | } | ||
| 22 | |||
| 23 | 1; | ||
| 24 | __END__ |