Skip to content

Multi node Zabbix Server setup

Werner Dijkerman edited this page Mar 5, 2016 · 3 revisions

Multi node Zabbix Server

Introduction

This page will describe how to setup an multinode Zabbix Server with the wdijkerman-zabbix puppet module. Before you continue, you’ll need to know which database you want to use and how many servers.

Configuring the site manifest

We will discuss 2 setups which are supported with the wdijkerman-zabbix puppet module. This is using the following backends:

  • PostgreSQL

  • MySQL

Zabbix can also use other backends like Oracle Database, as I don’t have the ability to create/maintain Oracle databases this is something I can’t support now. If you do have examples which shows how to setup an multi node setup for Zabbix Server with an Oracle Database as backend, please let me know. We can update this document so other can use it too.

In the next paragraph each earlier mentioned database will be explained. Examples will be given for an 2 node setup and an 3 node setup.

PostgreSQL

The following configuration can be used when PostgreSQL is the preferred database.

2 Servers

This example will show an configuration with 2 servers:

node 'server01.example.com' {
# My ip: 192.168.20.11
  class { 'apache':
      mpm_module => 'prefork',
  }
  class { 'apache::mod::php': }
  class { 'zabbix::web':
    zabbix_url    => 'zabbix.dj-wasabi.nl',
    zabbix_server => 'server01.example.com',
    database_host => 'server02.example.com',
    database_type => 'postgresql',
  }
  class { 'postgresql::client': }
  class { 'zabbix::server':
    database_host  => 'server02.example.com',
    database_type  => 'postgresql',
  }
}
node 'server02.example.com' {
# My ip: 192.168.20.12
  class { 'postgresql::server':
      listen_addresses => '192.168.20.12'
    }
  class { 'zabbix::database':
    database_type    => 'postgresql',
    zabbix_web_ip    => '192.168.20.11',
    zabbix_server_ip => '192.168.20.11',
  }
}

In the above example I’ve added the database_type and set it to postgresql. PostgreSQL is de default configured database_type for this puppet module and this is optional.

We have 2 servers:

server01.example.com
This host will run the following components: Apache, Zabbix Web and the Zabbix Server. This is the host on which the web interface is listening/can be used and also the host on which the API requests is handled. We have to configure the `database_host` parameter to let Zabbix know where to find host running the database. Also we have to install the postgres client software, we need this for creating and inserting the basic tables/data into the Database.
server02.example.com
This host will only run the PostGreSQL database. The `zabbix::database` will configure the database and will create the Zabbix database user. We have to tell the database on which nodes the other components are running: Users will be created which can only login from these hosts.

3 Servers

This example will show an configuration with 3 servers:

node 'server01.example.com' {
# My ip: 192.168.20.11
  class { 'apache':
      mpm_module => 'prefork',
  }
  class { 'apache::mod::php': }
  class { 'zabbix::web':
    zabbix_url    => 'zabbix.dj-wasabi.nl',
    zabbix_server => 'server02.example.com',
    database_host => 'server03.example.com',
    database_type => 'postgresql',
  }
}
node 'server02.example.com' {
# My ip: 192.168.20.12
  class { 'postgresql::client': }
  class { 'zabbix::server':
    database_host  => 'server03.example.com',
    database_type  => 'postgresql',
  }
}
node 'server03.example.com' {
# My ip: 192.168.20.13
  class { 'postgresql::server':
      listen_addresses => '192.168.20.13'
    }
  class { 'zabbix::database':
    database_type    => 'postgresql',
    zabbix_web_ip    => '192.168.20.11',
    zabbix_server_ip => '192.168.20.12',
  }
}

In the above example I’ve added the database_type and set it to postgresql. PostgreSQL is de default configured database_type for this puppet module and this is optional.

We have 3 servers:

server01.example.com
This is the frontend server, running Apache and the "Zabbix Web" package. This is the host on which the web interface is listening/can be used and also the host on which the API requests is handled.
server02.example.com
This is the host running the Zabbix Server Package/Service. We have to configure the `database_host` parameter to let Zabbix know where to find host running the database. Also we have to install the postgres client software, we need this for creating and inserting the basic tables/data into the Database.
server03.example.com
This is the host running the PostgreSQL database. The `zabbix::database` will configure the database and will create the Zabbix database user. We have to tell the database on which nodes the other components are running: Users will be created which can only login from these hosts.

MySQL

The following configuration can be used when MySQL is the preferred database.

2 Servers

This example will show an configuration with 2 servers:

node 'server01.example.com' {
# My ip: 192.168.20.11
  class { 'apache':
      mpm_module => 'prefork',
  }
  class { 'apache::mod::php': }
  class { 'zabbix::web':
    zabbix_url    => 'zabbix.dj-wasabi.nl',
    zabbix_server => 'server01.example.com',
    database_host => 'server02.example.com',
    database_type => 'mysql',
  }
  class { 'mysql::client': }
  class { 'zabbix::server':
    database_host  => 'server02.example.com',
    database_type  => 'mysql',
  }
}
node 'server02.example.com' {
# My ip: 192.168.20.12
    class { 'mysql::server':
      override_options => {
        'mysqld'       => {
          'bind_address' => '192.168.20.12',
        },
      },
    }
  class { 'zabbix::database':
    database_type    => 'mysql',
    zabbix_server    => 'server01.example.com',
    zabbix_web       => 'server01.example.com',
  }
}

We have 2 servers:

server01.example.com
This host will run the following components: Apache, Zabbix Web and the Zabbix Server. This is the host on which the web interface is listening/can be used and also the host on which the API requests is handled.  We have to configure the `database_host` parameter to let Zabbix know where to find host running the database. Also we have to install the postgres client software, we need this for creating and inserting the basic tables/data into the Database.
server02.example.com
This host will only run the MySQL database.  The `zabbix::database` will configure the database and will create the Zabbix database user. We have to tell the database on which nodes the other components are running: Users will be created which can only login from these hosts.

3 Servers

This example will show an configuration with 3 servers:

node 'server01.example.com' {
# My ip: 192.168.20.11
  class { 'apache':
      mpm_module => 'prefork',
  }
  class { 'apache::mod::php': }
  class { 'zabbix::web':
    zabbix_url    => 'zabbix.dj-wasabi.nl',
    zabbix_server => 'server02.example.com',
    database_host => 'server03.example.com',
    database_type => 'mysql',
  }
}
node 'server02.example.com' {
# My ip: 192.168.20.12
  class { 'mysql::client': }
  class { 'zabbix::server':
    database_host  => 'server03.example.com',
    database_type  => 'mysql',
  }
}
node 'server03.example.com' {
# My ip: 192.168.20.13
    class { 'mysql::server':
      override_options => {
        'mysqld'       => {
          'bind_address' => '192.168.20.13',
        },
      },
    }
  class { 'zabbix::database':
    database_type    => 'mysql',
    zabbix_server    => 'server02.example.com',
    zabbix_web       => 'server01.example.com',
  }
}

We have 3 servers:

server01.example.com
This is the frontend server, running Apache and the "Zabbix Web" package. This is the host on which the web interface is listening/can be used and also the host on which the API requests is handled.
server02.example.com
This is the host running the Zabbix Server Package/Service. We have to configure the `database_host` parameter to let Zabbix know where to find host running the database. Also we have to install the MySQL client software, we need this for creating and inserting the basic tables/data into the Database.
server03.example.com
This is the host running the MySQL database. The `zabbix::database` will configure the database and will create the Zabbix database user. We have to tell the database on which nodes the other components are running: Users will be created which can only login from these hosts.