These lines are parsing the zabbix config file by hand:
File.open(zabbix_conf_file).each do |line|
## skip comments
next if line =~ /^(\s+)?#/
## strip tail comments
line.gsub!(/#.*/, '')
## zabbix splits on equals
key, value = line.split("=", 2)
key.chomp!
value.chomp!
## zabbix keys look like strings
next unless key =~ /[A-Za-z0-9]+/
## cool
zabbix_conf[key] = value
end
Use a Ruby INI parser instead.
These lines are parsing the zabbix config file by hand:
Use a Ruby INI parser instead.