1 Ohai.plugin(:Postgresql) do
4 collect_data(:default) do
7 Dir.glob("/etc/postgresql/*/*/postgresql.conf").each do |conf|
8 cluster = conf.sub("/etc/postgresql/", "").sub("/postgresql.conf", "")
10 postgresql[:clusters] = Mash.new unless postgresql[:clusters]
11 postgresql[:clusters][cluster] = Mash.new unless postgresql[:clusters][cluster]
12 postgresql[:clusters][cluster][:version] = cluster.split("/").first.to_f
14 IO.foreach(conf) do |line|
15 if line =~ /^ *port *= *([0-9]+)\s+/
16 postgresql[:clusters][cluster][:port] = $1