Ask Your Question
0

How can I retrieve facts from another server?

asked 2016-06-28 04:10:44 -0500

rory gravatar image

I have a manifest which installs the Zabbix agent, it looks like this:

class project::zabbix::agent {
    class { 'zabbix::agent':
        server => '1.2.3.4',
    }
}

I need to get the actual IP address of my Zabbix server, and put it in place of the '1.2.3.4'.

On my Zabbix server I can see the IP is in networking=>ip when I run "facter", but I don't know how to access this data from other nodes.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-06-28 19:44:42 -0500

lupin gravatar image

You can create a custom fact of your Zabbix server IP address then use that on you class.

Custom Facts

e.g

Facter.add(:zabbix_server) do
  setcode
     hname = Facter.value(:hostname)
     if hname =~ "zabbix_server_hostname"
        zabbix_server_ip = Facter.value(:ipaddress)
    end 
  end
end

Then use in your class.

class { 'zabbix::agent':
        server => $::zabbix_server
    }
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-28 04:10:44 -0500

Seen: 28 times

Last updated: Jun 28 '16