Ask Your Question
1

exported resources - multiple servers in domain only export one router

asked 2013-12-03 19:07:57 -0500

junaid gravatar image

Hi, I am using puppet + nagios + exported resources.

At the moment each server exports itself for monitoring. I would like the nagios host definitoin to have a 'parent' (the router). Is there anyway for puppet to export the router host as well? The problem I foresee is some of our clients have 4 servers. How to get it to stop exporting 4 routers?

Regards, Junaid

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-12-05 05:19:51 -0500

Stefan gravatar image

Interesting question. One possibility that I see is to write a class that every node includes with a specific parameter that represents the parent. And then use puppetdbquery to get a list of servers that have the same parent and use an algorithm to pick the server that should take the master role in exporting the correct resource. Something like

class nagios::router($router) {
  # siblings have the same class with the same parameter
  $siblings = query_nodes("Class[nagios::router]{router=${::router}}", fqdn)
  $master = $siblings[0]

  if $::fqdn == $master {
    # i am the master
    export the resource
  }
}

Interested to hear other opinions

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: 2013-12-03 19:07:57 -0500

Seen: 119 times

Last updated: Dec 05 '13