Sha256: f8975d739da67b1d8a33e69bb1cd8e5e8011914ed25c8f595d78341c3efcbddd
Contents?: true
Size: 739 Bytes
Versions: 5
Compression:
Stored size: 739 Bytes
Contents
interval 60 default[:rule_file] = '/etc/network/iptables' always_start true run_if do File.exists? plugin.rule_file end collect do def delete_counters(str) str.gsub(/\[\d+\:\d+\]/, '').strip end current_rules = shell_out!('iptables-save').stdout.split("\n").map do |x| x[0] == '#' ? nil : delete_counters(x) end.compact.join("\n") saved_rules = File.read(plugin.rules_file).split("\n").map do |x| x[0] == '#' ? nil : delete_counters(x) # delete counters and comments end.compact.join("\n") event( :service => "iptables #{plugin.rule_file}", :state => current_rules == saved_rules, :description => "iptables rules different between file: #{plugin.rule_file} and iptables-save" ) end
Version data entries
5 entries across 5 versions & 1 rubygems