Puppet Class: zabbix::javagateway

Inherits:
zabbix::params
Defined in:
manifests/javagateway.pp

Summary

This will install and configure the zabbix-agent deamon

Overview

Examples:

class { 'zabbix::javagateway':
  zabbix_version => '6.0',
}

Parameters:

  • zabbix_version (Any) (defaults to: $zabbix::params::zabbix_version)

    This is the zabbix version.

  • zabbix_package_state (Any) (defaults to: $zabbix::params::zabbix_package_state)

    The state of the package that needs to be installed: present or latest.

  • manage_firewall (Boolean) (defaults to: $zabbix::params::manage_firewall)

    When true, it will create iptables rules.

  • manage_repo (Boolean) (defaults to: $zabbix::params::manage_repo)

    When true, it will create repository for installing the javagateway.

  • pidfile (Any) (defaults to: $zabbix::params::javagateway_pidfile)

    Name of pid file.

  • listenip (Any) (defaults to: $zabbix::params::javagateway_listenip)

    List of comma delimited ip addresses that the agent should listen on.

  • listenport (Any) (defaults to: $zabbix::params::javagateway_listenport)

    Agent will listen on this port for connections from the server.

  • startpollers (Any) (defaults to: $zabbix::params::javagateway_startpollers)

    Number of worker threads to start.

  • timeout (Any) (defaults to: $zabbix::params::javagateway_timeout)

    Number of worker threads to start.

Author:

  • Werner Dijkerman ikben@werner-dijkerman.nl



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'manifests/javagateway.pp', line 16

class zabbix::javagateway (
  $zabbix_version           = $zabbix::params::zabbix_version,
  $zabbix_package_state     = $zabbix::params::zabbix_package_state,
  Boolean $manage_firewall  = $zabbix::params::manage_firewall,
  Boolean $manage_repo      = $zabbix::params::manage_repo,
  $pidfile                  = $zabbix::params::javagateway_pidfile,
  $listenip                 = $zabbix::params::javagateway_listenip,
  $listenport               = $zabbix::params::javagateway_listenport,
  $startpollers             = $zabbix::params::javagateway_startpollers,
  $timeout                  = $zabbix::params::javagateway_timeout,
) inherits zabbix::params {
  # Fix for pid file. Is different in Zabbix (4, 5) and 6
  $real_pidfile = $zabbix_version ? {
    /^[45]\.[024]/ => pick($pidfile, '/var/run/zabbix/zabbix_java.pid'),
    /^[6]\.[024]/  => pick($pidfile, '/var/run/zabbix/zabbix_java_gateway.pid'),
  }
  # Only include the repo class if it has not yet been included
  unless defined(Class['Zabbix::Repo']) {
    class { 'zabbix::repo':
      manage_repo    => $manage_repo,
      zabbix_version => $zabbix_version,
    }
  }

  # Installing the package
  package { 'zabbix-java-gateway':
    ensure  => $zabbix_package_state,
    require => Class['zabbix::repo'],
    tag     => 'zabbix',
  }

  # Configuring the zabbix-javagateway configuration file
  file { '/etc/zabbix/zabbix_java_gateway.conf':
    ensure  => file,
    owner   => 'zabbix',
    group   => 'zabbix',
    mode    => '0640',
    notify  => Service['zabbix-java-gateway'],
    require => Package['zabbix-java-gateway'],
    replace => true,
    content => template('zabbix/zabbix_java_gateway.conf.erb'),
  }

  # Controlling the 'zabbix-java-gateway' service
  service { 'zabbix-java-gateway':
    ensure     => running,
    enable     => true,
    hasstatus  => true,
    hasrestart => true,
    require    => [
      Package['zabbix-java-gateway'],
      File['/etc/zabbix/zabbix_java_gateway.conf']
    ],
  }

  # Manage firewall
  if $manage_firewall {
    firewall { '152 zabbix-javagateway':
      dport => $listenport,
      proto => 'tcp',
      jump  => 'accept',
      state => ['NEW','RELATED', 'ESTABLISHED'],
    }
  }
}