Class: CertCheck
- Inherits:
-
Object
- Object
- CertCheck
- Includes:
- NagiosCheck
- Defined in:
- lib/openvpn_cert_nagios/certs.rb,
lib/openvpn_cert_nagios/check.rb,
lib/openvpn_cert_nagios/shell.rb,
lib/openvpn_cert_nagios/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
Instance Method Details
#certs ⇒ Object
24 25 26 27 28 29 |
# File 'lib/openvpn_cert_nagios/check.rb', line 24 def certs @certs ||= Dir.new(.path) .entries .find_all{ |f| f =~ /.*\.crt$/ } .map { |f| "#{ .path }/#{ f }" } end |
#check ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/openvpn_cert_nagios/check.rb', line 11 def check result = certs.reduce({days: 9999, message: []}) do |memo, file| cert = Cert.new(file) memo[:message] << cert. memo[:days] = [cert.expires_in, memo[:days]].min memo end store_value :expires, result[:days] result[:message].sort.join(",").delete(' ') end |