bin/check-tripwire.rb in sensu-plugins-tripwire-1.1.2 vs bin/check-tripwire.rb in sensu-plugins-tripwire-1.2.0
- old
+ new
@@ -59,10 +59,16 @@
short: '-P PASSWORD',
long: '--password PASSWORD',
description: 'Password to unlock the keyfile',
required: false
+ option :configfile,
+ short: '-f path/to/configfile',
+ long: '--config-file path/to/configfile',
+ description: 'Configuration to use for the check',
+ required: false
+
option :database,
short: '-d path_or_url_to_database',
long: '--database path_or_url_to_database. if an http url is supplied the database will be retrieved prior to the check',
description: 'Database to use for the check',
required: false
@@ -74,19 +80,21 @@
required: false,
default: '100'
option :warn,
short: '-w warn severity',
- long: '--warn warining severity',
+ long: '--warn warning severity',
description: 'Tripwire severity greater than this is warning',
required: false,
default: '66'
def run_tripwire
- site_key = (config[:sitekey] && "-S #{config[:sitekey]}") || ''
+ command = "#{config[:binary]} --check"
+ command << " -S #{config[:sitekey]}" if config[:sitekey]
+ command << " -c #{config[:configfile]}" if config[:configfile]
database = retrieve_database
- database = (database && "-d #{database}") || ''
- `#{config[:binary]} --check #{site_key} #{database}`
+ command << " -d #{database}" if database
+ `#{command}`
end
def retrieve_database
database = config[:database]