Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to create a nagios_hostgroup if some hosts exists. For creating hosts in nagios I am using exported resources which I collect on the monitoring server.

How can I test that a exported nagios_host resource exists? I tried the following:

Nagios_host <<| |>>

if defined(Nagios_host['host_1']) and defined(Nagios_host['host_2']) {
  nagios_hostgroup { 'database_servers':
    alias   => 'My Hostgroup',
    members => 'host_1,host_2',
  }
}

Any idea?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.